Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tsc not excluding node_modules

{   "compilerOptions": {     "target": "es5",     "module": "commonjs",     "moduleResolution": "node",     "sourceMap": true,     "emitDecoratorMetadata": true,     "experimentalDecorators": true,     "removeComments": false,     "noImplicitAny": false   },   "exclude": [     "node_modules",     "typings/main",     "typings/main.d.ts"   ] } 

I'm trying to upgrade an angular2/beta8 app to RC1, and I'm doing so by basically restructuring according to the Quickstart guide.

I copied its tsconfig.json into my project directory. I think I've got everything else ready,but when I run tsc, I get all kinds of errors within files in my node_modules folder. Why is it even looking in there in the first place?

like image 987
Alex Kibler Avatar asked May 18 '16 20:05

Alex Kibler


People also ask

Does TSC ignore node_modules?

To force TypeScript tsc to ignore node_modules folder, we can set the skipLibCheck option to true . to set the compilerOptions. skipLibCheck option to true in tsconfig. json to skip the node_modules folder check.

Where do I put Tsconfig json?

The tsconfig. json is generally put in the root folder of the project.

What is TSC node?

tsc is the TypeScript compiler, which is completely separate from ts-node . ts-node is a wrapper for Node. js's node executable that installs a TypeScript-enabled module loader that compiles TypeScript on the fly as needed. From its npm page: TypeScript Node works by registering the TypeScript compiler for .

How do I ignore Tsconfig json?

Use the exclude option in your tsconfig. json file to exclude a folder from compilation in TypeScript. The exclude option changes what the include setting finds and defaults to node_modules and bower_components .


1 Answers

Add this option in tsconfig.json

{   "compilerOptions": {     "skipLibCheck": true   }, } 
like image 74
Niko Avatar answered Sep 26 '22 16:09

Niko