Skip to content

In tsc cli can't override declaration to false when tsconfig.json contains declarationDir option? #21443

Description

@zheeeng

TypeScript Version: 2.6.2 xxxxx

Search Terms:

"Option 'declarationDir' cannot be specified without specifying option 'declaration'"

Code

Assuming have tsconfig.json like this:

{
  "compilerOptions": {
    "module": "esnext",
    "target": "es6",
    "lib": ["es6", "dom"],
    "moduleResolution": "node",
    "declarationDir": "dist/types",
    "declaration": true,
  }
}

Expected behavior:
In terminal:

tsc --declaration false

or

tsc --declaration false ----declarationDir ''

wroks.

Actual behavior:

In terminal:

tsc --declaration false

reports: "error TS5052: Option 'declarationDir' cannot be specified without specifying option 'declaration'."

tsc --declaration false ----declarationDir ''

reports: "error TS6044: Compiler option 'declarationDir' expects an argument."

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeclinedThe issue was declined as something which matches the TypeScript vision

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions