tsconfig

How to use paths in tsconfig for a single module?

佐手、 提交于 2020-01-06 07:27:12
问题 This question is a follow-on from How to use paths in tsconfig.json? except I want to do it for a single module. I have a module: It's implemented in src/functions/foo.ts Its contents are: export default interface Bar { } It's imported by another module elsewhere using a non-relative path: import * as Foo from "foo" The compiler doesn't find it: error TS2307: Cannot find module 'foo' This tsconfig doesn't fix that problem ... { "compilerOptions": { "noEmit": true, "strict": true, "module":

ng build --prod Cannot determine the module for class X! Add ThreadListTabsComponent to the NgModule to fix it

时光总嘲笑我的痴心妄想 提交于 2019-12-29 07:45:23
问题 I'm trying to build my Angular 5 app, and I'm getting the error: Cannot determine the module for class ThreadListTabsComponent in /home/brightwater/Differ/src/app/thread-lists/thread-lists.component.ts! Add ThreadListTabsComponent to the NgModule to fix it. This is confusing because I'm importing the offending component in the module: thread-lists.module.ts : import { OtherModules } from './modules-everywhere'; import { NgModule } from '@angular/core' import { SomeOtherComponents } from '.

Typescript module resolution not working

爱⌒轻易说出口 提交于 2019-12-24 08:04:06
问题 Instead of relative module imports I would like to import my modules like this: import { IntHelper } from 'utils/IntHelper'; . Even though intellisense works fine in VSCode the transpiled javascript files throw an exception: Cannot find module . My project structure: root dist src MyProject.ts utils IntHelper.ts tsconfig.json File: MyProject.ts import { IntHelper } from 'utils/IntHelper'; File: IntHelper.ts export module IntHelper { export const xy: string = 'Test'; export function crossSum

Invalid path in Angular library

对着背影说爱祢 提交于 2019-12-23 04:34:51
问题 I am using Angular library and have the following folder structure: coollibrary - components - my.component.ts - services - my.service.ts public_api.ts In public_api, I export the component and service and make the library build. After that I can import the necessary things in my project using import { MyComponent } from 'coollibrary'; but I can not use the following path: import { MyComponent } from 'coollibrary/components' Can I somehow achieve this behavior? I generate library with

Configure a TypeScript project with common dependencies to build multiple plain JavaScript output files

∥☆過路亽.° 提交于 2019-12-22 03:48:58
问题 I'm currently writing some scripts for Bot Land. Bot Land is a real-time strategy game where instead of controlling your units with a mouse and keyboard, you write code to control your bots via an API, and then your bots go fight others' bots. If you're familiar with units in SC2, you can create bots that are similar to blink stalkers, siege tanks, medics, and ultralisks. (It's quite a fun game for software engineers, but that's outside the scope of this question.) Bot control has three

How to use multiple tsconfig files in vs-code?

孤人 提交于 2019-12-20 17:35:10
问题 I am using Visual Studio Code and have a fairly common project structure: ├── client/ │ ├── tsconfig.json ├── shared/ ├── server/ │ ├── tsconfig.json ├── project.json The two tsconfig files have different settings (e.g. the one under client/ targets ES5, the one under server/ targets ES6). Note that there is no tsconfig in the root directory. The problem is that I want the shared directory to be included in both projects. I can't do this using tsconfig because the exclude option won't let me

Visual Studio Code can't resolve angular's tsconfig paths

 ̄綄美尐妖づ 提交于 2019-12-19 07:42:23
问题 I'm trying to import some services using barrels and tsconfigs paths options but I can't get angular and vscode to get along. If it works for one it doesn't for the other and viceversa... My situation seems to be pretty simple: in src/app/services I have a service which is exported in a index.ts my src/tsconfig.app.json is just this: { "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/app", "types": [], "baseUrl": ".", "paths": { "services": ["app/services"] } },

How to use paths in tsconfig.json?

ε祈祈猫儿з 提交于 2019-12-17 02:55:29
问题 I was reading about path-mapping in tsconfig.json and I wanted to use it to avoid using the following ugly paths: The project organization is a bit weird because we have a mono-repository that contains projects and libraries. The projects are grouped by company and by browser / server / universal. How can I configure the paths in tsconfig.json so instead of: import { Something } from "../../../../../lib/src/[browser/server/universal]/..."; I can use: import { Something } from "lib/src/

Visual Studio Typescript to JavaScript

 ̄綄美尐妖づ 提交于 2019-12-13 20:06:57
问题 In my visual studio 2015 project I created a typescript file file1.ts . I have also a tsconfig.json file in my project root folder. I installed tsc globally via npm. I also installed typescript for visual studio from here: https://www.microsoft.com/en-us/download/details.aspx?id=48593 But when I'm compiling my project, I don't get any .js file from my .ts file. But I got a Typescript Virtual Project. After reading a lot of posts here in stackoverflow, I tried a lot to find the problem. Some

Should VSCode report errors for TS files that are excluded from compilation?

爱⌒轻易说出口 提交于 2019-12-13 18:28:05
问题 I filed this Bug Report with VSCode because I have excluded *.spec files from compilation since I don't want to include the files in the NPM distribution. I would still like to see that they compile correctly though via the VSCode tooling. As it stands VSCode intellisense reports that imports that are available on the path can't be imported and this throws a lot of errors, paints the project spec files red, etc. In my report, I said that VSCode error reporting and compilation should be two