-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Add showConfig tsc flag for debugging configs #27353
Add showConfig tsc flag for debugging configs #27353
Conversation
164000b
to
4544aa6
Compare
Ping @sheetalkamat - would be nice to get this reviewed, too; |
@@ -132,6 +132,11 @@ namespace ts { | |||
const commandLineOptions = commandLine.options; | |||
if (configFileName) { | |||
const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, sys, reportDiagnostic)!; // TODO: GH#18217 | |||
if (commandLineOptions.showConfig) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Should we intentionally be ignoring this in --b mode? Should it error when invoked without tsconfig file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it could be fine without a config file - serves as a fine way to convert a response file or other command line args to a tsconfig.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afaik it is ignored in -b
mode; iirc that bails out way early on in the command line parser, since it has its own subset of args.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could have this even in --b just like how we have eg (list files, list emitted files) could be good information I think. Especially in verbose mode?
@sheetalkamat I've updated this to support showing a config when there's no config file, but didn't enable it in |
I tried to use this today but ran into a couple of issues. The first one's simple The second is that the PR doesn't appear to implement the feature as requested in #15213. I could be using it incorrectly, but my output only shows |
Hmm, as is it contains everything less some things that are implied defaults/equivalent to their defaults. I suppose in that respect it makes more of a minimal config. But not doing that would be... Unfortunate. Because then we'd have to list every option. And there's a lot of options. |
It's true, but that's exactly what I want to see. I'm not sure how else to easily discover what those defaults actually are. I could be off base here, but it looks to me like the documentation for tsconfig.json shows the implied default, but not the resolved one. I might want to extend something that has implied default values when unset, like |
tsc --init prints with a ton of commented out defaults and help text. |
Fixes #15213
I happened to be in the area today, saw the issue while looking through something else, and though it'd actually be a somewhat useful utility to have.