-
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
Describe defaults of more options #46498
Conversation
b665e67
to
3041c01
Compare
} | ||
|
||
/* @internal */ | ||
export interface CommandLineOptionOfCustomType extends CommandLineOptionBase { | ||
type: ESMap<string, number | string>; // an object literal mapping named values to actual values | ||
defaultValueDescription: number | string | undefined | DiagnosticMessage; |
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've now added a commit to accommodate enum members vs. strings in defaultValueDescription
, e.g.
TypeScript/src/compiler/commandLineParser.ts
Line 596 in d31ac53
defaultValueDescription: ImportsNotUsedAsValues.Remove, |
} | ||
|
||
/* @internal */ | ||
export interface CommandLineOptionOfBooleanType extends CommandLineOptionBase { | ||
type: "boolean"; | ||
defaultValueDescription: `${boolean | undefined}` | DiagnosticMessage; | ||
defaultValueDescription: boolean | undefined | DiagnosticMessage; |
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.
and likewise number/boolean literals vs. strings.
.filter(([, value]) => value === defaultValue) | ||
.map(([name]) => name) | ||
.join("/") | ||
: String(defaultValue); |
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 updated --help to stringify enum members and number/boolean literals, e.g. ImportsNotUsedAsValues.Remove
-> remove
.
}); | ||
return getEntries(inverted) | ||
.map(([, synonyms]) => synonyms.join("/")) | ||
.join(", "); |
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.
Because this prints all of an enum member's synonyms, I correspondingly updated the way --help formats possible values. Not that any current default has synonyms.
@@ -68,16 +68,18 @@ default: true | |||
|
|||
--target, -t | |||
Set the JavaScript language version for emitted JavaScript and include compatible library declarations. | |||
one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext | |||
default: ES3 | |||
one of: es3, es5, es6/es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext |
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.e. es6, es2015
-> es6/es2015
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
This PR seems to do a lot more than add default value descriptions. Can you add more explanation to cover the rest of the changes? |
👍 Can do:
|
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.
Thanks for the writeup, this looks good to me and I think it improves the CLI UX 👍🏻
* Describe defaults of more options * Use enum members/values vs. strings * Update Baselines and/or Applied Lint Fixes Co-authored-by: TypeScript Bot <[email protected]>
Adds
defaultValueDescription
to:/cc @orta