Typescript: typscript continues not to ignore node_modules even when specified

Created on 24 Feb 2017  路  5Comments  路  Source: microsoft/TypeScript



TypeScript Version: 2.1.1 / nightly (2.2.0-dev.201xxxxx)
2.2.1

Code

{
    "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "strictNullChecks": true
    },
    "exclude": [
        "node_modules",
        "**/*.spec.ts"
    ]
}

Expected behavior:
to ignore node_modules

Actual behavior:

doesn't ignore node modules

````
webpack: Compiled successfully.
[at-loader] node_modules/@angular/compiler/src/aot/static_reflector.d.ts:8:49
TS2422: A class may only implement another class or interface.

[at-loader] node_modules/@angular/core/src/util/decorators.d.ts:11:5
TS2411: Property 'extends' of type 'Type | undefined' is not assignable to string index type 'Function | any[] | Type'.

[at-loader] node_modules/@angular/forms/src/model.d.ts:168:20
TS2459: Type '{ onlySelf?: boolean | undefined; } | undefined' has no property 'onlySelf' and no string index signature.

[at-loader] node_modules/@angular/forms/src/model.d.ts:178:22
TS2459: Type '{ onlySelf?: boolean | undefined; } | undefined' has no property 'onlySelf' and no string index signature.
````

Question

Most helpful comment

Hi,

Use --skipLibCheck option.

All 5 comments

Hi,

Use --skipLibCheck option.

Your config (above) should be in root of your project. If it is, may be in your code is explicit import from node_modules:

import { Some } from './node_modules/some';

@KostyaTretyak if that was the case it would only give checks for the module i was importing... this is importing all of angular for example

@xtianus79, your configuration is at the root of the project and you run tsc from this root?

And one more: in your destination directory for compiler may remaining artifacts from before you exclude node_modules. So, just in case, remove it.

Please see https://github.com/Microsoft/TypeScript/wiki/FAQ#why-is-a-file-in-the-exclude-list-still-picked-up-by-the-compiler

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dlaberge picture dlaberge  路  3Comments

wmaurer picture wmaurer  路  3Comments

jbondc picture jbondc  路  3Comments

CyrusNajmabadi picture CyrusNajmabadi  路  3Comments

blendsdk picture blendsdk  路  3Comments