Skip to content

Typescript@next and npm linked node_modules #9566

@pocesar

Description

@pocesar

I'm this problem on windows 10. I have a linked node_module that was created using npm link @pocesar/moip2, Typescript@next is trying to use the typings in the linked node_modules\@types\bluebird\index.d.ts

TypeScript Version: nightly

The tsc --listFiles shows:

../node-moip2/node_modules/@types/bluebird/index.d.ts(759,5): error TS2300: Duplicate identifier 'export='.

g:/www/neuro/node_modules/typescript/lib/lib.d.ts
g:/www/neuro/node_modules/@types/node/index.d.ts
g:/www/neuro/node_modules/@types/express-serve-static-core/index.d.ts
g:/www/neuro/node_modules/@types/mime/index.d.ts
g:/www/neuro/node_modules/@types/serve-static/index.d.ts
g:/www/neuro/node_modules/@types/express/index.d.ts
g:/www/neuro/node_modules/@types/body-parser/index.d.ts
g:/www/neuro/node_modules/@types/lodash/index.d.ts
g:/www/neuro/node_modules/@types/lru-cache/index.d.ts
g:/www/neuro/node_modules/@types/bluebird/index.d.ts
g:/www/neuro/src/server/modules/correios.ts
g:/www/node-moip2/node_modules/@types/bluebird/index.d.ts
g:/www/node-moip2/moip.d.ts

My local tsconfig.json is:

{
    "compilerOptions": {
        "module": "commonjs",
        "noImplicitAny": true,
        "removeComments": false,
        "preserveConstEnums": true,
        "inlineSourceMap": true,
        "outDir": "lib",
        "noImplicitReturns": true,
        "noImplicitUseStrict": true,
        "noImplicitThis": true,
        "noUnusedLocals": true,
        "allowSyntheticDefaultImports": false,
        "allowUnusedLabels": false,
        "allowUnreachableCode": false,
        "noUnusedParameters": true,
        "pretty": true,
        "newLine": "LF",
        "allowJs": false,
        "moduleResolution": "node",
        "target": "es5",
        "declaration": false
    },
    "rootDir": "src/server",
    "exclude": [
        "lib",
        "src/user",
        "src/client",
        "src/buy",
        "src/admin",
        "data",
        "config",
        ".vscode",
        ".tscache",
        "node_modules",
        "tests",
        "conf",
        "keys",
        ".sass-cache",
        "views",
        "public"
    ]
}

The tsconfig.json in moip2:

{
    "compilerOptions": {
        "module": "commonjs",
        "noImplicitAny": true,
        "removeComments": false,
        "preserveConstEnums": true,
        "sourceMap": false,
        "outDir": ".",
        "moduleResolution": "node",
        "target": "es2015",
        "declaration": true
    },
    "files": [
        "moip.ts"
    ]
}

Do I need to use excludes? Doesn't files and excludes cancel each other?

Expected behavior:

Should ignore the node_modules on linked packages as well

Actual behavior:

The exclude option is being ignored for npm link'd packages

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions