Skip to content

Glob support in tsconfig.json exclude array #10202

Closed

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.

Activity

  1. DaSchTour commented on Aug 8, 2016

    @DaSchTour

    Try including only typings/index.d.ts and not all typings separately + typings/index.d.ts which already references all of them

  2. added this to the milestone on Aug 8, 2016
  3. modified the milestones: TypeScript 2.1, on Aug 17, 2016
  4. mhegazy commented on Sep 21, 2016

    @mhegazy
    Contributor

    Daniel Schuba (@DaSchTour) how are you invoking the compiler?

  5. DaSchTour commented on Sep 21, 2016

    @DaSchTour

    Mohamed Hegazy (@mhegazy) While developing I use IntelliJ by using tsc from node_modules. CI uses gulp or grunt.

  6. modified the milestones: TypeScript 2.1, , on Oct 27, 2016
  7. added
    Needs InvestigationThis issue needs a team member to investigate its status.
    and removed
    Needs More InfoThe issue still hasn't been fully clarified
    on Mar 6, 2019
  8. added
    ExternalRelates to another program, environment, or user action which we cannot control.
    and removed
    Needs InvestigationThis issue needs a team member to investigate its status.
    on Aug 22, 2019
  9. RyanCavanaugh commented on Aug 22, 2019

    @RyanCavanaugh
    Member

    The default excludes already excludes node_modules; seems something else is going on here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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