tsconfig

tsconfig.json not used by TypeScript compiler?

白昼怎懂夜的黑 提交于 2019-12-06 14:18:14
I'm new to TypeScript. I am trying to setup the use of it in WebStorm. I have created a tsconfig.json file in the root of my project and changed the builtin ts compiler to version 1.6.2. Still I need to include reference paths in every ts file. I hoped this would not be needed anymore once I defined the tsconfig.json file. I tried to isolate the issue and went testing outside WebStorm. The issue remains. This is my setup: I installed TypeScript with "npm install -g typescript". I created a folder with this structure: test\ tsconfig.json src\ file1.ts file2.ts file2.ts uses a Class which is

Typescript 3 project reference with third party library (from npm)

痞子三分冷 提交于 2019-12-06 07:59:20
I am using Typescript and am trying to build a background sync with service worker. Someone suggested I should do this: You can split your project into multiple parts with separate tsconfig.json files: one part that includes the dom lib and one part that includes the webworker lib. You can make another part for common code that doesn't depend on either library. You can use project references to help automate the build. If this doesn't fully solve the problem, please update the question to describe the outstanding issues. First, I want to acknowledge I might fundamentally misuse project

typescript module resolution

天大地大妈咪最大 提交于 2019-12-06 00:59:33
问题 Is there a typescript module resolution strategy that would allow me to have both local imports not starting with a slash and imports from node_modules in the same module? With "moduleResolution" set to "node" the compiler cannot find my local modules, with all other options it does not see the modules in node_modules directory I'm trying to import. I have the following imports in my file: import {Injectable} from "angular2/core"; import {Logger} from "core/logging/Logger"; "angular2/core" is

Why is ES7/array polyfill needed despite the tsconfig target is set to ES5

拈花ヽ惹草 提交于 2019-12-05 20:31:49
I have the following settings in the tsconfig.json . I added "es2017" to use Array.includes .: { "compilerOptions": { "lib": [ "es6", "es2017", "dom" ], "module": "es6", "target": "es5" } } Now, I realized, that I have to add import 'core-js/es7/array'; to the polyfills.ts , to use Array.includes also for the Internet Explorer 11. The target in the tsconfig.json is set to es5 , which does not have Array.includes . Why do I need to add the polyfill? TypeScript does not auto-polyfill code. The "official" reason from the relevant GitHub issue seems to be, as @RyanCavanaugh said : Having the

How to have absolute import paths in a library project?

让人想犯罪 __ 提交于 2019-12-05 17:09:20
问题 I have a library with a workspace containing two projects, one for the library itself and one for a test application. ├── projects ├── midi-app └── midi-lib In the workspace tsconfig.json file I configured some @app and @lib paths: "paths": { "@app/*": ["projects/midi-app/src/app/*"], "@lib/*": ["projects/midi-lib/src/lib/*"], "midi-lib": [ "dist/midi-lib" ], "midi-lib/*": [ "dist/midi-lib/*" ] } There is a projects/midi-lib/tsconfig.lib.json file which extends on the above tsconfig.json file

typescript module resolution

左心房为你撑大大i 提交于 2019-12-04 05:32:46
Is there a typescript module resolution strategy that would allow me to have both local imports not starting with a slash and imports from node_modules in the same module? With "moduleResolution" set to "node" the compiler cannot find my local modules, with all other options it does not see the modules in node_modules directory I'm trying to import. I have the following imports in my file: import {Injectable} from "angular2/core"; import {Logger} from "core/logging/Logger"; "angular2/core" is located in node_modules, "core/logging/Logger" is my local module. I think that should be possible, if

getting nyc/istanbul coverage report to work with typescript

做~自己de王妃 提交于 2019-12-04 02:28:54
I'm struggling to get proper coverage with nyc/istanbul for my typescript/mocha/gulp project. I've tried a number of approaches, some of them seem to be unable to use source maps and other fails due to ts-node / tsc errors. My current setup is: nyc relevant config in package.json "scripts": { "test:coverage": "nyc npm run test:unit", "test:unit": "gulp mocha" } "nyc": { "check-coverage": true, "all": true, "extension": [ ".js", ".jsx", ".ts", ".tsx" ], "include": [ "src/**/!(*.test.*).[tj]s?(x)" ], "reporter": [ "html", "lcov", "text", "text-summary" ], "report-dir": "docs/reports/coverage" }

Warning: Cannot find parent tsconfig.json

萝らか妹 提交于 2019-12-03 22:52:00
I would like to fix the warning: Warning: Cannot find parent tsconfig.json in the TypeScript Errors tab in IntelliJ IDEA 2016.3 . My TypeScript code lives in the src directory and my TypeScript output is going to lib as expected without the src folder being added to lib . I consume the lib folder in other projects and it seems to work as expected. So this doesn't seem to be a big problem, but I occasionally have a problem with TSLint where it sometimes does not seem to pick up a .tsx file is JSX and lints incorrectly and seems to occasionally treat it as a normal .ts file. Eventually it seems

How can I setup my VS 2013 TypeScript project to compile my typescript files but exclude my node_modules?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 12:49:11
I'm working on an angular2@beta project in VS 2013 after familiarizing myself with it in IntelliJ. IntelliJ can be set to find the tsconfig.json file and, as of TypeScript 1.6, it can therefore read the "exclude" property and not attempt to compile any of the node_modules. Now that I've moved to VS 2013 with TypeScript 1.7, I'm running into the issue where it's trying to compile the node_modules. I've included the tsconfig.json, but from what I've read, tsconfig.json is fully supported only in VS 2015. Is that the latest on this issue? Is there some way to tell VS 2013 to exclude those files

How to exclude `node_modules/@types/**/node_modules`?

心已入冬 提交于 2019-12-01 20:33:15
I have run into a situation where a type definition in node_modules/@types is installing its own @types dependencies, and these "nested" @types conflict with my top level @types. @types |-angular //v1.5 |-angular-ui-bootstrap |-node_modules |-@types |-angular //v1.6 How can I exclude node_modules/@types/**/node_modules in my tsconfig? One caveat - I am using awesome-typescript-loader, which may have some limitations . What I've tried: 1 - file glob in the exclude property to exclude the nested node_modules compilerOptions.exclude: '../node_modules/@types/**/node_modules' 2 - declaring types