Skip to content

Commit 248d478

Browse files
authored
Remove defaultValueDescription: "n/a" from options (microsoft#46280)
* Remove defaultValueDescription: "n/a" from options * CommandLineOption type <-> defaultValueDescription * Require defaultValueDescription of number/boolean options
1 parent 53fa2a6 commit 248d478

File tree

4 files changed

+80
-40
lines changed

4 files changed

+80
-40
lines changed

src/compiler/commandLineParser.ts

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace ts {
22
/* @internal */
3-
export const compileOnSaveCommandLineOption: CommandLineOption = { name: "compileOnSave", type: "boolean" };
3+
export const compileOnSaveCommandLineOption: CommandLineOption = { name: "compileOnSave", type: "boolean", defaultValueDescription: "false" };
44

55
const jsxOptionMap = new Map(getEntries({
66
"preserve": JsxEmit.Preserve,
@@ -140,6 +140,7 @@ namespace ts {
140140
type: "boolean",
141141
category: Diagnostics.Watch_and_Build_Modes,
142142
description: Diagnostics.Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_support_recursive_watching_natively,
143+
defaultValueDescription: "false",
143144
},
144145
{
145146
name: "excludeDirectories",
@@ -176,11 +177,13 @@ namespace ts {
176177
showInSimplifiedHelpView: true,
177178
category: Diagnostics.Command_line_Options,
178179
description: Diagnostics.Print_this_message,
180+
defaultValueDescription: "false",
179181
},
180182
{
181183
name: "help",
182184
shortName: "?",
183-
type: "boolean"
185+
type: "boolean",
186+
defaultValueDescription: "false",
184187
},
185188
{
186189
name: "watch",
@@ -190,14 +193,15 @@ namespace ts {
190193
isCommandLineOnly: true,
191194
category: Diagnostics.Command_line_Options,
192195
description: Diagnostics.Watch_input_files,
196+
defaultValueDescription: "false",
193197
},
194198
{
195199
name: "preserveWatchOutput",
196200
type: "boolean",
197201
showInSimplifiedHelpView: false,
198202
category: Diagnostics.Output_Formatting,
199203
description: Diagnostics.Disable_wiping_the_console_in_watch_mode,
200-
defaultValueDescription: "n/a"
204+
defaultValueDescription: "false",
201205
},
202206
{
203207
name: "listFiles",
@@ -210,7 +214,8 @@ namespace ts {
210214
name: "explainFiles",
211215
type: "boolean",
212216
category: Diagnostics.Compiler_Diagnostics,
213-
description: Diagnostics.Print_files_read_during_the_compilation_including_why_it_was_included
217+
description: Diagnostics.Print_files_read_during_the_compilation_including_why_it_was_included,
218+
defaultValueDescription: "false",
214219
},
215220
{
216221
name: "listEmittedFiles",
@@ -281,7 +286,8 @@ namespace ts {
281286
affectsSemanticDiagnostics: true,
282287
affectsEmit: true,
283288
category: Diagnostics.Watch_and_Build_Modes,
284-
description: Diagnostics.Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it
289+
description: Diagnostics.Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it,
290+
defaultValueDescription: "false",
285291
},
286292
{
287293
name: "locale",
@@ -328,6 +334,7 @@ namespace ts {
328334
showInSimplifiedHelpView: true,
329335
category: Diagnostics.Command_line_Options,
330336
description: Diagnostics.Show_all_compiler_options,
337+
defaultValueDescription: "false",
331338
},
332339
{
333340
name: "version",
@@ -336,13 +343,15 @@ namespace ts {
336343
showInSimplifiedHelpView: true,
337344
category: Diagnostics.Command_line_Options,
338345
description: Diagnostics.Print_the_compiler_s_version,
346+
defaultValueDescription: "false",
339347
},
340348
{
341349
name: "init",
342350
type: "boolean",
343351
showInSimplifiedHelpView: true,
344352
category: Diagnostics.Command_line_Options,
345353
description: Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file,
354+
defaultValueDescription: "false",
346355
},
347356
{
348357
name: "project",
@@ -360,15 +369,17 @@ namespace ts {
360369
shortName: "b",
361370
showInSimplifiedHelpView: true,
362371
category: Diagnostics.Command_line_Options,
363-
description: Diagnostics.Build_one_or_more_projects_and_their_dependencies_if_out_of_date
372+
description: Diagnostics.Build_one_or_more_projects_and_their_dependencies_if_out_of_date,
373+
defaultValueDescription: "false",
364374
},
365375
{
366376
name: "showConfig",
367377
type: "boolean",
368378
showInSimplifiedHelpView: true,
369379
category: Diagnostics.Command_line_Options,
370380
isCommandLineOnly: true,
371-
description: Diagnostics.Print_the_final_configuration_instead_of_building
381+
description: Diagnostics.Print_the_final_configuration_instead_of_building,
382+
defaultValueDescription: "false",
372383
},
373384
{
374385
name: "listFilesOnly",
@@ -377,7 +388,8 @@ namespace ts {
377388
affectsSemanticDiagnostics: true,
378389
affectsEmit: true,
379390
isCommandLineOnly: true,
380-
description: Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing
391+
description: Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
392+
defaultValueDescription: "false",
381393
},
382394

383395
// Basic
@@ -499,7 +511,6 @@ namespace ts {
499511
category: Diagnostics.Emit,
500512
description: Diagnostics.Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designates_a_file_that_bundles_all_d_ts_output,
501513
transpileOptionValue: undefined,
502-
defaultValueDescription: "n/a"
503514
},
504515
{
505516
name: "outDir",
@@ -510,7 +521,6 @@ namespace ts {
510521
showInSimplifiedHelpView: true,
511522
category: Diagnostics.Emit,
512523
description: Diagnostics.Specify_an_output_folder_for_all_emitted_files,
513-
defaultValueDescription: "n/a"
514524
},
515525
{
516526
name: "rootDir",
@@ -668,6 +678,7 @@ namespace ts {
668678
strictFlag: true,
669679
category: Diagnostics.Type_Checking,
670680
description: Diagnostics.Type_catch_clause_variables_as_unknown_instead_of_any,
681+
defaultValueDescription: "false",
671682
},
672683
{
673684
name: "alwaysStrict",
@@ -701,7 +712,8 @@ namespace ts {
701712
type: "boolean",
702713
affectsSemanticDiagnostics: true,
703714
category: Diagnostics.Type_Checking,
704-
description: Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined
715+
description: Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
716+
defaultValueDescription: "false",
705717
},
706718
{
707719
name: "noImplicitReturns",
@@ -717,21 +729,24 @@ namespace ts {
717729
affectsBindDiagnostics: true,
718730
affectsSemanticDiagnostics: true,
719731
category: Diagnostics.Type_Checking,
720-
description: Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements
732+
description: Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
733+
defaultValueDescription: "false",
721734
},
722735
{
723736
name: "noUncheckedIndexedAccess",
724737
type: "boolean",
725738
affectsSemanticDiagnostics: true,
726739
category: Diagnostics.Type_Checking,
727-
description: Diagnostics.Include_undefined_in_index_signature_results
740+
description: Diagnostics.Include_undefined_in_index_signature_results,
741+
defaultValueDescription: "false",
728742
},
729743
{
730744
name: "noImplicitOverride",
731745
type: "boolean",
732746
affectsSemanticDiagnostics: true,
733747
category: Diagnostics.Type_Checking,
734-
description: Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier
748+
description: Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
749+
defaultValueDescription: "false",
735750
},
736751
{
737752
name: "noPropertyAccessFromIndexSignature",
@@ -841,7 +856,7 @@ namespace ts {
841856
type: "boolean",
842857
category: Diagnostics.Interop_Constraints,
843858
description: Diagnostics.Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node,
844-
defaultValueDescription: "n/a"
859+
defaultValueDescription: "false",
845860
},
846861
{
847862
name: "allowUmdGlobalAccess",
@@ -892,15 +907,17 @@ namespace ts {
892907
type: "boolean",
893908
affectsSemanticDiagnostics: true,
894909
category: Diagnostics.Language_and_Environment,
895-
description: Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators
910+
description: Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
911+
defaultValueDescription: "false",
896912
},
897913
{
898914
name: "emitDecoratorMetadata",
899915
type: "boolean",
900916
affectsSemanticDiagnostics: true,
901917
affectsEmit: true,
902918
category: Diagnostics.Language_and_Environment,
903-
description: Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files
919+
description: Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
920+
defaultValueDescription: "false",
904921
},
905922

906923
// Advanced
@@ -945,7 +962,6 @@ namespace ts {
945962
category: Diagnostics.Backwards_Compatibility,
946963
paramType: Diagnostics.FILE,
947964
transpileOptionValue: undefined,
948-
defaultValueDescription: "n/a",
949965
description: Diagnostics.Deprecated_setting_Use_outFile_instead,
950966
},
951967
{
@@ -1026,6 +1042,7 @@ namespace ts {
10261042
affectsEmit: true,
10271043
category: Diagnostics.Emit,
10281044
description: Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
1045+
defaultValueDescription: "false",
10291046
},
10301047
{
10311048
name: "disableSizeLimit",
@@ -1040,21 +1057,24 @@ namespace ts {
10401057
type: "boolean",
10411058
isTSConfigOnly: true,
10421059
category: Diagnostics.Projects,
1043-
description: Diagnostics.Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects
1060+
description: Diagnostics.Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects,
1061+
defaultValueDescription: "false",
10441062
},
10451063
{
10461064
name: "disableSolutionSearching",
10471065
type: "boolean",
10481066
isTSConfigOnly: true,
10491067
category: Diagnostics.Projects,
1050-
description: Diagnostics.Opt_a_project_out_of_multi_project_reference_checking_when_editing
1068+
description: Diagnostics.Opt_a_project_out_of_multi_project_reference_checking_when_editing,
1069+
defaultValueDescription: "false",
10511070
},
10521071
{
10531072
name: "disableReferencedProjectLoad",
10541073
type: "boolean",
10551074
isTSConfigOnly: true,
10561075
category: Diagnostics.Projects,
1057-
description: Diagnostics.Reduce_the_number_of_projects_loaded_automatically_by_TypeScript
1076+
description: Diagnostics.Reduce_the_number_of_projects_loaded_automatically_by_TypeScript,
1077+
defaultValueDescription: "false",
10581078
},
10591079
{
10601080
name: "noImplicitUseStrict",
@@ -1087,7 +1107,7 @@ namespace ts {
10871107
affectsEmit: true,
10881108
category: Diagnostics.Emit,
10891109
description: Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
1090-
defaultValueDescription: "n/a"
1110+
defaultValueDescription: "false",
10911111
},
10921112
{
10931113
name: "declarationDir",
@@ -1098,7 +1118,6 @@ namespace ts {
10981118
category: Diagnostics.Emit,
10991119
transpileOptionValue: undefined,
11001120
description: Diagnostics.Specify_the_output_directory_for_generated_declaration_files,
1101-
defaultValueDescription: "n/a"
11021121
},
11031122
{
11041123
name: "skipLibCheck",
@@ -1180,6 +1199,7 @@ namespace ts {
11801199
affectsEmit: true,
11811200
category: Diagnostics.Emit,
11821201
description: Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
1202+
defaultValueDescription: "false",
11831203
},
11841204

11851205
{
@@ -1242,27 +1262,31 @@ namespace ts {
12421262
shortName: "v",
12431263
category: Diagnostics.Command_line_Options,
12441264
description: Diagnostics.Enable_verbose_logging,
1245-
type: "boolean"
1265+
type: "boolean",
1266+
defaultValueDescription: "false",
12461267
},
12471268
{
12481269
name: "dry",
12491270
shortName: "d",
12501271
category: Diagnostics.Command_line_Options,
12511272
description: Diagnostics.Show_what_would_be_built_or_deleted_if_specified_with_clean,
1252-
type: "boolean"
1273+
type: "boolean",
1274+
defaultValueDescription: "false",
12531275
},
12541276
{
12551277
name: "force",
12561278
shortName: "f",
12571279
category: Diagnostics.Command_line_Options,
12581280
description: Diagnostics.Build_all_projects_including_those_that_appear_to_be_up_to_date,
1259-
type: "boolean"
1281+
type: "boolean",
1282+
defaultValueDescription: "false",
12601283
},
12611284
{
12621285
name: "clean",
12631286
category: Diagnostics.Command_line_Options,
12641287
description: Diagnostics.Delete_the_outputs_of_all_projects,
1265-
type: "boolean"
1288+
type: "boolean",
1289+
defaultValueDescription: "false",
12661290
}
12671291
];
12681292

@@ -1280,10 +1304,12 @@ namespace ts {
12801304
*/
12811305
name: "enableAutoDiscovery",
12821306
type: "boolean",
1307+
defaultValueDescription: "false",
12831308
},
12841309
{
12851310
name: "enable",
12861311
type: "boolean",
1312+
defaultValueDescription: "false",
12871313
},
12881314
{
12891315
name: "include",
@@ -1304,6 +1330,7 @@ namespace ts {
13041330
{
13051331
name: "disableFilenameBasedTypeAcquisition",
13061332
type: "boolean",
1333+
defaultValueDescription: "false",
13071334
},
13081335
];
13091336

@@ -2285,7 +2312,7 @@ namespace ts {
22852312
return getCustomTypeMapOfCommandLineOption(optionDefinition.element);
22862313
}
22872314
else {
2288-
return (optionDefinition as CommandLineOptionOfCustomType).type;
2315+
return optionDefinition.type;
22892316
}
22902317
}
22912318

src/compiler/types.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6340,8 +6340,20 @@ namespace ts {
63406340
}
63416341

63426342
/* @internal */
6343-
export interface CommandLineOptionOfPrimitiveType extends CommandLineOptionBase {
6344-
type: "string" | "number" | "boolean";
6343+
export interface CommandLineOptionOfStringType extends CommandLineOptionBase {
6344+
type: "string";
6345+
}
6346+
6347+
/* @internal */
6348+
export interface CommandLineOptionOfNumberType extends CommandLineOptionBase {
6349+
type: "number";
6350+
defaultValueDescription: `${number | undefined}` | DiagnosticMessage;
6351+
}
6352+
6353+
/* @internal */
6354+
export interface CommandLineOptionOfBooleanType extends CommandLineOptionBase {
6355+
type: "boolean";
6356+
defaultValueDescription: `${boolean | undefined}` | DiagnosticMessage;
63456357
}
63466358

63476359
/* @internal */
@@ -6373,11 +6385,11 @@ namespace ts {
63736385
/* @internal */
63746386
export interface CommandLineOptionOfListType extends CommandLineOptionBase {
63756387
type: "list";
6376-
element: CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType | TsConfigOnlyOption;
6388+
element: CommandLineOptionOfCustomType | CommandLineOptionOfStringType | CommandLineOptionOfNumberType | CommandLineOptionOfBooleanType | TsConfigOnlyOption;
63776389
}
63786390

63796391
/* @internal */
6380-
export type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType | TsConfigOnlyOption | CommandLineOptionOfListType;
6392+
export type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfStringType | CommandLineOptionOfNumberType | CommandLineOptionOfBooleanType | TsConfigOnlyOption | CommandLineOptionOfListType;
63816393

63826394
/* @internal */
63836395
export const enum CharacterCodes {

0 commit comments

Comments
 (0)