TypeScript: tsc doesn't output proper file case on Windows 10
TypeScript Version: 2.2.2
Code
irrelevant
Expected behavior:
On Windows 10, compiling Foo.ts
writes a file named Foo.js
to output folder.
Actual behavior:
If foo.js
(lowercase) already exists in output folder, the new file contents of Foo.ts
are written to foo.js
, but the file name’s case doesn’t change.
This issue just bit me in the real world on the EditorConfig vscode extension.
Workaround
Deleting foo.js
and running tsc
again solves the problem; though, this is not ideal.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 22 (15 by maintainers)
It seems like overkill to slow down every single build for the sake of not having to run
npm run clean
or whatever, once, when you change file casing in the extremely rare case where it actually matters.At the end of the day I only see two output : will I be able to use TypeScript without pain or not ? The answer is yes only on a non-Microsoft system. For a software developed by Microsoft. Do you get it ?
Also, people want you to handle this issue. Just handle it. Why wouldn’t you ? Windows is not gonna become case sensitive tomorrow, and we will
never
run a clean before each compilation. So you are the only one who can fix this.
I’m sending this to twitter, because you really behave like kids. You should be ashamed of yourself.
You don’t have to rename the file, just always do this:
Doing an unlink should be fast, and then the output case will be what is expected.
The compiler does not do any thing special here. this is the node fs apis on windows