-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
TypeScript new line default on Windows breaks on *nix #29928
Comments
This options already exists (from compiler options):
|
@j-oliveras please read the last paragraph.
|
There are certainly other people which have workflows which depend on CR+LF. Configuration is hard; making it harder on purpose by removing options or breaking backward compatibility is not a priority for us. |
@RyanCavanaugh I respect your decision. I disagree wholeheartedly. Ultimately, I think this leaves TypeScript in a worse place because it becomes just another thing you list of exceptions to consider, albeit only if you use Windows as a web development platform. The use case that you have effectively broken with this design decision is writing TypeScript on Windows and then publishing to NPM. It won't work without the I don't think it should work like that. But what do I know, I'm just a guy with an opinion. I would like to end this by just saying that I really enjoy TypeScript. And I appreciate all the good work that has went into TypeScript. It's made me look at typing stuff in a new way. And I'm not trying to be salty, I genuinely believe that what I try to argue here would make TypeScript better. |
@RyanCavanaugh you give me one example and I will believe it. 😄 |
@leidegre In case it helps you, the new default in TS 5.5 is I just found this issue after reading the release notes of 5.5. I noticed this |
I would like to purpose that this is a bug because it causes needless trouble in cross platform environments and I cannot find a single reason for why we insist on having
CR
LF
on Windows any more.Expected behavior:
Linux/OS X users don't run into subtle issues because of carriage return in bin scripts.
Actual behavior:
When a TypeScript project is built on Windows and then published to NPM, the default new line options is
CR
LF
. If yourpackage.json
has abin
script with a shebang like this#!/usr/bin/env node
TypeScript will rewrite this with aCR
LF
line ending which breaks on at least Mac OS X with the following errorenv: node\r: No such file or directory error Command failed with exit code 127
(haven't tested this elsewhere).I'm raising this as a bug because it has non obvious implications for people developing software with TypeScript if they publish their code to NPM. And I don't think that there is a valid reason for why
CR
LF
should be used on Windows at all. It's an archaic historical artifact that should have been laid to rest a very long time ago.I'm going to be bold and suggest that the option
--newLine
should never have been added. That it should be deprecated and that the option should be ignored. And that TypeScript only emitLF
from now on.The text was updated successfully, but these errors were encountered: