Skip to content

2.0 @types declarations compiled despite ignore listing in tsconfig #11257

Closed

Description

@georgeedwards

TypeScript Version: 2.0.3

Code
Full project here.

tsconfig.json:

{
    "compilerOptions": {
        "target": "es6",
        "module": "system",
        "moduleResolution": "node",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false
    },
    "exclude": [
        "../node_modules"
    ]
}

Expected behavior:

For the project to compile, and as the tsconfig specifies, the node_modules directory to be ignored, hence no errors from that directory.

Actual behavior:

Lots of errors from node_modules/@types directory, e.g. :

[0] node_modules/@types/core-js/index.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'.

[0] node_modules/@types/core-js/index.d.ts(85,5): error TS2687: All declarations of 'name' must have identical modifiers.

[0] node_modules/@types/core-js/index.d.ts(145,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.unscopables]' must be of type '{ copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: ...', but here has type 'any'.

[0] node_modules/@types/core-js/index.d.ts(262,5): error TS2687: All declarations of 'flags' must have identical modifiers.

[0] node_modules/@types/core-js/index.d.ts(276,5): error TS2687: All declarations of 'EPSILON' must have identical modifiers.

[0] node_modules/@types/core-js/index.d.ts(311,5): error TS2687: All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.

Activity

  1. mhegazy commented on Sep 29, 2016

    @mhegazy
    Contributor

    Types (@types) are automatically included in the compilation. to exclude them, add "types": [] to your tsconfig.json

  2. georgeedwards commented on Sep 30, 2016

    @georgeedwards
    Author

    Mohamed Hegazy (@mhegazy) Even with this as my tsconfig:

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

    I still get errors, e.g.

    [1] node_modules/@types/core-js/index.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'.

    [1] node_modules/@types/core-js/index.d.ts(85,5): error TS2687: All declarations of 'name' must have identical modifiers.
    [1] node_modules/@types/core-js/index.d.ts(145,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.unscopables]' must be of type '{ copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: ...', but here has type 'any'.

    [1] node_modules/@types/core-js/index.d.ts(262,5): error TS2687: All declarations of 'flags' must have identical modifiers.

  3. lucipacurar commented on Sep 30, 2016

    @lucipacurar
    {
        "compilerOptions": {
            "target": "es6",
            "module": "commonjs",
            "moduleResolution": "node",
            "sourceMap": true,
            "emitDecoratorMetadata": true,
            "experimentalDecorators": true,
            "removeComments": false,
            "noImplicitAny": false,
            "types": []
        },
        "exclude": [
            "../node_modules"
        ]
    }
    

    I believe types should be inside compilerOptions

  4. locked and limited conversation to collaborators on Jun 19, 2018
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

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions