microsoft / microsoft/TypeScript
error TS5053: Option 'declarationDir' cannot be specified with option 'outFile'.
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Attempting to change the declaration file output directory, I get the following error:
error TS5053: Option 'declarationDir' cannot be specified with option 'outFile'.
tsconfig.json looks like this:
{
"$schema": "http://json.schemastore.org/tsconfig",
"compilerOptions": {
"module": "amd",
"target": "es6",
"outFile": "../assets/js/main.js",
"sourceMap": true,
"declaration": true,
"declarationDir": "../"
}
}
I want my .d.ts file emitted somewhere else, since that's not a public asset.
Why is this not permitted?
I'm forced to create two (near-identical) tsconfig files and run the compiler twice to get the declaration file and output file. What for?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the TS5053 diagnostic with the shown tsconfig.json and the compiler options outFile, declaration, and declarationDir. Trace where this option combination is rejected and identify the relevant declaration-output tests or entry points. Done means declarations can be emitted to a separate directory while the bundled JavaScript output remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100