Skip to content

TypeScript complains about overwriting .d.ts files #35541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sguillia opened this issue Dec 6, 2019 · 3 comments
Closed

TypeScript complains about overwriting .d.ts files #35541

sguillia opened this issue Dec 6, 2019 · 3 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@sguillia
Copy link

sguillia commented Dec 6, 2019

TypeScript Version: Version 3.8.0-dev.20191206

Search Terms: overwrite .d.ts declaration

Steps to reproduce

The repo is a minimal working example and contains practically no code.

git clone https://github.com/sguillia/ts-bug-repro
cd ts-bug-repro
tsc -p . # Ignore error about missing .d.ts
tsc -p .

Expected behavior:

Compiles without error, by ignoring the dist folder as specified in the tsconfig.json.

Actual behavior:

The second tsc run spits out an error.

error TS5055: Cannot write file '/home/user/ts-bug-repro/dist/main.d.ts' because it would overwrite input file.

Found 1 error.

Related Issues:

Not a valid duplicate because it is old, misses version information and misses easy-to-reproduce steps
#16749

Look for error TS5055. The FAQ mentions this error but takes the assumption that we have allowJs which is untrue in my case.
https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs

@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label Dec 9, 2019
@RyanCavanaugh
Copy link
Member

I'm not sure what to say; the error message is accurate and you've configured your project in a way to produce the problem described by the error message. TypeScript will not proceed with a compilation where an output overwrites an input; you can either fix this by having inputs in a different location or outputs in a different location, it's up to you.

@sguillia
Copy link
Author

Dear @RyanCavanaugh ,

I would like all my inputs to be in src.
I would like all my outputs to be in dist.

This means that I would like typescript to consider the .d.ts files as output files since they are in dist.

I did not manage to do this.
I am confused as I tried to set rootDir, outDir, include and exclude accordlingly here but I still have the error.

How can I get Typescript to not consider the .d.ts as input files?

Many thanks

@typescript-bot
Copy link
Collaborator

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

3 participants