Skip to content
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

tsc --init issues #20961

Closed
aaronbeall opened this issue Jan 2, 2018 · 7 comments
Closed

tsc --init issues #20961

aaronbeall opened this issue Jan 2, 2018 · 7 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this

Comments

@aaronbeall
Copy link

TypeScript Version: 2.6.2

Code

tsc --init

Expected behavior:

Includes all compiler options and valid values.

Actual behavior:

  • Missing forceConsistentCasingInFileNames, skipLibCheck, pretty, allowUnusedLabels, allowUnreachableCode, suppressImplicitAnyIndexErrors options
  • Comment for lib is /* Specify library files to be included in the compilation: */ (nothing after the colon)
@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels Jan 2, 2018
@aaronbeall
Copy link
Author

Missing forceConsistentCasingInFileNames, skipLibCheck, pretty, allowUnusedLabels, allowUnreachableCode, suppressImplicitAnyIndexErrors options

Hm, so those above are the options I'm personally familiar with, but if I compare the init generated tsconfig with the json schema there are actually 29 compiler options not included:

["charset", "declarationDir", "diagnostics", "emitBOM", "reactNamespace", 
"listFiles", "newLine", "noEmitHelpers", "noEmitOnError", "noLib", "noResolve", 
"noStrictGenericChecks", "skipDefaultLibCheck", "skipLibCheck", "preserveConstEnums",
"pretty", "suppressExcessPropertyErrors", "suppressImplicitAnyIndexErrors", 
"stripInternal", "watch", "allowUnusedLabels", "allowUnreachableCode", 
"forceConsistentCasingInFileNames", "plugins", "traceResolution",
"noImplicitUseStrict", "listEmittedFiles", "maxNodeModuleJsDepth", "jsxFactory"]

I guess there's an argument that some of those options wouldn't be very helpful to include in the generated config at all (like encoding options) but there's certainly some that I would expect to be there.

@RyanCavanaugh
Copy link
Member

The list of options provided by tsc --init is intended to be somewhat curated; we don't want people randomly turning on e.g. suppressImplicitAnyIndexErrors unless they have really thought about it.

@mhegazy mhegazy added this to the Community milestone Jan 4, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Jan 4, 2018

So the list as it shows now is limited to what we have deemed worthy of inclusion. i personally do not see forceConsistentCasingInFileNames, skipLibCheck, allowUnusedLabels, allowUnreachableCode, suppressImplicitAnyIndexErrors as worthy. pretty might be worth it though..

so what is this bug tracking? including them all?(do not think this is a good idea) or just specific ones? (if so which)?

@aaronbeall
Copy link
Author

so what is this bug tracking?

There's also the comment for lib that currently says /* Specify library files to be included in the compilation: */ -- I would think something should come after the colon, even if it isn't an exhaustive list?

Also, maybe it's just me but I was surprised there are so many options not listed in the generated config, I kind of thought it was all the options, though I can see why it isn't and shouldn't be -- would it be excessive to include a comment in there that there are additional compiler options?

@mhegazy
Copy link
Contributor

mhegazy commented Jan 4, 2018

would it be excessive to include a comment in there that there are additional compiler options?

well.. part of it is that some of these options are not really used. we can not remove them for back compat purposes.. for instance allowUnreachableCode. our data shows this setting used in less than 0.01% of the total sessions.. so the idea is why let everyone figure out their way through these options, if they are likely not going to use them.

to see all options supported by the compiler, try tsc --help --all

@mhegazy
Copy link
Contributor

mhegazy commented Jan 4, 2018

There's also the comment for lib that currently says /* Specify library files to be included in the compilation: */ -- I would think something should come after the colon, even if it isn't an exhaustive list?

feel free to send a PR to remove the colon from the message

@nieltg
Copy link
Contributor

nieltg commented Jan 13, 2018

feel free to send a PR to remove the colon from the message

@mhegazy
Hi! I'm going to try fixing that. Pull request #21174.

@mhegazy mhegazy modified the milestones: Community, TypeScript 2.7.1 Jan 17, 2018
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Jan 17, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

4 participants