onetwothree
onetwothree

Reputation: 682

Excluding node_modules directory from tsconfig still being compiled

I'm getting a number of TS2300 duplicate identifier errors when targetting ES6.

node_modules/typescript/lib/lib.es6.d.ts(17,14): error TS2300: Duplicate identifier 'PropertyKey'.              
node_modules/typescript/lib/lib.es6.d.ts(26,5): error TS2300: Duplicate identifier '[Symbol.toStringTag]'.     
node_modules/typescript/lib/lib.es6.d.ts(33,5): error TS2300: Duplicate identifier 'prototype'.               
node_modules/typescript/lib/lib.es6.d.ts(61,5): error TS2300: Duplicate identifier 'hasInstance'.

Here is my tsconfig.json.

{
    "compilerOptions": {
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "module": "commonjs",
        "moduleResolution": "node",
        "noImplicitAny": false,
        "sourceMap": true,
        "target": "es6",
        "suppressImplicitAnyIndexErrors": true
    },
    "exclude": [
        "node_modules"
    ]
}

I'm not sure why the compiler is still throwing errors about anything in the node_modules directory when it's being excluded. I followed the suggestions from this and the same errors still occur.

FWIW I'm compiling using this command.

./node_modules/.bin/tsc -p ./src

This appears to work using v2 beta. But it'd be nice to know why it fails using v1.8. I can't find any reported bugs on GitHub.

What am I missing?

Upvotes: 1

Views: 551

Answers (1)

basarat
basarat

Reputation: 275799

What am I missing?

Similar structures no longer error in 2.0. Used to in 1.8. That is what is fixing the error.

Upvotes: 1

Related Questions