Skip to content

Glob support in tsconfig.json exclude array #10202

@devInterests

Description

@devInterests

TypeScript Version:
2.0.0 installed with: npm install typescript@beta.
Also tried: npm install typescript@next same behavior

My Project structure

  • node_modules/*
  • src/*
  • typings/*

My tsconfig.json

{
    "compilerOptions": {
        "module": "commons",
        "outDir": "build",
        "target": "es5",
        "declaration": false,
        "noImplicitAny": false,
        "removeComments": false,
        "sourceMap": false
    },

    "include": [
        "typings/*",
        "src/**/*.ts"
    ]
}

If I understood it right the exclude path is optional it should work just with include. Even when exclude is not present it is excluding node_modules.
TypeScript 2.0 Changelog

The "exclude" property defaults to excluding the node_modules, bower_components, and jspm_packages directories when not specified.

Expected behavior:
Typescript Compile without node_mpdules.
Actual behavior:

Compiles with errors, tsc also compiling node_modules.
Some lines of the output:

node_modules/typescript/lib/typescriptServices.d.ts(2523,9): error TS2300: Duplicate identifier 'interfaceName'.
node_modules/typescript/lib/typescriptServices.d.ts(2524,9): error TS2300: Duplicate identifier 'moduleName'.
node_modules/typescript/lib/typescriptServices.d.ts(2525,9): error TS2300: Duplicate identifier 'typeParameterName'.
node_modules/typescript/lib/typescriptServices.d.ts(2526,9): error TS2300: Duplicate identifier 'typeAliasName'.
node_modules/typescript/lib/typescriptServices.d.ts(2527,9): error TS2300: Duplicate identifier 'parameterName'.
node_modules/typescript/lib/typescriptServices.d.ts(2528,9): error TS2300: Duplicate identifier 'docCommentTagName'.
node_modules/typescript/lib/typescriptServices.d.ts(2529,9): error TS2300: Duplicate identifier 'jsxOpenTagName'.
node_modules/typescript/lib/typescriptServices.d.ts(2530,9): error TS2300: Duplicate identifier 'jsxCloseTagName'.
node_modules/typescript/lib/typescriptServices.d.ts(2531,9): error TS2300: Duplicate identifier 'jsxSelfClosingTagName'.
node_modules/typescript/lib/typescriptServices.d.ts(2532,9): error TS2300: Duplicate identifier 'jsxAttribute'.
node_modules/typescript/lib/typescriptServices.d.ts(2533,9): error TS2300: Duplicate identifier 'jsxText'.
node_modules/typescript/lib/typescriptServices.d.ts(2534,9): error TS2300: Duplicate identifier 'jsxAttributeStringLiteralValue'.
node_modules/typescript/lib/typescriptServices.d.ts(2556,9): error TS2451: Cannot redeclare block-scoped variable 'disableIncrementalParsing'.

>> 8586 non-emit-preventing type warnings
>> Error: tsc return code: 2
Warning: Task "ts:default" failed. Use --force to continue.

Aborted due to warnings.

It tries to compile the node_modules.
I can bypass this problem by add:

    "exclude": [
        "node_modules"
    ]

to the tsconfig.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalRelates to another program, environment, or user action which we cannot control.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions