Skip to content

Impossible to exclude original declaration file from module #21189

Description

TypeScript Version: 2.6.2
It is impossible to exclude or override d.ts files that are located in root of npm module.

For instance I have dependency on module named mymodule.
It contains declaration file in ./node_modules/mymodule/index.d.ts which is poorly made.
I have custom written declaration for it in ./@types/mymodule/index.d.ts
There're defined typeRoots in compilerOptions in ./tsconfig.json

{
    "compilerOptions: {
        "typeRoots": [
            "node_modules/@types",
            "@types"
        ]
    }
}

Than I added next rows (options above remained):

{
    "compilerOptions: {
        "typeRoots": [
            "!node_modules/mymodule",
            "!node_modules"
        ]
    },
    "exclude": {
        "node_modules/mymodule/index.d.ts"
    }
}

Expected behavior:
mymodule/index.d.ts getting ignored by compiler

Actual behavior:
mymodule/index.d.ts overrides my custom definitions

Activity

  1. ghost added
    QuestionAn issue which isn't directly actionable in code
    on Jan 16, 2018
  2. metsawyr commented on Jan 17, 2018

    @metsawyr
    Author

    Andy (Andrewkraft) (@Andy-MS), works just fine. Thank you.

  3. locked and limited conversation to collaborators on Jul 3, 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