From 399e0a0606de5c0901d110494db94f6b5c11995e Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Wed, 19 May 2021 23:42:12 +0800 Subject: [PATCH 01/21] refactor help CLI output. --- src/compiler/commandLineParser.ts | 204 +++++++++++----- src/compiler/diagnosticMessages.json | 62 +++++ src/compiler/sys.ts | 4 + src/compiler/types.ts | 3 +- src/executeCommandLine/executeCommandLine.ts | 235 ++++++++++++++++++- src/webServer/webServer.ts | 2 +- 6 files changed, 443 insertions(+), 67 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index ffd43b9d7d51e..b4810de13644e 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -195,12 +195,14 @@ namespace ts { showInSimplifiedHelpView: false, category: Diagnostics.Command_line_Options, description: Diagnostics.Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen, + defaultValueDescription: "n/a" }, { name: "listFiles", type: "boolean", category: Diagnostics.Advanced_Options, - description: Diagnostics.Print_names_of_files_part_of_the_compilation + description: Diagnostics.Print_names_of_files_part_of_the_compilation, + defaultValueDescription: "false" }, { name: "explainFiles", @@ -211,33 +213,38 @@ namespace ts { name: "listEmittedFiles", type: "boolean", category: Diagnostics.Advanced_Options, - description: Diagnostics.Print_names_of_generated_files_part_of_the_compilation + description: Diagnostics.Print_names_of_generated_files_part_of_the_compilation, + defaultValueDescription: "false" }, { name: "pretty", type: "boolean", showInSimplifiedHelpView: true, category: Diagnostics.Command_line_Options, - description: Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental + description: Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, + defaultValueDescription: "true" }, { name: "traceResolution", type: "boolean", category: Diagnostics.Advanced_Options, - description: Diagnostics.Enable_tracing_of_the_name_resolution_process + description: Diagnostics.Enable_tracing_of_the_name_resolution_process, + defaultValueDescription: "false" }, { name: "diagnostics", type: "boolean", category: Diagnostics.Advanced_Options, - description: Diagnostics.Show_diagnostic_information + description: Diagnostics.Show_diagnostic_information, + defaultValueDescription: "false" }, { name: "extendedDiagnostics", type: "boolean", category: Diagnostics.Advanced_Options, - description: Diagnostics.Show_verbose_diagnostic_information + description: Diagnostics.Show_verbose_diagnostic_information, + defaultValueDescription: "false" }, { name: "generateCpuProfile", @@ -245,7 +252,8 @@ namespace ts { isFilePath: true, paramType: Diagnostics.FILE_OR_DIRECTORY, category: Diagnostics.Advanced_Options, - description: Diagnostics.Generates_a_CPU_profile + description: Diagnostics.Generates_a_CPU_profile, + defaultValueDescription: "profile.cpuprofile" }, { name: "generateTrace", @@ -262,7 +270,8 @@ namespace ts { type: "boolean", category: Diagnostics.Basic_Options, description: Diagnostics.Enable_incremental_compilation, - transpileOptionValue: undefined + transpileOptionValue: undefined, + defaultValueDescription: Diagnostics.false_unless_composite_is_set }, { name: "assumeChangesOnlyAffectDirectDependencies", @@ -276,7 +285,8 @@ namespace ts { name: "locale", type: "string", category: Diagnostics.Advanced_Options, - description: Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us + description: Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us, + defaultValueDescription: Diagnostics.Platform_specific }, ]; @@ -304,6 +314,7 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_ES2018_ES2019_ES2020_ES2021_or_ESNEXT, + defaultValueDescription: "ES3" }; const commandOptionsWithoutBuild: CommandLineOption[] = [ @@ -407,13 +418,15 @@ namespace ts { affectsModuleResolution: true, showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, - description: Diagnostics.Allow_javascript_files_to_be_compiled + description: Diagnostics.Allow_javascript_files_to_be_compiled, + defaultValueDescription: "false" }, { name: "checkJs", type: "boolean", category: Diagnostics.Basic_Options, - description: Diagnostics.Report_errors_in_js_files + description: Diagnostics.Report_errors_in_js_files, + defaultValueDescription: "false" }, { name: "jsx", @@ -425,6 +438,7 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, description: Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_react_react_jsx_or_react_jsxdev, + defaultValueDescription: "undefined" }, { name: "declaration", @@ -434,7 +448,8 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, description: Diagnostics.Generates_corresponding_d_ts_file, - transpileOptionValue: undefined + transpileOptionValue: undefined, + defaultValueDescription: Diagnostics.false_unless_composite_is_set }, { name: "declarationMap", @@ -443,7 +458,8 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, description: Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file, - transpileOptionValue: undefined + transpileOptionValue: undefined, + defaultValueDescription: "false" }, { name: "emitDeclarationOnly", @@ -451,7 +467,8 @@ namespace ts { affectsEmit: true, category: Diagnostics.Advanced_Options, description: Diagnostics.Only_emit_d_ts_declaration_files, - transpileOptionValue: undefined + transpileOptionValue: undefined, + defaultValueDescription: "false" }, { name: "sourceMap", @@ -460,6 +477,7 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, description: Diagnostics.Generates_corresponding_map_file, + defaultValueDescription: "false" }, { name: "outFile", @@ -470,7 +488,8 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, description: Diagnostics.Concatenate_and_emit_output_to_single_file, - transpileOptionValue: undefined + transpileOptionValue: undefined, + defaultValueDescription: "n/a" }, { name: "outDir", @@ -481,6 +500,7 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, description: Diagnostics.Redirect_output_structure_to_the_directory, + defaultValueDescription: "n/a" }, { name: "rootDir", @@ -490,6 +510,7 @@ namespace ts { paramType: Diagnostics.LOCATION, category: Diagnostics.Basic_Options, description: Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, + defaultValueDescription: Diagnostics.Computed_from_the_list_of_input_files }, { name: "composite", @@ -498,7 +519,8 @@ namespace ts { isTSConfigOnly: true, category: Diagnostics.Basic_Options, description: Diagnostics.Enable_project_compilation, - transpileOptionValue: undefined + transpileOptionValue: undefined, + defaultValueDescription: "false" }, { name: "tsBuildInfoFile", @@ -508,7 +530,8 @@ namespace ts { paramType: Diagnostics.FILE, category: Diagnostics.Basic_Options, description: Diagnostics.Specify_file_to_store_incremental_compilation_information, - transpileOptionValue: undefined + transpileOptionValue: undefined, + defaultValueDescription: ".tsbuildinfo" }, { name: "removeComments", @@ -517,6 +540,7 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, description: Diagnostics.Do_not_emit_comments_to_output, + defaultValueDescription: "false" }, { name: "noEmit", @@ -524,14 +548,16 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, description: Diagnostics.Do_not_emit_outputs, - transpileOptionValue: undefined + transpileOptionValue: undefined, + defaultValueDescription: "false" }, { name: "importHelpers", type: "boolean", affectsEmit: true, category: Diagnostics.Basic_Options, - description: Diagnostics.Import_emit_helpers_from_tslib + description: Diagnostics.Import_emit_helpers_from_tslib, + defaultValueDescription: "fasle" }, { name: "importsNotUsedAsValues", @@ -550,14 +576,16 @@ namespace ts { type: "boolean", affectsEmit: true, category: Diagnostics.Basic_Options, - description: Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 + description: Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3, + defaultValueDescription: "fasle" }, { name: "isolatedModules", type: "boolean", category: Diagnostics.Basic_Options, description: Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule, - transpileOptionValue: true + transpileOptionValue: true, + defaultValueDescription: "false" }, // Strict Type Checks @@ -566,7 +594,8 @@ namespace ts { type: "boolean", showInSimplifiedHelpView: true, category: Diagnostics.Strict_Type_Checking_Options, - description: Diagnostics.Enable_all_strict_type_checking_options + description: Diagnostics.Enable_all_strict_type_checking_options, + defaultValueDescription: "false" }, { name: "noImplicitAny", @@ -575,7 +604,8 @@ namespace ts { strictFlag: true, showInSimplifiedHelpView: true, category: Diagnostics.Strict_Type_Checking_Options, - description: Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type + description: Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, + defaultValueDescription: Diagnostics.false_unless_strict_is_set }, { name: "strictNullChecks", @@ -584,7 +614,8 @@ namespace ts { strictFlag: true, showInSimplifiedHelpView: true, category: Diagnostics.Strict_Type_Checking_Options, - description: Diagnostics.Enable_strict_null_checks + description: Diagnostics.Enable_strict_null_checks, + defaultValueDescription: Diagnostics.false_unless_strict_is_set }, { name: "strictFunctionTypes", @@ -593,7 +624,8 @@ namespace ts { strictFlag: true, showInSimplifiedHelpView: true, category: Diagnostics.Strict_Type_Checking_Options, - description: Diagnostics.Enable_strict_checking_of_function_types + description: Diagnostics.Enable_strict_checking_of_function_types, + defaultValueDescription: Diagnostics.false_unless_strict_is_set }, { name: "strictBindCallApply", @@ -601,7 +633,8 @@ namespace ts { strictFlag: true, showInSimplifiedHelpView: true, category: Diagnostics.Strict_Type_Checking_Options, - description: Diagnostics.Enable_strict_bind_call_and_apply_methods_on_functions + description: Diagnostics.Enable_strict_bind_call_and_apply_methods_on_functions, + defaultValueDescription: Diagnostics.false_unless_strict_is_set }, { name: "strictPropertyInitialization", @@ -610,7 +643,8 @@ namespace ts { strictFlag: true, showInSimplifiedHelpView: true, category: Diagnostics.Strict_Type_Checking_Options, - description: Diagnostics.Enable_strict_checking_of_property_initialization_in_classes + description: Diagnostics.Enable_strict_checking_of_property_initialization_in_classes, + defaultValueDescription: Diagnostics.false_unless_strict_is_set }, { name: "noImplicitThis", @@ -620,6 +654,7 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Strict_Type_Checking_Options, description: Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, + defaultValueDescription: Diagnostics.false_unless_strict_is_set }, { name: "alwaysStrict", @@ -628,7 +663,8 @@ namespace ts { strictFlag: true, showInSimplifiedHelpView: true, category: Diagnostics.Strict_Type_Checking_Options, - description: Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file + description: Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file, + defaultValueDescription: Diagnostics.false_unless_strict_is_set }, // Additional Checks @@ -639,6 +675,7 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Additional_Checks, description: Diagnostics.Report_errors_on_unused_locals, + defaultValueDescription: "false" }, { name: "noUnusedParameters", @@ -647,6 +684,7 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Additional_Checks, description: Diagnostics.Report_errors_on_unused_parameters, + defaultValueDescription: "false" }, { name: "noImplicitReturns", @@ -654,7 +692,8 @@ namespace ts { affectsSemanticDiagnostics: true, showInSimplifiedHelpView: true, category: Diagnostics.Additional_Checks, - description: Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + description: Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value, + defaultValueDescription: "false" }, { name: "noFallthroughCasesInSwitch", @@ -663,7 +702,8 @@ namespace ts { affectsSemanticDiagnostics: true, showInSimplifiedHelpView: true, category: Diagnostics.Additional_Checks, - description: Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + description: Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement, + defaultValueDescription: "false" }, { name: "noUncheckedIndexedAccess", @@ -686,7 +726,8 @@ namespace ts { type: "boolean", showInSimplifiedHelpView: false, category: Diagnostics.Additional_Checks, - description: Diagnostics.Require_undeclared_properties_from_index_signatures_to_use_element_accesses + description: Diagnostics.Require_undeclared_properties_from_index_signatures_to_use_element_accesses, + defaultValueDescription: "false" }, // Module Resolution @@ -700,6 +741,7 @@ namespace ts { paramType: Diagnostics.STRATEGY, category: Diagnostics.Module_Resolution_Options, description: Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + defaultValueDescription: Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node }, { name: "baseUrl", @@ -734,7 +776,8 @@ namespace ts { affectsModuleResolution: true, category: Diagnostics.Module_Resolution_Options, description: Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime, - transpileOptionValue: undefined + transpileOptionValue: undefined, + defaultValueDescription: Diagnostics.Computed_from_the_list_of_input_files }, { name: "typeRoots", @@ -766,7 +809,8 @@ namespace ts { type: "boolean", affectsSemanticDiagnostics: true, category: Diagnostics.Module_Resolution_Options, - description: Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + description: Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking, + defaultValueDescription: Diagnostics.module_system_or_esModuleInterop }, { name: "esModuleInterop", @@ -775,13 +819,15 @@ namespace ts { affectsEmit: true, showInSimplifiedHelpView: true, category: Diagnostics.Module_Resolution_Options, - description: Diagnostics.Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports + description: Diagnostics.Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports, + defaultValueDescription: "fasle" }, { name: "preserveSymlinks", type: "boolean", category: Diagnostics.Module_Resolution_Options, description: Diagnostics.Do_not_resolve_the_real_path_of_symlinks, + defaultValueDescription: "n/a" }, { name: "allowUmdGlobalAccess", @@ -789,6 +835,7 @@ namespace ts { affectsSemanticDiagnostics: true, category: Diagnostics.Module_Resolution_Options, description: Diagnostics.Allow_accessing_UMD_globals_from_modules, + defaultValueDescription: "false" }, // Source Maps @@ -813,14 +860,16 @@ namespace ts { type: "boolean", affectsEmit: true, category: Diagnostics.Source_Map_Options, - description: Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file + description: Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file, + defaultValueDescription: "false" }, { name: "inlineSources", type: "boolean", affectsEmit: true, category: Diagnostics.Source_Map_Options, - description: Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set + description: Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set, + defaultValueDescription: "fasle" }, // Experimental @@ -845,7 +894,8 @@ namespace ts { name: "jsxFactory", type: "string", category: Diagnostics.Advanced_Options, - description: Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h + description: Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h, + defaultValueDescription: "`React.createElement`" }, { name: "jsxFragmentFactory", @@ -860,14 +910,16 @@ namespace ts { affectsEmit: true, affectsModuleResolution: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react + description: Diagnostics.Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react, + defaultValueDescription: "react" }, { name: "resolveJsonModule", type: "boolean", affectsModuleResolution: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Include_modules_imported_with_json_extension + description: Diagnostics.Include_modules_imported_with_json_extension, + defaultValueDescription: "false" }, { @@ -879,33 +931,38 @@ namespace ts { category: Diagnostics.Advanced_Options, paramType: Diagnostics.FILE, description: Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file, - transpileOptionValue: undefined + transpileOptionValue: undefined, + defaultValueDescription: "n/a" }, { name: "reactNamespace", type: "string", affectsEmit: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit + description: Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit, + defaultValueDescription: "`React`", }, { name: "skipDefaultLibCheck", type: "boolean", category: Diagnostics.Advanced_Options, - description: Diagnostics.Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files + description: Diagnostics.Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files, + defaultValueDescription: "false" }, { name: "charset", type: "string", category: Diagnostics.Advanced_Options, - description: Diagnostics.The_character_set_of_the_input_files + description: Diagnostics.The_character_set_of_the_input_files, + defaultValueDescription: "utf8" }, { name: "emitBOM", type: "boolean", affectsEmit: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files + description: Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files, + defaultValueDescription: "false" }, { name: "newLine", @@ -917,13 +974,15 @@ namespace ts { paramType: Diagnostics.NEWLINE, category: Diagnostics.Advanced_Options, description: Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + defaultValueDescription: Diagnostics.Platform_specific }, { name: "noErrorTruncation", type: "boolean", affectsSemanticDiagnostics: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Do_not_truncate_error_messages + description: Diagnostics.Do_not_truncate_error_messages, + defaultValueDescription: "false" }, { name: "noLib", @@ -933,7 +992,8 @@ namespace ts { description: Diagnostics.Do_not_include_the_default_library_file_lib_d_ts, // We are not returning a sourceFile for lib file when asked by the program, // so pass --noLib to avoid reporting a file not found error. - transpileOptionValue: true + transpileOptionValue: true, + defaultValueDescription: "false" }, { name: "noResolve", @@ -943,7 +1003,8 @@ namespace ts { description: Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files, // We are not doing a full typecheck, we are not resolving the whole context, // so pass --noResolve to avoid reporting missing file errors. - transpileOptionValue: true + transpileOptionValue: true, + defaultValueDescription: "false" }, { name: "stripInternal", @@ -957,7 +1018,8 @@ namespace ts { type: "boolean", affectsSourceFile: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Disable_size_limitations_on_JavaScript_projects + description: Diagnostics.Disable_size_limitations_on_JavaScript_projects, + defaultValueDescription: "false" }, { name: "disableSourceOfProjectReferenceRedirect", @@ -985,14 +1047,16 @@ namespace ts { type: "boolean", affectsSemanticDiagnostics: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Do_not_emit_use_strict_directives_in_module_output + description: Diagnostics.Do_not_emit_use_strict_directives_in_module_output, + defaultValueDescription: "false" }, { name: "noEmitHelpers", type: "boolean", affectsEmit: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output + description: Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output, + defaultValueDescription: "false" }, { name: "noEmitOnError", @@ -1000,14 +1064,16 @@ namespace ts { affectsEmit: true, category: Diagnostics.Advanced_Options, description: Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, - transpileOptionValue: undefined + transpileOptionValue: undefined, + defaultValueDescription: "false" }, { name: "preserveConstEnums", type: "boolean", affectsEmit: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code + description: Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code, + defaultValueDescription: "n/a" }, { name: "declarationDir", @@ -1017,13 +1083,15 @@ namespace ts { paramType: Diagnostics.DIRECTORY, category: Diagnostics.Advanced_Options, description: Diagnostics.Output_directory_for_generated_declaration_files, - transpileOptionValue: undefined + transpileOptionValue: undefined, + defaultValueDescription: "n/a" }, { name: "skipLibCheck", type: "boolean", category: Diagnostics.Advanced_Options, description: Diagnostics.Skip_type_checking_of_declaration_files, + defaultValueDescription: "false" }, { name: "allowUnusedLabels", @@ -1031,7 +1099,8 @@ namespace ts { affectsBindDiagnostics: true, affectsSemanticDiagnostics: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Do_not_report_errors_on_unused_labels + description: Diagnostics.Do_not_report_errors_on_unused_labels, + defaultValueDescription: "undefiend" }, { name: "allowUnreachableCode", @@ -1039,7 +1108,8 @@ namespace ts { affectsBindDiagnostics: true, affectsSemanticDiagnostics: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Do_not_report_errors_on_unreachable_code + description: Diagnostics.Do_not_report_errors_on_unreachable_code, + defaultValueDescription: "undefined" }, { name: "suppressExcessPropertyErrors", @@ -1047,6 +1117,7 @@ namespace ts { affectsSemanticDiagnostics: true, category: Diagnostics.Advanced_Options, description: Diagnostics.Suppress_excess_property_checks_for_object_literals, + defaultValueDescription: "false" }, { name: "suppressImplicitAnyIndexErrors", @@ -1054,20 +1125,23 @@ namespace ts { affectsSemanticDiagnostics: true, category: Diagnostics.Advanced_Options, description: Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, + defaultValueDescription: "false" }, { name: "forceConsistentCasingInFileNames", type: "boolean", affectsModuleResolution: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + description: Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file, + defaultValueDescription: "fasle" }, { name: "maxNodeModuleJsDepth", type: "number", affectsModuleResolution: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files + description: Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files, + defaultValueDescription: "0" }, { name: "noStrictGenericChecks", @@ -1075,6 +1149,7 @@ namespace ts { affectsSemanticDiagnostics: true, category: Diagnostics.Advanced_Options, description: Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types, + defaultValueDescription: "fasle" }, { name: "useDefineForClassFields", @@ -1083,13 +1158,14 @@ namespace ts { affectsEmit: true, category: Diagnostics.Advanced_Options, description: Diagnostics.Emit_class_fields_with_Define_instead_of_Set, + defaultValueDescription: "false" }, - { name: "keyofStringsOnly", type: "boolean", category: Diagnostics.Advanced_Options, description: Diagnostics.Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols, + defaultValueDescription: "false" }, { // A list of plugins to load in the language service @@ -1130,7 +1206,9 @@ namespace ts { export const transpileOptionValueCompilerOptions: readonly CommandLineOption[] = optionDeclarations.filter(option => hasProperty(option, "transpileOptionValue")); - const commandOptionsOnlyBuild: CommandLineOption[] = [ + // Build related options + /* @internal */ + export const optionsForBuild: CommandLineOption[] = [ { name: "verbose", shortName: "v", @@ -1163,7 +1241,7 @@ namespace ts { /* @internal */ export const buildOpts: CommandLineOption[] = [ ...commonOptionsWithBuild, - ...commandOptionsOnlyBuild, + ...optionsForBuild ]; /* @internal */ @@ -1761,7 +1839,8 @@ namespace ts { element: { name: "include", type: "string" - } + }, + defaultValueDescription: Diagnostics.if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk }, { name: "exclude", @@ -1769,7 +1848,8 @@ namespace ts { element: { name: "exclude", type: "string" - } + }, + defaultValueDescription: Diagnostics.node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified }, compileOnSaveCommandLineOption ]) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 5c8810f5ea8ca..cfee16351061f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -5104,6 +5104,68 @@ "code": 6802 }, + "any of:": { + "category": "Message", + "code": 6900 + }, + "one or more:": { + "category": "Message", + "code": 6901 + }, + "default:": { + "category": "Message", + "code": 6902 + }, + "module === \"system\" or esModuleInterop": { + "category": "Message", + "code": 6903 + }, + "`false`, unless `strict` is set": { + "category": "Message", + "code": 6904 + }, + "`false`, unless `composite` is set": { + "category": "Message", + "code": 6905 + }, + "`[\"node_modules\", \"bower_components\", \"jspm_packages\"]`, plus the value of `outDir` if one is specified.": { + "category": "Message", + "code": 6906 + }, + "`[]` if `files` is specified, otherwise `[\"**/*\"]`": { + "category": "Message", + "code": 6907 + }, + "`true` if `composite`, `false` otherwise": { + "category": "Message", + "code": 6908 + }, + "module === `AMD` or `UMD` or `System` or `ES6`, then `Classic`, Otherwise `Node`": { + "category": "Message", + "code": 6909 + }, + "Computed from the list of input files": { + "category": "Message", + "code": 6910 + }, + "Platform specific": { + "category": "Message", + "code": 6911 + }, + "You can learn about all of the compiler options at {0}": { + "category": "Message", + "code": 6912 + }, + "Including --watch, -w will start watching the current project for the file changes. Once set, you can config watch mode with:": { + "category": "Message", + "code": 6913 + }, + "Using --build, -b will make tsc behave more like a build orchestrator than a compiler. This is used to trigger building composite projects which you can learn more about at {0}": { + "category": "Message", + "code": 6914 + }, + + "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 3366c444559b2..6fc3e5249f794 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1162,6 +1162,7 @@ namespace ts { useCaseSensitiveFileNames: boolean; write(s: string): void; writeOutputIsTTY?(): boolean; + getWidthOfTerminal(): number; readFile(path: string, encoding?: string): string | undefined; getFileSize?(path: string): number; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; @@ -1308,6 +1309,9 @@ namespace ts { write(s: string): void { process.stdout.write(s); }, + getWidthOfTerminal(){ + return process.stdout.columns; + }, writeOutputIsTTY() { return process.stdout.isTTY; }, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 430a2f2b20176..13ee7e17c1608 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6178,7 +6178,8 @@ namespace ts { type: "string" | "number" | "boolean" | "object" | "list" | ESMap; // a value of a primitive type, or an object literal mapping named values to actual values isFilePath?: boolean; // True if option value is a path or fileName shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help' - description?: DiagnosticMessage; // The message describing what the command line switch does + description?: DiagnosticMessage; // The message describing what the command line switch does. + defaultValueDescription?: string | DiagnosticMessage; // The message describing what the dafault value is. string type is prepared for fixed chosen like "false" which do not need I18n. paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter isTSConfigOnly?: boolean; // True if option can only be specified via tsconfig.json file isCommandLineOnly?: boolean; diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 1861e3e103247..c8dd4ee56e598 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -24,7 +24,7 @@ namespace ts { } function getCountsMap() { - const counts = createMap(); + const counts = new Map(); counts.set("Library", 0); counts.set("Definitions", 0); counts.set("TypeScript", 0); @@ -89,6 +89,230 @@ namespace ts { sys.write(getDiagnosticText(Diagnostics.Version_0, version) + sys.newLine); } + function bold(str: string) { + return `${str}`; + } + + function blue(str: string) { + // pretty?formatColorAndReset(str, ForegroundColorEscapeSequences.Blue) : str; + return `${str}`; + } + + function getDisplayNameTextOfOption(option: CommandLineOption) { + return `--${option.name}${option.shortName ? `, -${option.shortName}` : ""}`; + } + + function generateOptionOutput(option: CommandLineOption, rightAlignOfLeft: number, leftAlignOfRight: number) { + let res: string[] = []; + + // name and description + const name = getDisplayNameTextOfOption(option); + + // value type and possiable value + const valueCandidates = getValueTypeAndPossiableValue(option); + const defaultValueDescription = typeof option.defaultValueDescription === "object" ? getDiagnosticText(option.defaultValueDescription) : option.defaultValueDescription; + const terminalWidth = sys.getWidthOfTerminal(); + + // terminal does not have enough width + if (terminalWidth < leftAlignOfRight + 20) { + res.push(blue(name)); + if (option.description) { + const description = getDiagnosticText(option.description); + res.push(description); + } + if (valueCandidates) { + res.push(` ${valueCandidates.valueType}: ${valueCandidates.possiableValues}`); + } + if (defaultValueDescription) { + res.push(` ${getDiagnosticText(Diagnostics.default_Colon)} ${defaultValueDescription}`); + } + } + else { + let description = ""; + if (option.description) { + description = getDiagnosticText(option.description); + } + res = [...res, ...getPrettyOutput(name, description, rightAlignOfLeft, leftAlignOfRight, terminalWidth, true), sys.newLine, sys.newLine]; + if (valueCandidates) { + res = [...res, ...getPrettyOutput(valueCandidates.valueType, valueCandidates.possiableValues, rightAlignOfLeft, leftAlignOfRight, terminalWidth, false), sys.newLine]; + } + if (defaultValueDescription) { + res = [...res, ...getPrettyOutput(getDiagnosticText(Diagnostics.default_Colon), defaultValueDescription, rightAlignOfLeft, leftAlignOfRight, terminalWidth, false), sys.newLine]; + } + res.push(sys.newLine); + } + return res; + + function getPrettyOutput(left: string, right: string, rightAlignOfLeft: number, leftAlignOfRight: number, terminalWidth: number, colorLeft: boolean) { + const res = []; + let isFirstLine = true; + let reaminRight = right; + const rightCharacterNumber = terminalWidth - leftAlignOfRight; + while (reaminRight.length !== 0) { + let curLeft = ""; + if (isFirstLine) { + curLeft = padLeft(left, rightAlignOfLeft); + curLeft = padRight(curLeft, leftAlignOfRight); + curLeft = colorLeft ? blue(curLeft) : curLeft; + } + else { + curLeft = padLeft("", leftAlignOfRight); + } + const curRight = reaminRight.substr(0, rightCharacterNumber); + reaminRight = reaminRight.slice(rightCharacterNumber); + res.push(`${curLeft}${curRight}`); + isFirstLine = false; + } + return res; + } + + function getValueTypeAndPossiableValue(option: CommandLineOption) { + // option.type might be "string" | "number" | "boolean" | "object" | "list" | ESMap + // string -- any of: string + // number -- any of: number + // boolean -- any of: boolean + // object -- null + // list -- one or more: , content depends on `option.element.type`, the same as others + // ESMap -- any of: key1, key2, .... + if (option.type === "object") { + return undefined; + } + + return { + valueType: getValueType(option), + possiableValues: getPossiableValues(option) + }; + + function getValueType(option: CommandLineOption) { + let valueType: string; + switch (option.type) { + case "list": + valueType = getDiagnosticText(Diagnostics.one_or_more_Colon); + break; + default: + valueType = getDiagnosticText(Diagnostics.any_of_Colon); + } + return valueType; + } + + function getPossiableValues(option: CommandLineOption) { + let possiableValues: string; + switch (option.type) { + case "string": + possiableValues = "string"; + break; + case "number": + possiableValues = "number"; + break; + case "boolean": + possiableValues = "boolean"; + break; + case "list": + // TODO: check inifinate loop + possiableValues = getPossiableValues(option.element); + break; + case "object": + possiableValues = ""; + break; + default: + // ESMap + // TODO: Fix iterator and iterable type issue for TS. + // @ts-ignore + const keys = Array.from(option.type.keys()); + possiableValues = keys.join(", "); + } + return possiableValues; + } + } + } + + function generateGroupOptionOutput(optionsList: readonly CommandLineOption[]) { + let maxLength = 0; + for (const option of optionsList) { + const curLength = getDisplayNameTextOfOption(option).length; + maxLength = maxLength > curLength ? maxLength : curLength; + } + + // left part should be right align, right part should be left align + + // assume 2 space between left margin and left part. + const rightAlignOfLeftPart = maxLength + 2; + // assume 2 space between left and right part + const leftAlignOfRightPart = rightAlignOfLeftPart + 2; + let res: string[] = []; + for (const option of optionsList) { + const tmp = generateOptionOutput(option, rightAlignOfLeftPart, leftAlignOfRightPart); + res = [...res, ...tmp]; + } + return res; + } + + function generateSectionOptionsOutput(sectionName: string, options: readonly CommandLineOption[], subCategory: boolean, beforeOptionsDescription?: string, afterOptionsDescription?: string) { + let res: string[] = []; + res.push(bold(sectionName) + sys.newLine + sys.newLine); + if (beforeOptionsDescription) { + res.push(beforeOptionsDescription + sys.newLine + sys.newLine); + } + if (!subCategory) { + res = [...res, ...generateGroupOptionOutput(options)]; + if (afterOptionsDescription) { + res.push(afterOptionsDescription + sys.newLine + sys.newLine); + } + return res; + } + const categoryMap = new Map(); + for (const option of options) { + const curCategory = option.category ? getDiagnosticText(option.category) : "No category"; + const optionsOfCurCategory = categoryMap.get(curCategory) ?? []; + optionsOfCurCategory.push(option); + categoryMap.set(curCategory, optionsOfCurCategory); + } + categoryMap.forEach((value, key) => { + res.push(`### ${key}${sys.newLine}${sys.newLine}`); + res = [...res, ...generateGroupOptionOutput(value)]; + }); + if (afterOptionsDescription) { + res.push(afterOptionsDescription + sys.newLine + sys.newLine); + } + return res; + } + + function printEasyHelp(simpleOptions: readonly CommandLineOption[]) { + let output: string[] = []; + output.push(`tsc: The Typescript Compiler - ${getDiagnosticText(Diagnostics.Version_0, version)}${sys.newLine}${sys.newLine}`); + output.push(bold("COMMON COMMANDS") + sys.newLine + sys.newLine); + output.push(" " + blue("tsc") + sys.newLine); + output.push(" " + "Compiles the current project (tsconfig.json in the working diirectory.)" + sys.newLine + sys.newLine); + output.push(" " + blue("tsc app.ts util.ts" + sys.newLine)); + output.push(" " + "Ignoring tsconfig.json, compiles the specified files with default compiler options" + sys.newLine + sys.newLine); + output.push(" " + blue("tsc -b" + sys.newLine)); + output.push(" " + "Build a composite project in the working directory." + sys.newLine + sys.newLine); + output.push(" " + blue("tsc --init" + sys.newLine)); + output.push(" " + "Creates a tsconfig.json with the recommended settings in the working directory." + sys.newLine + sys.newLine); + output.push(" " + blue("tsc -p .path/to/tsconfig.json" + sys.newLine)); + output.push(" " + "compiles the Typescript project located at the specified path" + sys.newLine + sys.newLine); + output.push(" " + blue("tsc --help --all" + sys.newLine)); + output.push(" " + "An expanded version of this information, showing all possible compiler options" + sys.newLine + sys.newLine); + output.push(" " + blue("tsc --noEmit" + sys.newLine)); + output.push(" " + blue("tsc --target esnext" + sys.newLine)); + output.push(" " + "Compiles the current project, with additional settings." + sys.newLine + sys.newLine); + output = [...output, ...generateSectionOptionsOutput("COMMON COMPILER OPTIONS", simpleOptions, false, undefined, formatMessage(undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; + for (const line of output) { + sys.write(line); + } + } + + function printAllHelp(compilerOptions: readonly CommandLineOption[], buildOptions: readonly CommandLineOption[], watchOptions: readonly CommandLineOption[]) { + let output: string[] = []; + output.push(`tsc: The Typescript Compiler - ${getDiagnosticText(Diagnostics.Version_0, version)}${sys.newLine}${sys.newLine}`); + output = [...output, ...generateSectionOptionsOutput("ALL COMPILER OPTIONS", compilerOptions, true, undefined, formatMessage(undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; + output = [...output, ...generateSectionOptionsOutput("WATCH OPTIONS", watchOptions, false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))]; + output = [...output, ...generateSectionOptionsOutput("BUILD OPTIONS", buildOptions, false, formatMessage(undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; + for (const line of output) { + sys.write(line); + } + } + function printHelp(sys: System, optionsList: readonly CommandLineOption[], syntaxPrefix = "") { const output: string[] = []; @@ -232,8 +456,13 @@ namespace ts { } if (commandLine.options.help || commandLine.options.all) { - printVersion(sys); - printHelp(sys, getOptionsForHelp(commandLine)); + if (!commandLine.options.all) { + printEasyHelp(getOptionsForHelp(commandLine)); + } + else { + printAllHelp(getOptionsForHelp(commandLine), optionsForBuild, optionsForWatch); + } + // printHelp(sys, ); return sys.exit(ExitStatus.Success); } diff --git a/src/webServer/webServer.ts b/src/webServer/webServer.ts index 684bd3181dcf4..5362979728939 100644 --- a/src/webServer/webServer.ts +++ b/src/webServer/webServer.ts @@ -122,7 +122,7 @@ namespace ts.server { const webPath = getWebPath(path); return webPath && host.readFile(webPath); }, - + getWidthOfTerminal: () => Number.MAX_VALUE, // TODO: could we assume this is infinate? or this is zero? write: host.writeMessage.bind(host), watchFile: returnNoopFileWatcher, watchDirectory: returnNoopFileWatcher, From 26848b9bd7ee8363438cfb565cf3a22862e7b923 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Thu, 20 May 2021 13:14:04 +0800 Subject: [PATCH 02/21] fix typo and omit false condition boolean output. --- src/compiler/commandLineParser.ts | 12 ++--- src/executeCommandLine/executeCommandLine.ts | 50 +++++++++++++------- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index b4810de13644e..e04e7666a9c4f 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -557,7 +557,7 @@ namespace ts { affectsEmit: true, category: Diagnostics.Basic_Options, description: Diagnostics.Import_emit_helpers_from_tslib, - defaultValueDescription: "fasle" + defaultValueDescription: "false" }, { name: "importsNotUsedAsValues", @@ -577,7 +577,7 @@ namespace ts { affectsEmit: true, category: Diagnostics.Basic_Options, description: Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3, - defaultValueDescription: "fasle" + defaultValueDescription: "false" }, { name: "isolatedModules", @@ -820,7 +820,7 @@ namespace ts { showInSimplifiedHelpView: true, category: Diagnostics.Module_Resolution_Options, description: Diagnostics.Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports, - defaultValueDescription: "fasle" + defaultValueDescription: "false" }, { name: "preserveSymlinks", @@ -869,7 +869,7 @@ namespace ts { affectsEmit: true, category: Diagnostics.Source_Map_Options, description: Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set, - defaultValueDescription: "fasle" + defaultValueDescription: "false" }, // Experimental @@ -1133,7 +1133,7 @@ namespace ts { affectsModuleResolution: true, category: Diagnostics.Advanced_Options, description: Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file, - defaultValueDescription: "fasle" + defaultValueDescription: "false" }, { name: "maxNodeModuleJsDepth", @@ -1149,7 +1149,7 @@ namespace ts { affectsSemanticDiagnostics: true, category: Diagnostics.Advanced_Options, description: Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types, - defaultValueDescription: "fasle" + defaultValueDescription: "false" }, { name: "useDefineForClassFields", diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index c8dd4ee56e598..4876d6092dd62 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -103,13 +103,19 @@ namespace ts { } function generateOptionOutput(option: CommandLineOption, rightAlignOfLeft: number, leftAlignOfRight: number) { + interface ValueCandidate{ + // "one or more" or "any of" + valueType: string; + possiableValues: string; + } + let res: string[] = []; // name and description const name = getDisplayNameTextOfOption(option); // value type and possiable value - const valueCandidates = getValueTypeAndPossiableValue(option); + const valueCandidates = getValueCandidate(option); const defaultValueDescription = typeof option.defaultValueDescription === "object" ? getDiagnosticText(option.defaultValueDescription) : option.defaultValueDescription; const terminalWidth = sys.getWidthOfTerminal(); @@ -120,11 +126,14 @@ namespace ts { const description = getDiagnosticText(option.description); res.push(description); } - if (valueCandidates) { - res.push(` ${valueCandidates.valueType}: ${valueCandidates.possiableValues}`); - } - if (defaultValueDescription) { - res.push(` ${getDiagnosticText(Diagnostics.default_Colon)} ${defaultValueDescription}`); + if (isAdditionalInfoOutput(valueCandidates, option.defaultValueDescription)) { + if (valueCandidates) { + res.push(` ${valueCandidates.valueType}: ${valueCandidates.possiableValues}`); + } + if (defaultValueDescription) { + res.push(` ${getDiagnosticText(Diagnostics.default_Colon)} ${defaultValueDescription}`); + } + res.push(sys.newLine); } } else { @@ -132,17 +141,26 @@ namespace ts { if (option.description) { description = getDiagnosticText(option.description); } - res = [...res, ...getPrettyOutput(name, description, rightAlignOfLeft, leftAlignOfRight, terminalWidth, true), sys.newLine, sys.newLine]; - if (valueCandidates) { - res = [...res, ...getPrettyOutput(valueCandidates.valueType, valueCandidates.possiableValues, rightAlignOfLeft, leftAlignOfRight, terminalWidth, false), sys.newLine]; - } - if (defaultValueDescription) { - res = [...res, ...getPrettyOutput(getDiagnosticText(Diagnostics.default_Colon), defaultValueDescription, rightAlignOfLeft, leftAlignOfRight, terminalWidth, false), sys.newLine]; + res = [...res, ...getPrettyOutput(name, description, rightAlignOfLeft, leftAlignOfRight, terminalWidth, true), sys.newLine]; + if (isAdditionalInfoOutput(valueCandidates, option.defaultValueDescription)) { + if (valueCandidates) { + res = [...res, sys.newLine, ...getPrettyOutput(valueCandidates.valueType, valueCandidates.possiableValues, rightAlignOfLeft, leftAlignOfRight, terminalWidth, false), sys.newLine]; + } + if (defaultValueDescription) { + res = [...res, sys.newLine, ...getPrettyOutput(getDiagnosticText(Diagnostics.default_Colon), defaultValueDescription, rightAlignOfLeft, leftAlignOfRight, terminalWidth, false), sys.newLine]; + } + res.push(sys.newLine); } - res.push(sys.newLine); } return res; + function isAdditionalInfoOutput(valueCandidates: ValueCandidate | undefined, defaultValueDescription: string | DiagnosticMessage | undefined): boolean { + if(valueCandidates?.possiableValues === "boolean" && (defaultValueDescription === "false" || defaultValueDescription === "undefined" || defaultValueDescription === "n/a")){ + return false; + } + return true; + } + function getPrettyOutput(left: string, right: string, rightAlignOfLeft: number, leftAlignOfRight: number, terminalWidth: number, colorLeft: boolean) { const res = []; let isFirstLine = true; @@ -166,7 +184,7 @@ namespace ts { return res; } - function getValueTypeAndPossiableValue(option: CommandLineOption) { + function getValueCandidate(option: CommandLineOption): ValueCandidate | undefined { // option.type might be "string" | "number" | "boolean" | "object" | "list" | ESMap // string -- any of: string // number -- any of: number @@ -216,9 +234,7 @@ namespace ts { break; default: // ESMap - // TODO: Fix iterator and iterable type issue for TS. - // @ts-ignore - const keys = Array.from(option.type.keys()); + const keys = arrayFrom(option.type.keys()); possiableValues = keys.join(", "); } return possiableValues; From c8ddf1ad861c4d8a8734bf2cbb23aec615cb0d97 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Thu, 20 May 2021 13:18:22 +0800 Subject: [PATCH 03/21] fix typo --- src/compiler/commandLineParser.ts | 2 +- src/executeCommandLine/executeCommandLine.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index e04e7666a9c4f..4fdd27321bb5b 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1100,7 +1100,7 @@ namespace ts { affectsSemanticDiagnostics: true, category: Diagnostics.Advanced_Options, description: Diagnostics.Do_not_report_errors_on_unused_labels, - defaultValueDescription: "undefiend" + defaultValueDescription: "undefined" }, { name: "allowUnreachableCode", diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 4876d6092dd62..12463b99b52ae 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -155,7 +155,7 @@ namespace ts { return res; function isAdditionalInfoOutput(valueCandidates: ValueCandidate | undefined, defaultValueDescription: string | DiagnosticMessage | undefined): boolean { - if(valueCandidates?.possiableValues === "boolean" && (defaultValueDescription === "false" || defaultValueDescription === "undefined" || defaultValueDescription === "n/a")){ + if(valueCandidates?.possiableValues === "boolean" && (defaultValueDescription === undefined|| defaultValueDescription === "false" || defaultValueDescription === "undefined" || defaultValueDescription === "n/a")){ return false; } return true; From 7dae10bf4c159e98d47ea3d6c5f6f24f0dd9a57c Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Thu, 20 May 2021 13:21:40 +0800 Subject: [PATCH 04/21] add line break --- src/executeCommandLine/executeCommandLine.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 12463b99b52ae..991dda0ba0c20 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -260,6 +260,10 @@ namespace ts { const tmp = generateOptionOutput(option, rightAlignOfLeftPart, leftAlignOfRightPart); res = [...res, ...tmp]; } + // make sure always a blank line in the end. + if (res[res.length - 2] !== sys.newLine) { + res.push(sys.newLine); + } return res; } From 418dc83271a154645a98bd1d6c38e6454203e43f Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Sat, 22 May 2021 18:44:58 +0800 Subject: [PATCH 05/21] add --plugins option to basic option category. --- src/compiler/commandLineParser.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index b4810de13644e..b31cb2e66f2bd 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1176,6 +1176,7 @@ namespace ts { name: "plugin", type: "object" }, + category: Diagnostics.Basic_Options, description: Diagnostics.List_of_language_service_plugins }, ]; From d7df681e4fa65c208b38b16044d174ed884f25ea Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Sat, 22 May 2021 23:11:31 +0800 Subject: [PATCH 06/21] add ts icon and remove old print help function. --- src/executeCommandLine/executeCommandLine.ts | 162 ++++++------------- 1 file changed, 47 insertions(+), 115 deletions(-) diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 991dda0ba0c20..92f51d11c97b9 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -98,6 +98,14 @@ namespace ts { return `${str}`; } + function blueBackground(str: string) { + return `${str}`; + } + + function white(str: string) { + return `${str}`; + } + function getDisplayNameTextOfOption(option: CommandLineOption) { return `--${option.name}${option.shortName ? `, -${option.shortName}` : ""}`; } @@ -297,9 +305,8 @@ namespace ts { return res; } - function printEasyHelp(simpleOptions: readonly CommandLineOption[]) { - let output: string[] = []; - output.push(`tsc: The Typescript Compiler - ${getDiagnosticText(Diagnostics.Version_0, version)}${sys.newLine}${sys.newLine}`); + function printEasyHelp(sys: System, simpleOptions: readonly CommandLineOption[]) { + let output: string[] = [...getHelpHeader(sys)]; output.push(bold("COMMON COMMANDS") + sys.newLine + sys.newLine); output.push(" " + blue("tsc") + sys.newLine); output.push(" " + "Compiles the current project (tsconfig.json in the working diirectory.)" + sys.newLine + sys.newLine); @@ -322,9 +329,8 @@ namespace ts { } } - function printAllHelp(compilerOptions: readonly CommandLineOption[], buildOptions: readonly CommandLineOption[], watchOptions: readonly CommandLineOption[]) { - let output: string[] = []; - output.push(`tsc: The Typescript Compiler - ${getDiagnosticText(Diagnostics.Version_0, version)}${sys.newLine}${sys.newLine}`); + function printAllHelp(sys: System, compilerOptions: readonly CommandLineOption[], buildOptions: readonly CommandLineOption[], watchOptions: readonly CommandLineOption[]) { + let output: string[] = [...getHelpHeader(sys)]; output = [...output, ...generateSectionOptionsOutput("ALL COMPILER OPTIONS", compilerOptions, true, undefined, formatMessage(undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; output = [...output, ...generateSectionOptionsOutput("WATCH OPTIONS", watchOptions, false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))]; output = [...output, ...generateSectionOptionsOutput("BUILD OPTIONS", buildOptions, false, formatMessage(undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; @@ -333,111 +339,43 @@ namespace ts { } } - function printHelp(sys: System, optionsList: readonly CommandLineOption[], syntaxPrefix = "") { - const output: string[] = []; - - // We want to align our "syntax" and "examples" commands to a certain margin. - const syntaxLength = getDiagnosticText(Diagnostics.Syntax_Colon_0, "").length; - const examplesLength = getDiagnosticText(Diagnostics.Examples_Colon_0, "").length; - let marginLength = Math.max(syntaxLength, examplesLength); - - // Build up the syntactic skeleton. - let syntax = makePadding(marginLength - syntaxLength); - syntax += `tsc ${syntaxPrefix}[${getDiagnosticText(Diagnostics.options)}] [${getDiagnosticText(Diagnostics.file)}...]`; - - output.push(getDiagnosticText(Diagnostics.Syntax_Colon_0, syntax)); - output.push(sys.newLine + sys.newLine); - - // Build up the list of examples. - const padding = makePadding(marginLength); - output.push(getDiagnosticText(Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + sys.newLine); - output.push(padding + "tsc --outFile file.js file.ts" + sys.newLine); - output.push(padding + "tsc @args.txt" + sys.newLine); - output.push(padding + "tsc --build tsconfig.json" + sys.newLine); - output.push(sys.newLine); - - output.push(getDiagnosticText(Diagnostics.Options_Colon) + sys.newLine); - - // We want our descriptions to align at the same column in our output, - // so we keep track of the longest option usage string. - marginLength = 0; - const usageColumn: string[] = []; // Things like "-d, --declaration" go in here. - const descriptionColumn: string[] = []; - - const optionsDescriptionMap = new Map(); // Map between option.description and list of option.type if it is a kind - - for (const option of optionsList) { - // If an option lacks a description, - // it is not officially supported. - if (!option.description) { - continue; - } - - let usageText = " "; - if (option.shortName) { - usageText += "-" + option.shortName; - usageText += getParamType(option); - usageText += ", "; - } - - usageText += "--" + option.name; - usageText += getParamType(option); - - usageColumn.push(usageText); - let description: string; - - if (option.name === "lib") { - description = getDiagnosticText(option.description); - const element = (option as CommandLineOptionOfListType).element; - const typeMap = element.type as ESMap; - optionsDescriptionMap.set(description, arrayFrom(typeMap.keys()).map(key => `'${key}'`)); - } - else { - description = getDiagnosticText(option.description); - } - - descriptionColumn.push(description); - - // Set the new margin for the description column if necessary. - marginLength = Math.max(usageText.length, marginLength); - } - - // Special case that can't fit in the loop. - const usageText = " @<" + getDiagnosticText(Diagnostics.file) + ">"; - usageColumn.push(usageText); - descriptionColumn.push(getDiagnosticText(Diagnostics.Insert_command_line_options_and_files_from_a_file)); - marginLength = Math.max(usageText.length, marginLength); - - // Print out each row, aligning all the descriptions on the same column. - for (let i = 0; i < usageColumn.length; i++) { - const usage = usageColumn[i]; - const description = descriptionColumn[i]; - const kindsList = optionsDescriptionMap.get(description); - output.push(usage + makePadding(marginLength - usage.length + 2) + description + sys.newLine); - - if (kindsList) { - output.push(makePadding(marginLength + 4)); - for (const kind of kindsList) { - output.push(kind + " "); - } - output.push(sys.newLine); - } - } - + function printBuildHelp(sys: System, buildOptions: readonly CommandLineOption[]) { + let output: string[] = [...getHelpHeader(sys)]; + output = [...output, ...generateSectionOptionsOutput("BUILD OPTIONS", buildOptions, false, formatMessage(undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; for (const line of output) { sys.write(line); } - return; + } - function getParamType(option: CommandLineOption) { - if (option.paramType !== undefined) { - return " " + getDiagnosticText(option.paramType); - } - return ""; + function getHelpHeader(sys: System) { + const header: string[] = []; + const tscexplaination = `tsc: The Typescript Compiler - ${getDiagnosticText(Diagnostics.Version_0, version)}`; + const terminalWidth = sys.getWidthOfTerminal(); + const tsIconLength = 5; + + const tsIconFirstLine = blueBackground(padLeft("", tsIconLength)); + const tsIconSecondLine = blueBackground(white(padLeft("TS ", tsIconLength))); + // If we have enough space, print TS icon. + if (terminalWidth >= tscexplaination.length + tsIconLength) { + // right align of the icon is 120 at most. + const rightAlign = terminalWidth > 120 ? 120 : terminalWidth; + const leftAlign = rightAlign - tsIconLength; + header.push(padRight(tscexplaination, leftAlign) + tsIconFirstLine + sys.newLine); + header.push(padLeft("", leftAlign) + tsIconSecondLine + sys.newLine); } + else { + header.push(tscexplaination + sys.newLine); + header.push(sys.newLine); + } + return header; + } - function makePadding(paddingLength: number): string { - return Array(paddingLength + 1).join(" "); + function printHelp(sys: System, commandLine: ParsedCommandLine) { + if (!commandLine.options.all) { + printEasyHelp(sys, getOptionsForHelp(commandLine)); + } + else { + printAllHelp(sys, getOptionsForHelp(commandLine), optionsForBuild, optionsForWatch); } } @@ -476,13 +414,7 @@ namespace ts { } if (commandLine.options.help || commandLine.options.all) { - if (!commandLine.options.all) { - printEasyHelp(getOptionsForHelp(commandLine)); - } - else { - printAllHelp(getOptionsForHelp(commandLine), optionsForBuild, optionsForWatch); - } - // printHelp(sys, ); + printHelp(sys, commandLine); return sys.exit(ExitStatus.Success); } @@ -524,7 +456,7 @@ namespace ts { } else { printVersion(sys); - printHelp(sys, getOptionsForHelp(commandLine)); + printHelp(sys, commandLine); } return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } @@ -712,13 +644,13 @@ namespace ts { if (buildOptions.help) { printVersion(sys); - printHelp(sys, buildOpts, "--build "); + printBuildHelp(sys, buildOpts); return sys.exit(ExitStatus.Success); } if (projects.length === 0) { printVersion(sys); - printHelp(sys, buildOpts, "--build "); + printBuildHelp(sys, buildOpts); return sys.exit(ExitStatus.Success); } From 0847b23ad30d585de25c05d6ee0824f72f63e0da Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Sat, 22 May 2021 23:23:55 +0800 Subject: [PATCH 07/21] better command description for --jsx. --- src/compiler/commandLineParser.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 9f5c2508b99a2..01c3dc326fdfc 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -437,7 +437,7 @@ namespace ts { paramType: Diagnostics.KIND, showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, - description: Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_react_react_jsx_or_react_jsxdev, + description: Diagnostics.Specify_JSX_code_generation, defaultValueDescription: "undefined" }, { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index cfee16351061f..671b8a712459b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4223,7 +4223,7 @@ "category": "Message", "code": 6079 }, - "Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'.": { + "Specify JSX code generation.": { "category": "Message", "code": 6080 }, From 2203137ceb3b7d9cbf2d0580c59fceac612beef4 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Sun, 23 May 2021 10:01:00 +0800 Subject: [PATCH 08/21] Fix test --- src/compiler/commandLineParser.ts | 4 +- src/compiler/diagnosticMessages.json | 4 +- src/executeCommandLine/executeCommandLine.ts | 9 +- src/harness/fakesHosts.ts | 4 + src/harness/harnessLanguageService.ts | 4 + src/harness/virtualFileSystemWithWatch.ts | 4 + src/testRunner/unittests/tsserver/session.ts | 1 + .../reference/api/tsserverlibrary.d.ts | 1 + tests/baselines/reference/api/typescript.d.ts | 1 + .../tsconfig.json | 7 +- .../tsconfig.json | 7 +- .../tsconfig.json | 7 +- .../tsconfig.json | 7 +- .../tsconfig.json | 7 +- .../tsconfig.json | 7 +- .../tsconfig.json | 7 +- .../tsconfig.json | 7 +- .../tsconfig.json | 7 +- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 186 +++++++++++++----- .../declarationDir-is-specified.js | 7 +- ...-outDir-and-declarationDir-is-specified.js | 7 +- .../when-outDir-is-specified.js | 7 +- .../with-outFile.js | 7 +- ...e-is-specified-with-declaration-enabled.js | 7 +- .../without-outDir-or-outFile-is-specified.js | 7 +- 25 files changed, 225 insertions(+), 98 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 01c3dc326fdfc..9beb915e0bc39 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -313,7 +313,7 @@ namespace ts { paramType: Diagnostics.VERSION, showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, - description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_ES2018_ES2019_ES2020_ES2021_or_ESNEXT, + description: Diagnostics.Specify_ECMAScript_target_version, defaultValueDescription: "ES3" }; @@ -397,7 +397,7 @@ namespace ts { paramType: Diagnostics.KIND, showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, - description: Diagnostics.Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_es2020_or_ESNext, + description: Diagnostics.Specify_module_code_generation, }, { name: "lib", diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 671b8a712459b..b786679808c78 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4011,11 +4011,11 @@ "category": "Message", "code": 6014 }, - "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'.": { + "Specify ECMAScript target version.": { "category": "Message", "code": 6015 }, - "Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'.": { + "Specify module code generation.": { "category": "Message", "code": 6016 }, diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 92f51d11c97b9..fdf4acaed9b28 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -90,20 +90,19 @@ namespace ts { } function bold(str: string) { - return `${str}`; + return `\x1b[1m${str}\x1b[22m`; } function blue(str: string) { - // pretty?formatColorAndReset(str, ForegroundColorEscapeSequences.Blue) : str; - return `${str}`; + return `\x1b[34m${str}\x1b[39m`; } function blueBackground(str: string) { - return `${str}`; + return `\x1b[44m${str}\x1b[49m`; } function white(str: string) { - return `${str}`; + return `\x1b[37m${str}\x1b[39m`; } function getDisplayNameTextOfOption(option: CommandLineOption) { diff --git a/src/harness/fakesHosts.ts b/src/harness/fakesHosts.ts index 8d7db1d333cb3..5de4859db6c0f 100644 --- a/src/harness/fakesHosts.ts +++ b/src/harness/fakesHosts.ts @@ -32,6 +32,10 @@ namespace fakes { this._env = env; } + getWidthOfTerminal(): number { + return 0; + } + // Pretty output writeOutputIsTTY() { return true; diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 6b4dc207a3e33..0ba489158845c 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -726,6 +726,10 @@ namespace Harness.LanguageService { this.newLine = this.host.getNewLine(); } + getWidthOfTerminal(): number { + return 0; + } + onMessage = ts.noop; writeMessage = ts.noop; // overridden write(message: string): void { diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index bf73ac7304fd8..289d182d3f0bb 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -1026,6 +1026,10 @@ interface Array { length: number; [n: number]: T; }` this.modifyFile(path, this.readFile(path) + content, options); } + getWidthOfTerminal(): number { + return 0; + } + write(message: string) { this.output.push(message); } diff --git a/src/testRunner/unittests/tsserver/session.ts b/src/testRunner/unittests/tsserver/session.ts index f0955347038ba..61937ac3ad5a2 100644 --- a/src/testRunner/unittests/tsserver/session.ts +++ b/src/testRunner/unittests/tsserver/session.ts @@ -7,6 +7,7 @@ namespace ts.server { args: [], newLine: "\n", useCaseSensitiveFileNames: true, + getWidthOfTerminal: () => 0, write(s): void { lastWrittenToHost = s; }, readFile: returnUndefined, writeFile: noop, diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index edd094bb4d964..a13da536038c0 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3951,6 +3951,7 @@ declare namespace ts { useCaseSensitiveFileNames: boolean; write(s: string): void; writeOutputIsTTY?(): boolean; + getWidthOfTerminal(): number; readFile(path: string, encoding?: string): string | undefined; getFileSize?(path: string): number; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index de5f04cd820df..89fe520403f92 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3951,6 +3951,7 @@ declare namespace ts { useCaseSensitiveFileNames: boolean; write(s: string): void; writeOutputIsTTY?(): boolean; + getWidthOfTerminal(): number; readFile(path: string, encoding?: string): string | undefined; getFileSize?(path: string): number; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index 194d0d139323d..a9cb1ac4942a2 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -4,12 +4,12 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "commonjs", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -23,6 +23,7 @@ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json index 6cd483e76a9f0..a0875658995cb 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -4,12 +4,12 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "commonjs", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -23,6 +23,7 @@ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index d10611ebdae17..b8480971ae759 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -4,12 +4,12 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "commonjs", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -23,6 +23,7 @@ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 485a029ae8329..47c48012ed3c4 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -4,12 +4,12 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "commonjs", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + "jsx": "react", /* Specify JSX code generation. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -23,6 +23,7 @@ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index 66028174a9ea6..eff834728947b 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -4,12 +4,12 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "commonjs", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -23,6 +23,7 @@ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index d926a958770fe..ea97583897bca 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -4,12 +4,12 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "commonjs", /* Specify module code generation. */ "lib": ["es5","es2015.promise"], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -23,6 +23,7 @@ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index 194d0d139323d..a9cb1ac4942a2 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -4,12 +4,12 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "commonjs", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -23,6 +23,7 @@ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index 9c4a96d98d35c..195581a92a648 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -4,12 +4,12 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "commonjs", /* Specify module code generation. */ "lib": ["es5","es2015.core"], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -23,6 +23,7 @@ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index dd5852675808c..ff7a865afee30 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -4,12 +4,12 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "commonjs", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -23,6 +23,7 @@ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 362d9209ea89e..97d12d54b275c 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -7,50 +7,148 @@ Input:: Output:: /lib/tsc Version FakeTSVersion -Syntax: tsc [options] [file...] - -Examples: tsc hello.ts - tsc --outFile file.js file.ts - tsc @args.txt - tsc --build tsconfig.json - -Options: - -h, --help Print this message. - -w, --watch Watch input files. - --pretty Stylize errors and messages using color and context (experimental). - --all Show all compiler options. - -v, --version Print the compiler's version. - --init Initializes a TypeScript project and creates a tsconfig.json file. - -p FILE OR DIRECTORY, --project FILE OR DIRECTORY Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. - -b, --build Build one or more projects and their dependencies, if out of date - -t VERSION, --target VERSION Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. - -m KIND, --module KIND Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. - --lib Specify library files to be included in the compilation. - 'es5' 'es6' 'es2015' 'es7' 'es2016' 'es2017' 'es2018' 'es2019' 'es2020' 'es2021' 'esnext' 'dom' 'dom.iterable' 'webworker' 'webworker.importscripts' 'webworker.iterable' 'scripthost' 'es2015.core' 'es2015.collection' 'es2015.generator' 'es2015.iterable' 'es2015.promise' 'es2015.proxy' 'es2015.reflect' 'es2015.symbol' 'es2015.symbol.wellknown' 'es2016.array.include' 'es2017.object' 'es2017.sharedmemory' 'es2017.string' 'es2017.intl' 'es2017.typedarrays' 'es2018.asyncgenerator' 'es2018.asynciterable' 'es2018.intl' 'es2018.promise' 'es2018.regexp' 'es2019.array' 'es2019.object' 'es2019.string' 'es2019.symbol' 'es2020.bigint' 'es2020.promise' 'es2020.sharedmemory' 'es2020.string' 'es2020.symbol.wellknown' 'es2020.intl' 'es2021.promise' 'es2021.string' 'es2021.weakref' 'esnext.array' 'esnext.symbol' 'esnext.asynciterable' 'esnext.intl' 'esnext.bigint' 'esnext.string' 'esnext.promise' 'esnext.weakref' - --allowJs Allow javascript files to be compiled. - --jsx KIND Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. - -d, --declaration Generates corresponding '.d.ts' file. - --declarationMap Generates a sourcemap for each corresponding '.d.ts' file. - --sourceMap Generates corresponding '.map' file. - --outFile FILE Concatenate and emit output to single file. - --outDir DIRECTORY Redirect output structure to the directory. - --removeComments Do not emit comments to output. - --noEmit Do not emit outputs. - --strict Enable all strict type-checking options. - --noImplicitAny Raise error on expressions and declarations with an implied 'any' type. - --strictNullChecks Enable strict null checks. - --strictFunctionTypes Enable strict checking of function types. - --strictBindCallApply Enable strict 'bind', 'call', and 'apply' methods on functions. - --strictPropertyInitialization Enable strict checking of property initialization in classes. - --noImplicitThis Raise error on 'this' expressions with an implied 'any' type. - --alwaysStrict Parse in strict mode and emit "use strict" for each source file. - --noUnusedLocals Report errors on unused locals. - --noUnusedParameters Report errors on unused parameters. - --noImplicitReturns Report error when not all code paths in function return a value. - --noFallthroughCasesInSwitch Report errors for fallthrough cases in switch statement. - --types Type declaration files to be included in compilation. - --esModuleInterop Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. - @ Insert command line options and files from a file. +tsc: The Typescript Compiler - Version FakeTSVersion + +COMMON COMMANDS + + tsc + Compiles the current project (tsconfig.json in the working diirectory.) + + tsc app.ts util.ts + Ignoring tsconfig.json, compiles the specified files with default compiler options + + tsc -b + Build a composite project in the working directory. + + tsc --init + Creates a tsconfig.json with the recommended settings in the working directory. + + tsc -p .path/to/tsconfig.json + compiles the Typescript project located at the specified path + + tsc --help --all + An expanded version of this information, showing all possible compiler options + + tsc --noEmit + tsc --target esnext + Compiles the current project, with additional settings. + +COMMON COMPILER OPTIONS + + --help, -h Print this message. + --watch, -w Watch input files. + --pretty Stylize errors and messages using color and context (experimental). + + any of: boolean + + default: true + + --all Show all compiler options. + --version, -v Print the compiler's version. + --init Initializes a TypeScript project and creates a tsconfig.json file. + --project, -p Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. + + any of: string + + --build, -b Build one or more projects and their dependencies, if out of date + --target, -t Specify ECMAScript target version. + + any of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext + + default: ES3 + + --module, -m Specify module code generation. + + any of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext + + --lib Specify library files to be included in the compilation. + + one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es20 15.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sha redmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019 .string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, esnext. array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref + + --allowJs Allow javascript files to be compiled. + --jsx Specify JSX code generation. + + any of: preserve, react-native, react, react-jsx, react-jsxdev + + default: undefined + + --declaration, -d Generates corresponding '.d.ts' file. + + any of: boolean + + default: `false`, unless `composite` is set + + --declarationMap Generates a sourcemap for each corresponding '.d.ts' file. + --sourceMap Generates corresponding '.map' file. + --outFile Concatenate and emit output to single file. + + any of: string + + default: n/a + + --outDir Redirect output structure to the directory. + + any of: string + + default: n/a + + --removeComments Do not emit comments to output. + --noEmit Do not emit outputs. + --strict Enable all strict type-checking options. + --noImplicitAny Raise error on expressions and declarations with an implied 'any' type. + + any of: boolean + + default: `false`, unless `strict` is set + + --strictNullChecks Enable strict null checks. + + any of: boolean + + default: `false`, unless `strict` is set + + --strictFunctionTypes Enable strict checking of function types. + + any of: boolean + + default: `false`, unless `strict` is set + + --strictBindCallApply Enable strict 'bind', 'call', and 'apply' methods on functions. + + any of: boolean + + default: `false`, unless `strict` is set + + --strictPropertyInitialization Enable strict checking of property initialization in classes. + + any of: boolean + + default: `false`, unless `strict` is set + + --noImplicitThis Raise error on 'this' expressions with an implied 'any' type. + + any of: boolean + + default: `false`, unless `strict` is set + + --alwaysStrict Parse in strict mode and emit "use strict" for each source file. + + any of: boolean + + default: `false`, unless `strict` is set + + --noUnusedLocals Report errors on unused locals. + --noUnusedParameters Report errors on unused parameters. + --noImplicitReturns Report error when not all code paths in function return a value. + --noFallthroughCasesInSwitch Report errors for fallthrough cases in switch statement. + --types Type declaration files to be included in compilation. + + one or more: string + + --esModuleInterop Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. + +You can learn about all of the compiler options at https://aka.ms/tsconfig-reference + exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js index 16b925d5936d4..25fbd47548a36 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js @@ -25,12 +25,12 @@ interface Array { length: number; [n: number]: T; } /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "amd", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -44,6 +44,7 @@ interface Array { length: number; [n: number]: T; } // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js index 7ce20f4eb951f..32bd549fb0eb9 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js @@ -25,12 +25,12 @@ interface Array { length: number; [n: number]: T; } /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "amd", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -44,6 +44,7 @@ interface Array { length: number; [n: number]: T; } // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js index f35e860335bb8..b730b343256ae 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js @@ -25,12 +25,12 @@ interface Array { length: number; [n: number]: T; } /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "amd", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -44,6 +44,7 @@ interface Array { length: number; [n: number]: T; } // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js index 8f6c7e53cc61b..d08799a54fb49 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js @@ -25,12 +25,12 @@ interface Array { length: number; [n: number]: T; } /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "amd", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -44,6 +44,7 @@ interface Array { length: number; [n: number]: T; } // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js index 0bc0a489d1891..fd696fd6cdfab 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js @@ -25,12 +25,12 @@ interface Array { length: number; [n: number]: T; } /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "amd", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -44,6 +44,7 @@ interface Array { length: number; [n: number]: T; } // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js index 79c6b55b1f1e0..b4b00fe35c386 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js @@ -25,12 +25,12 @@ interface Array { length: number; [n: number]: T; } /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "target": "es5", /* Specify ECMAScript target version. */ + "module": "amd", /* Specify module code generation. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ @@ -44,6 +44,7 @@ interface Array { length: number; [n: number]: T; } // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "plugins": [], /* List of language service plugins. */ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ From 9e2ba008312f38ce7254a6ca35ac7b229b18c65f Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Sun, 23 May 2021 10:40:34 +0800 Subject: [PATCH 09/21] fix lint --- src/executeCommandLine/executeCommandLine.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index fdf4acaed9b28..1a1849c77013b 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -148,13 +148,13 @@ namespace ts { if (option.description) { description = getDiagnosticText(option.description); } - res = [...res, ...getPrettyOutput(name, description, rightAlignOfLeft, leftAlignOfRight, terminalWidth, true), sys.newLine]; + res = [...res, ...getPrettyOutput(name, description, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ true), sys.newLine]; if (isAdditionalInfoOutput(valueCandidates, option.defaultValueDescription)) { if (valueCandidates) { - res = [...res, sys.newLine, ...getPrettyOutput(valueCandidates.valueType, valueCandidates.possiableValues, rightAlignOfLeft, leftAlignOfRight, terminalWidth, false), sys.newLine]; + res = [...res, sys.newLine, ...getPrettyOutput(valueCandidates.valueType, valueCandidates.possiableValues, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ false), sys.newLine]; } if (defaultValueDescription) { - res = [...res, sys.newLine, ...getPrettyOutput(getDiagnosticText(Diagnostics.default_Colon), defaultValueDescription, rightAlignOfLeft, leftAlignOfRight, terminalWidth, false), sys.newLine]; + res = [...res, sys.newLine, ...getPrettyOutput(getDiagnosticText(Diagnostics.default_Colon), defaultValueDescription, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ false), sys.newLine]; } res.push(sys.newLine); } @@ -322,7 +322,7 @@ namespace ts { output.push(" " + blue("tsc --noEmit" + sys.newLine)); output.push(" " + blue("tsc --target esnext" + sys.newLine)); output.push(" " + "Compiles the current project, with additional settings." + sys.newLine + sys.newLine); - output = [...output, ...generateSectionOptionsOutput("COMMON COMPILER OPTIONS", simpleOptions, false, undefined, formatMessage(undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; + output = [...output, ...generateSectionOptionsOutput("COMMON COMPILER OPTIONS", simpleOptions, /*subCategory*/ false, /* beforeOptionsDescription */ undefined, formatMessage(/*_dummy*/ undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; for (const line of output) { sys.write(line); } @@ -330,9 +330,9 @@ namespace ts { function printAllHelp(sys: System, compilerOptions: readonly CommandLineOption[], buildOptions: readonly CommandLineOption[], watchOptions: readonly CommandLineOption[]) { let output: string[] = [...getHelpHeader(sys)]; - output = [...output, ...generateSectionOptionsOutput("ALL COMPILER OPTIONS", compilerOptions, true, undefined, formatMessage(undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; - output = [...output, ...generateSectionOptionsOutput("WATCH OPTIONS", watchOptions, false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))]; - output = [...output, ...generateSectionOptionsOutput("BUILD OPTIONS", buildOptions, false, formatMessage(undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; + output = [...output, ...generateSectionOptionsOutput("ALL COMPILER OPTIONS", compilerOptions, /*subCategory*/ true, /* beforeOptionsDescription */ undefined, formatMessage(/*_dummy*/ undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; + output = [...output, ...generateSectionOptionsOutput("WATCH OPTIONS", watchOptions, /*subCategory*/ false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))]; + output = [...output, ...generateSectionOptionsOutput("BUILD OPTIONS", buildOptions, /*subCategory*/ false, formatMessage(/*_dummy*/ undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; for (const line of output) { sys.write(line); } @@ -340,7 +340,7 @@ namespace ts { function printBuildHelp(sys: System, buildOptions: readonly CommandLineOption[]) { let output: string[] = [...getHelpHeader(sys)]; - output = [...output, ...generateSectionOptionsOutput("BUILD OPTIONS", buildOptions, false, formatMessage(undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; + output = [...output, ...generateSectionOptionsOutput("BUILD OPTIONS", buildOptions, /*subCategory*/ false, formatMessage(/*_dummy*/ undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; for (const line of output) { sys.write(line); } From 33baa846b62e4491f2916fd20fa26d25022fd087 Mon Sep 17 00:00:00 2001 From: Orta Date: Fri, 28 May 2021 08:16:41 +0100 Subject: [PATCH 10/21] Improvements to the UX --- src/compiler/commandLineParser.ts | 13 +-- src/compiler/diagnosticMessages.json | 32 +++---- src/executeCommandLine/executeCommandLine.ts | 88 +++++++++++--------- 3 files changed, 66 insertions(+), 67 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 9beb915e0bc39..3614b07b11dbe 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -192,7 +192,6 @@ namespace ts { { name: "preserveWatchOutput", type: "boolean", - showInSimplifiedHelpView: false, category: Diagnostics.Command_line_Options, description: Diagnostics.Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen, defaultValueDescription: "n/a" @@ -362,6 +361,7 @@ namespace ts { { name: "showConfig", type: "boolean", + showInSimplifiedHelpView: true, category: Diagnostics.Command_line_Options, isCommandLineOnly: true, description: Diagnostics.Print_the_final_configuration_instead_of_building @@ -622,7 +622,6 @@ namespace ts { type: "boolean", affectsSemanticDiagnostics: true, strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Strict_Type_Checking_Options, description: Diagnostics.Enable_strict_checking_of_function_types, defaultValueDescription: Diagnostics.false_unless_strict_is_set @@ -631,7 +630,6 @@ namespace ts { name: "strictBindCallApply", type: "boolean", strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Strict_Type_Checking_Options, description: Diagnostics.Enable_strict_bind_call_and_apply_methods_on_functions, defaultValueDescription: Diagnostics.false_unless_strict_is_set @@ -641,7 +639,6 @@ namespace ts { type: "boolean", affectsSemanticDiagnostics: true, strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Strict_Type_Checking_Options, description: Diagnostics.Enable_strict_checking_of_property_initialization_in_classes, defaultValueDescription: Diagnostics.false_unless_strict_is_set @@ -661,7 +658,6 @@ namespace ts { type: "boolean", affectsSourceFile: true, strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Strict_Type_Checking_Options, description: Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file, defaultValueDescription: Diagnostics.false_unless_strict_is_set @@ -672,7 +668,6 @@ namespace ts { name: "noUnusedLocals", type: "boolean", affectsSemanticDiagnostics: true, - showInSimplifiedHelpView: true, category: Diagnostics.Additional_Checks, description: Diagnostics.Report_errors_on_unused_locals, defaultValueDescription: "false" @@ -681,7 +676,6 @@ namespace ts { name: "noUnusedParameters", type: "boolean", affectsSemanticDiagnostics: true, - showInSimplifiedHelpView: true, category: Diagnostics.Additional_Checks, description: Diagnostics.Report_errors_on_unused_parameters, defaultValueDescription: "false" @@ -690,7 +684,6 @@ namespace ts { name: "noImplicitReturns", type: "boolean", affectsSemanticDiagnostics: true, - showInSimplifiedHelpView: true, category: Diagnostics.Additional_Checks, description: Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value, defaultValueDescription: "false" @@ -700,7 +693,6 @@ namespace ts { type: "boolean", affectsBindDiagnostics: true, affectsSemanticDiagnostics: true, - showInSimplifiedHelpView: true, category: Diagnostics.Additional_Checks, description: Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement, defaultValueDescription: "false" @@ -709,7 +701,6 @@ namespace ts { name: "noUncheckedIndexedAccess", type: "boolean", affectsSemanticDiagnostics: true, - showInSimplifiedHelpView: false, category: Diagnostics.Additional_Checks, description: Diagnostics.Include_undefined_in_index_signature_results }, @@ -717,14 +708,12 @@ namespace ts { name: "noImplicitOverride", type: "boolean", affectsSemanticDiagnostics: true, - showInSimplifiedHelpView: false, category: Diagnostics.Additional_Checks, description: Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier }, { name: "noPropertyAccessFromIndexSignature", type: "boolean", - showInSimplifiedHelpView: false, category: Diagnostics.Additional_Checks, description: Diagnostics.Require_undeclared_properties_from_index_signatures_to_use_element_accesses, defaultValueDescription: "false" diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 5273c2a61e2c4..b2df6d41d42ae 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -5108,7 +5108,7 @@ "code": 6802 }, - "any of:": { + "one of:": { "category": "Message", "code": 6900 }, @@ -5116,57 +5116,61 @@ "category": "Message", "code": 6901 }, - "default:": { + "type:": { "category": "Message", "code": 6902 }, - "module === \"system\" or esModuleInterop": { + "default:": { "category": "Message", "code": 6903 }, - "`false`, unless `strict` is set": { + "module === \"system\" or esModuleInterop": { "category": "Message", "code": 6904 }, - "`false`, unless `composite` is set": { + "`false`, unless `strict` is set": { "category": "Message", "code": 6905 }, - "`[\"node_modules\", \"bower_components\", \"jspm_packages\"]`, plus the value of `outDir` if one is specified.": { + "`false`, unless `composite` is set": { "category": "Message", "code": 6906 }, - "`[]` if `files` is specified, otherwise `[\"**/*\"]`": { + "`[\"node_modules\", \"bower_components\", \"jspm_packages\"]`, plus the value of `outDir` if one is specified.": { "category": "Message", "code": 6907 }, - "`true` if `composite`, `false` otherwise": { + "`[]` if `files` is specified, otherwise `[\"**/*\"]`": { "category": "Message", "code": 6908 }, - "module === `AMD` or `UMD` or `System` or `ES6`, then `Classic`, Otherwise `Node`": { + "`true` if `composite`, `false` otherwise": { "category": "Message", "code": 6909 }, + "module === `AMD` or `UMD` or `System` or `ES6`, then `Classic`, Otherwise `Node`": { + "category": "Message", + "code": 69010 + }, "Computed from the list of input files": { "category": "Message", - "code": 6910 + "code": 6911 }, "Platform specific": { "category": "Message", - "code": 6911 + "code": 6912 }, "You can learn about all of the compiler options at {0}": { "category": "Message", - "code": 6912 + "code": 6913 }, "Including --watch, -w will start watching the current project for the file changes. Once set, you can config watch mode with:": { "category": "Message", - "code": 6913 + "code": 6914 }, "Using --build, -b will make tsc behave more like a build orchestrator than a compiler. This is used to trigger building composite projects which you can learn more about at {0}": { "category": "Message", - "code": 6914 + "code": 6915 }, diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 1a1849c77013b..ef0b0363475fc 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -110,59 +110,68 @@ namespace ts { } function generateOptionOutput(option: CommandLineOption, rightAlignOfLeft: number, leftAlignOfRight: number) { - interface ValueCandidate{ + interface ValueCandidate { // "one or more" or "any of" valueType: string; - possiableValues: string; + possibleValues: string; } - let res: string[] = []; + const text: string[] = []; // name and description const name = getDisplayNameTextOfOption(option); - // value type and possiable value + // value type and possible value const valueCandidates = getValueCandidate(option); const defaultValueDescription = typeof option.defaultValueDescription === "object" ? getDiagnosticText(option.defaultValueDescription) : option.defaultValueDescription; const terminalWidth = sys.getWidthOfTerminal(); // terminal does not have enough width if (terminalWidth < leftAlignOfRight + 20) { - res.push(blue(name)); + text.push(blue(name), ": "); if (option.description) { const description = getDiagnosticText(option.description); - res.push(description); + text.push(description); } - if (isAdditionalInfoOutput(valueCandidates, option.defaultValueDescription)) { + text.push(sys.newLine); + if (showAdditionalInfoOutput(valueCandidates, option.defaultValueDescription)) { if (valueCandidates) { - res.push(` ${valueCandidates.valueType}: ${valueCandidates.possiableValues}`); + const leftPad = Math.max(name.length + 1 - valueCandidates.valueType.length, 2); + text.push(padLeft("", leftPad), `${valueCandidates.valueType} ${valueCandidates.possibleValues}`); } if (defaultValueDescription) { - res.push(` ${getDiagnosticText(Diagnostics.default_Colon)} ${defaultValueDescription}`); + if(valueCandidates) text.push(sys.newLine); + const diagType = getDiagnosticText(Diagnostics.default_Colon); + const leftPad = Math.max(name.length + 1 - diagType.length, 2); + text.push(padLeft("", leftPad), `${diagType} ${defaultValueDescription}`); } - res.push(sys.newLine); + + text.push(sys.newLine); } + text.push(sys.newLine); } else { let description = ""; if (option.description) { description = getDiagnosticText(option.description); } - res = [...res, ...getPrettyOutput(name, description, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ true), sys.newLine]; - if (isAdditionalInfoOutput(valueCandidates, option.defaultValueDescription)) { + text.push(...getPrettyOutput(name, description, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ true), sys.newLine); + if (showAdditionalInfoOutput(valueCandidates, option.defaultValueDescription)) { if (valueCandidates) { - res = [...res, sys.newLine, ...getPrettyOutput(valueCandidates.valueType, valueCandidates.possiableValues, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ false), sys.newLine]; + text.push(...getPrettyOutput(valueCandidates.valueType, valueCandidates.possibleValues, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ false), sys.newLine); } if (defaultValueDescription) { - res = [...res, sys.newLine, ...getPrettyOutput(getDiagnosticText(Diagnostics.default_Colon), defaultValueDescription, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ false), sys.newLine]; + text.push(...getPrettyOutput(getDiagnosticText(Diagnostics.default_Colon), defaultValueDescription, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ false), sys.newLine); } - res.push(sys.newLine); + text.push(sys.newLine); } } - return res; + return text; - function isAdditionalInfoOutput(valueCandidates: ValueCandidate | undefined, defaultValueDescription: string | DiagnosticMessage | undefined): boolean { - if(valueCandidates?.possiableValues === "boolean" && (defaultValueDescription === undefined|| defaultValueDescription === "false" || defaultValueDescription === "undefined" || defaultValueDescription === "n/a")){ + function showAdditionalInfoOutput(valueCandidates: ValueCandidate | undefined, defaultValueDescription: string | DiagnosticMessage | undefined): boolean { + const ignoreValues = ["string"]; + const ignoredDescriptions = [undefined, "false", "n/a"]; + if (contains(ignoreValues, valueCandidates?.possibleValues) && contains(ignoredDescriptions, defaultValueDescription)) { return false; } return true; @@ -205,46 +214,43 @@ namespace ts { return { valueType: getValueType(option), - possiableValues: getPossiableValues(option) + possibleValues: getPossibleValues(option) }; function getValueType(option: CommandLineOption) { - let valueType: string; switch (option.type) { + case "string": + case "number": + case "boolean": + return getDiagnosticText(Diagnostics.type_Colon); case "list": - valueType = getDiagnosticText(Diagnostics.one_or_more_Colon); - break; + return getDiagnosticText(Diagnostics.one_or_more_Colon); default: - valueType = getDiagnosticText(Diagnostics.any_of_Colon); + return getDiagnosticText(Diagnostics.one_of_Colon); } - return valueType; } - function getPossiableValues(option: CommandLineOption) { - let possiableValues: string; + function getPossibleValues(option: CommandLineOption) { + let possibleValues: string; switch (option.type) { case "string": - possiableValues = "string"; - break; case "number": - possiableValues = "number"; - break; case "boolean": - possiableValues = "boolean"; + possibleValues = option.type; break; case "list": - // TODO: check inifinate loop - possiableValues = getPossiableValues(option.element); + // TODO: check infinite loop + possibleValues = getPossibleValues(option.element); break; case "object": - possiableValues = ""; + possibleValues = ""; break; default: // ESMap const keys = arrayFrom(option.type.keys()); - possiableValues = keys.join(", "); + possibleValues = keys.join(", "); } - return possiableValues; + return possibleValues; } } } @@ -262,16 +268,16 @@ namespace ts { const rightAlignOfLeftPart = maxLength + 2; // assume 2 space between left and right part const leftAlignOfRightPart = rightAlignOfLeftPart + 2; - let res: string[] = []; + let lines: string[] = []; for (const option of optionsList) { const tmp = generateOptionOutput(option, rightAlignOfLeftPart, leftAlignOfRightPart); - res = [...res, ...tmp]; + lines = [...lines, ...tmp]; } // make sure always a blank line in the end. - if (res[res.length - 2] !== sys.newLine) { - res.push(sys.newLine); + if (lines[lines.length - 2] !== sys.newLine) { + lines.push(sys.newLine); } - return res; + return lines; } function generateSectionOptionsOutput(sectionName: string, options: readonly CommandLineOption[], subCategory: boolean, beforeOptionsDescription?: string, afterOptionsDescription?: string) { From 970f86eeb3c0b9e997c2fed4e9706f322a4655d4 Mon Sep 17 00:00:00 2001 From: Orta Date: Fri, 28 May 2021 14:05:16 +0100 Subject: [PATCH 11/21] Fix tests --- src/executeCommandLine/executeCommandLine.ts | 11 +- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 207 ++++++++---------- 2 files changed, 98 insertions(+), 120 deletions(-) diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index ef0b0363475fc..aaa967c8b3af8 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -180,9 +180,11 @@ namespace ts { function getPrettyOutput(left: string, right: string, rightAlignOfLeft: number, leftAlignOfRight: number, terminalWidth: number, colorLeft: boolean) { const res = []; let isFirstLine = true; - let reaminRight = right; + let remainRight = right; const rightCharacterNumber = terminalWidth - leftAlignOfRight; - while (reaminRight.length !== 0) { + while (remainRight.length > 0) { + // @ts-ignore + console.log(remainRight.length); let curLeft = ""; if (isFirstLine) { curLeft = padLeft(left, rightAlignOfLeft); @@ -192,8 +194,9 @@ namespace ts { else { curLeft = padLeft("", leftAlignOfRight); } - const curRight = reaminRight.substr(0, rightCharacterNumber); - reaminRight = reaminRight.slice(rightCharacterNumber); + + const curRight = remainRight.substr(0, rightCharacterNumber); + remainRight = remainRight.slice(rightCharacterNumber); res.push(`${curLeft}${curRight}`); isFirstLine = false; } diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 97d12d54b275c..2d9bb4205ce38 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -33,122 +33,97 @@ tsc: The Typescript Compiler - Version FakeTSVersion  tsc --target esnext  Compiles the current project, with additional settings. -COMMON COMPILER OPTIONS - - --help, -h Print this message. - --watch, -w Watch input files. - --pretty Stylize errors and messages using color and context (experimental). - - any of: boolean - - default: true - - --all Show all compiler options. - --version, -v Print the compiler's version. - --init Initializes a TypeScript project and creates a tsconfig.json file. - --project, -p Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. - - any of: string - - --build, -b Build one or more projects and their dependencies, if out of date - --target, -t Specify ECMAScript target version. - - any of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext - - default: ES3 - - --module, -m Specify module code generation. - - any of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext - - --lib Specify library files to be included in the compilation. - - one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es20 15.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sha redmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019 .string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, esnext. array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref - - --allowJs Allow javascript files to be compiled. - --jsx Specify JSX code generation. - - any of: preserve, react-native, react, react-jsx, react-jsxdev - - default: undefined - - --declaration, -d Generates corresponding '.d.ts' file. - - any of: boolean - - default: `false`, unless `composite` is set - - --declarationMap Generates a sourcemap for each corresponding '.d.ts' file. - --sourceMap Generates corresponding '.map' file. - --outFile Concatenate and emit output to single file. - - any of: string - - default: n/a - - --outDir Redirect output structure to the directory. - - any of: string - - default: n/a - - --removeComments Do not emit comments to output. - --noEmit Do not emit outputs. - --strict Enable all strict type-checking options. - --noImplicitAny Raise error on expressions and declarations with an implied 'any' type. - - any of: boolean - - default: `false`, unless `strict` is set - - --strictNullChecks Enable strict null checks. - - any of: boolean - - default: `false`, unless `strict` is set - - --strictFunctionTypes Enable strict checking of function types. - - any of: boolean - - default: `false`, unless `strict` is set - - --strictBindCallApply Enable strict 'bind', 'call', and 'apply' methods on functions. - - any of: boolean - - default: `false`, unless `strict` is set - - --strictPropertyInitialization Enable strict checking of property initialization in classes. - - any of: boolean - - default: `false`, unless `strict` is set - - --noImplicitThis Raise error on 'this' expressions with an implied 'any' type. - - any of: boolean - - default: `false`, unless `strict` is set - - --alwaysStrict Parse in strict mode and emit "use strict" for each source file. - - any of: boolean - - default: `false`, unless `strict` is set - - --noUnusedLocals Report errors on unused locals. - --noUnusedParameters Report errors on unused parameters. - --noImplicitReturns Report error when not all code paths in function return a value. - --noFallthroughCasesInSwitch Report errors for fallthrough cases in switch statement. - --types Type declaration files to be included in compilation. - - one or more: string - - --esModuleInterop Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. - -You can learn about all of the compiler options at https://aka.ms/tsconfig-reference - +COMMON COMPILER OPTIONS + + --help, -h Print this message. + type: boolean + + --watch, -w Watch input files. + type: boolean + + --pretty Stylize errors and messages using color and context (experimental). + type: boolean + default: true + + --all Show all compiler options. + type: boolean + + --version, -v Print the compiler's version. + type: boolean + + --init Initializes a TypeScript project and creates a tsconfig.json file. + type: boolean + + --project, -p Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. + --build, -b Build one or more projects and their dependencies, if out of date + type: boolean + + --showConfig Print the final configuration instead of building. + type: boolean + + --target, -t Specify ECMAScript target version. + one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext + default: ES3 + + --module, -m Specify module code generation. + one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext + + --lib Specify library files to be included in the compilation. + one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciter able, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es 2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref + + --allowJs Allow javascript files to be compiled. + type: boolean + default: false + + --jsx Specify JSX code generation. + one of: preserve, react-native, react, react-jsx, react-jsxdev + default: undefined + + --declaration, -d Generates corresponding '.d.ts' file. + type: boolean + default: `false`, unless `composite` is set + + --declarationMap Generates a sourcemap for each corresponding '.d.ts' file. + type: boolean + default: false + + --sourceMap Generates corresponding '.map' file. + type: boolean + default: false + + --outFile Concatenate and emit output to single file. + --outDir Redirect output structure to the directory. + --removeComments Do not emit comments to output. + type: boolean + default: false + + --noEmit Do not emit outputs. + type: boolean + default: false + + --strict Enable all strict type-checking options. + type: boolean + default: false + + --noImplicitAny Raise error on expressions and declarations with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set + + --strictNullChecks Enable strict null checks. + type: boolean + default: `false`, unless `strict` is set + + --noImplicitThis Raise error on 'this' expressions with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set + + --types Type declaration files to be included in compilation. + --esModuleInterop Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. + type: boolean + default: false + +You can learn about all of the compiler options at https://aka.ms/tsconfig-reference + exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped From dd2736712d9f6830f860543bb6780396f6eabb4f Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Thu, 3 Jun 2021 16:24:11 +0800 Subject: [PATCH 12/21] fix test. --- src/executeCommandLine/executeCommandLine.ts | 38 ++-- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 186 +++++++++--------- 2 files changed, 113 insertions(+), 111 deletions(-) diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index aaa967c8b3af8..47f96d476315a 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -126,8 +126,24 @@ namespace ts { const defaultValueDescription = typeof option.defaultValueDescription === "object" ? getDiagnosticText(option.defaultValueDescription) : option.defaultValueDescription; const terminalWidth = sys.getWidthOfTerminal(); - // terminal does not have enough width - if (terminalWidth < leftAlignOfRight + 20) { + // Note: child_process might return `terminalWidth` as undefined. + if (terminalWidth >= leftAlignOfRight + 20) { + let description = ""; + if (option.description) { + description = getDiagnosticText(option.description); + } + text.push(...getPrettyOutput(name, description, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ true), sys.newLine); + if (showAdditionalInfoOutput(valueCandidates, option.defaultValueDescription)) { + if (valueCandidates) { + text.push(...getPrettyOutput(valueCandidates.valueType, valueCandidates.possibleValues, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ false), sys.newLine); + } + if (defaultValueDescription) { + text.push(...getPrettyOutput(getDiagnosticText(Diagnostics.default_Colon), defaultValueDescription, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ false), sys.newLine); + } + text.push(sys.newLine); + } + } + else { text.push(blue(name), ": "); if (option.description) { const description = getDiagnosticText(option.description); @@ -150,22 +166,6 @@ namespace ts { } text.push(sys.newLine); } - else { - let description = ""; - if (option.description) { - description = getDiagnosticText(option.description); - } - text.push(...getPrettyOutput(name, description, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ true), sys.newLine); - if (showAdditionalInfoOutput(valueCandidates, option.defaultValueDescription)) { - if (valueCandidates) { - text.push(...getPrettyOutput(valueCandidates.valueType, valueCandidates.possibleValues, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ false), sys.newLine); - } - if (defaultValueDescription) { - text.push(...getPrettyOutput(getDiagnosticText(Diagnostics.default_Colon), defaultValueDescription, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ false), sys.newLine); - } - text.push(sys.newLine); - } - } return text; function showAdditionalInfoOutput(valueCandidates: ValueCandidate | undefined, defaultValueDescription: string | DiagnosticMessage | undefined): boolean { @@ -183,8 +183,6 @@ namespace ts { let remainRight = right; const rightCharacterNumber = terminalWidth - leftAlignOfRight; while (remainRight.length > 0) { - // @ts-ignore - console.log(remainRight.length); let curLeft = ""; if (isFirstLine) { curLeft = padLeft(left, rightAlignOfLeft); diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 2d9bb4205ce38..8b0c0e0214f70 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -33,97 +33,101 @@ tsc: The Typescript Compiler - Version FakeTSVersion  tsc --target esnext  Compiles the current project, with additional settings. -COMMON COMPILER OPTIONS - - --help, -h Print this message. - type: boolean - - --watch, -w Watch input files. - type: boolean - - --pretty Stylize errors and messages using color and context (experimental). - type: boolean - default: true - - --all Show all compiler options. - type: boolean - - --version, -v Print the compiler's version. - type: boolean - - --init Initializes a TypeScript project and creates a tsconfig.json file. - type: boolean - - --project, -p Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. - --build, -b Build one or more projects and their dependencies, if out of date - type: boolean - - --showConfig Print the final configuration instead of building. - type: boolean - - --target, -t Specify ECMAScript target version. - one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext - default: ES3 - - --module, -m Specify module code generation. - one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext - - --lib Specify library files to be included in the compilation. - one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciter able, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es 2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref - - --allowJs Allow javascript files to be compiled. - type: boolean - default: false - - --jsx Specify JSX code generation. - one of: preserve, react-native, react, react-jsx, react-jsxdev - default: undefined - - --declaration, -d Generates corresponding '.d.ts' file. - type: boolean - default: `false`, unless `composite` is set - - --declarationMap Generates a sourcemap for each corresponding '.d.ts' file. - type: boolean - default: false - - --sourceMap Generates corresponding '.map' file. - type: boolean - default: false - - --outFile Concatenate and emit output to single file. - --outDir Redirect output structure to the directory. - --removeComments Do not emit comments to output. - type: boolean - default: false - - --noEmit Do not emit outputs. - type: boolean - default: false - - --strict Enable all strict type-checking options. - type: boolean - default: false - - --noImplicitAny Raise error on expressions and declarations with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set - - --strictNullChecks Enable strict null checks. - type: boolean - default: `false`, unless `strict` is set - - --noImplicitThis Raise error on 'this' expressions with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set - - --types Type declaration files to be included in compilation. - --esModuleInterop Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. - type: boolean - default: false - -You can learn about all of the compiler options at https://aka.ms/tsconfig-reference - +COMMON COMPILER OPTIONS + +--help, -h: Print this message. + type: boolean + +--watch, -w: Watch input files. + type: boolean + +--pretty: Stylize errors and messages using color and context (experimental). + type: boolean + default: true + +--all: Show all compiler options. + type: boolean + +--version, -v: Print the compiler's version. + type: boolean + +--init: Initializes a TypeScript project and creates a tsconfig.json file. + type: boolean + +--project, -p: Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. + +--build, -b: Build one or more projects and their dependencies, if out of date + type: boolean + +--showConfig: Print the final configuration instead of building. + type: boolean + +--target, -t: Specify ECMAScript target version. + one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext + default: ES3 + +--module, -m: Specify module code generation. + one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext + +--lib: Specify library files to be included in the compilation. + one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref + +--allowJs: Allow javascript files to be compiled. + type: boolean + default: false + +--jsx: Specify JSX code generation. + one of: preserve, react-native, react, react-jsx, react-jsxdev + default: undefined + +--declaration, -d: Generates corresponding '.d.ts' file. + type: boolean + default: `false`, unless `composite` is set + +--declarationMap: Generates a sourcemap for each corresponding '.d.ts' file. + type: boolean + default: false + +--sourceMap: Generates corresponding '.map' file. + type: boolean + default: false + +--outFile: Concatenate and emit output to single file. + +--outDir: Redirect output structure to the directory. + +--removeComments: Do not emit comments to output. + type: boolean + default: false + +--noEmit: Do not emit outputs. + type: boolean + default: false + +--strict: Enable all strict type-checking options. + type: boolean + default: false + +--noImplicitAny: Raise error on expressions and declarations with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set + +--strictNullChecks: Enable strict null checks. + type: boolean + default: `false`, unless `strict` is set + +--noImplicitThis: Raise error on 'this' expressions with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set + +--types: Type declaration files to be included in compilation. + +--esModuleInterop: Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. + type: boolean + default: false + +You can learn about all of the compiler options at https://aka.ms/tsconfig-reference + exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped From b2045e34d4312369a0009764d4845685676268dd Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Thu, 3 Jun 2021 17:07:49 +0800 Subject: [PATCH 13/21] add missing help out. --- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 54a4c6ca07f75..d1e0ec1e90fb4 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -1,11 +1,11 @@ -Input:: +Input:: //// [/lib/lib.d.ts] - - -Output:: -/lib/tsc + + +Output:: +/lib/tsc Version FakeTSVersion tsc: The Typescript Compiler - Version FakeTSVersion @@ -116,6 +116,9 @@ tsc: The Typescript Compiler - Version FakeTSVersion type: boolean default: `false`, unless `strict` is set +--strictOptionalProperties: Enable strict checking of optional properties. + type: boolean + --noImplicitThis: Raise error on 'this' expressions with an implied 'any' type. type: boolean default: `false`, unless `strict` is set @@ -128,6 +131,6 @@ tsc: The Typescript Compiler - Version FakeTSVersion You can learn about all of the compiler options at https://aka.ms/tsconfig-reference -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped - - +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + From ae87113f660b4a1b8b74c77da42d116e265cf0b5 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Thu, 3 Jun 2021 21:11:06 +0800 Subject: [PATCH 14/21] use environemnt variable to control test case. --- src/executeCommandLine/executeCommandLine.ts | 22 +-- src/harness/fakesHosts.ts | 3 +- src/testRunner/unittests/tsc/helpers.ts | 8 +- .../unittests/tsc/runWithoutArgs.ts | 3 +- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 140 +++++++++--------- 5 files changed, 88 insertions(+), 88 deletions(-) diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 47f96d476315a..6d3f6c3ac0854 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -109,7 +109,7 @@ namespace ts { return `--${option.name}${option.shortName ? `, -${option.shortName}` : ""}`; } - function generateOptionOutput(option: CommandLineOption, rightAlignOfLeft: number, leftAlignOfRight: number) { + function generateOptionOutput(sys: System,option: CommandLineOption, rightAlignOfLeft: number, leftAlignOfRight: number) { interface ValueCandidate { // "one or more" or "any of" valueType: string; @@ -256,7 +256,7 @@ namespace ts { } } - function generateGroupOptionOutput(optionsList: readonly CommandLineOption[]) { + function generateGroupOptionOutput(sys: System,optionsList: readonly CommandLineOption[]) { let maxLength = 0; for (const option of optionsList) { const curLength = getDisplayNameTextOfOption(option).length; @@ -271,7 +271,7 @@ namespace ts { const leftAlignOfRightPart = rightAlignOfLeftPart + 2; let lines: string[] = []; for (const option of optionsList) { - const tmp = generateOptionOutput(option, rightAlignOfLeftPart, leftAlignOfRightPart); + const tmp = generateOptionOutput(sys, option, rightAlignOfLeftPart, leftAlignOfRightPart); lines = [...lines, ...tmp]; } // make sure always a blank line in the end. @@ -281,14 +281,14 @@ namespace ts { return lines; } - function generateSectionOptionsOutput(sectionName: string, options: readonly CommandLineOption[], subCategory: boolean, beforeOptionsDescription?: string, afterOptionsDescription?: string) { + function generateSectionOptionsOutput(sys: System, sectionName: string, options: readonly CommandLineOption[], subCategory: boolean, beforeOptionsDescription?: string, afterOptionsDescription?: string) { let res: string[] = []; res.push(bold(sectionName) + sys.newLine + sys.newLine); if (beforeOptionsDescription) { res.push(beforeOptionsDescription + sys.newLine + sys.newLine); } if (!subCategory) { - res = [...res, ...generateGroupOptionOutput(options)]; + res = [...res, ...generateGroupOptionOutput(sys, options)]; if (afterOptionsDescription) { res.push(afterOptionsDescription + sys.newLine + sys.newLine); } @@ -303,7 +303,7 @@ namespace ts { } categoryMap.forEach((value, key) => { res.push(`### ${key}${sys.newLine}${sys.newLine}`); - res = [...res, ...generateGroupOptionOutput(value)]; + res = [...res, ...generateGroupOptionOutput(sys, value)]; }); if (afterOptionsDescription) { res.push(afterOptionsDescription + sys.newLine + sys.newLine); @@ -329,7 +329,7 @@ namespace ts { output.push(" " + blue("tsc --noEmit" + sys.newLine)); output.push(" " + blue("tsc --target esnext" + sys.newLine)); output.push(" " + "Compiles the current project, with additional settings." + sys.newLine + sys.newLine); - output = [...output, ...generateSectionOptionsOutput("COMMON COMPILER OPTIONS", simpleOptions, /*subCategory*/ false, /* beforeOptionsDescription */ undefined, formatMessage(/*_dummy*/ undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; + output = [...output, ...generateSectionOptionsOutput(sys, "COMMON COMPILER OPTIONS", simpleOptions, /*subCategory*/ false, /* beforeOptionsDescription */ undefined, formatMessage(/*_dummy*/ undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; for (const line of output) { sys.write(line); } @@ -337,9 +337,9 @@ namespace ts { function printAllHelp(sys: System, compilerOptions: readonly CommandLineOption[], buildOptions: readonly CommandLineOption[], watchOptions: readonly CommandLineOption[]) { let output: string[] = [...getHelpHeader(sys)]; - output = [...output, ...generateSectionOptionsOutput("ALL COMPILER OPTIONS", compilerOptions, /*subCategory*/ true, /* beforeOptionsDescription */ undefined, formatMessage(/*_dummy*/ undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; - output = [...output, ...generateSectionOptionsOutput("WATCH OPTIONS", watchOptions, /*subCategory*/ false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))]; - output = [...output, ...generateSectionOptionsOutput("BUILD OPTIONS", buildOptions, /*subCategory*/ false, formatMessage(/*_dummy*/ undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; + output = [...output, ...generateSectionOptionsOutput(sys, "ALL COMPILER OPTIONS", compilerOptions, /*subCategory*/ true, /* beforeOptionsDescription */ undefined, formatMessage(/*_dummy*/ undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; + output = [...output, ...generateSectionOptionsOutput(sys, "WATCH OPTIONS", watchOptions, /*subCategory*/ false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))]; + output = [...output, ...generateSectionOptionsOutput(sys, "BUILD OPTIONS", buildOptions, /*subCategory*/ false, formatMessage(/*_dummy*/ undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; for (const line of output) { sys.write(line); } @@ -347,7 +347,7 @@ namespace ts { function printBuildHelp(sys: System, buildOptions: readonly CommandLineOption[]) { let output: string[] = [...getHelpHeader(sys)]; - output = [...output, ...generateSectionOptionsOutput("BUILD OPTIONS", buildOptions, /*subCategory*/ false, formatMessage(/*_dummy*/ undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; + output = [...output, ...generateSectionOptionsOutput(sys, "BUILD OPTIONS", buildOptions, /*subCategory*/ false, formatMessage(/*_dummy*/ undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; for (const line of output) { sys.write(line); } diff --git a/src/harness/fakesHosts.ts b/src/harness/fakesHosts.ts index 5de4859db6c0f..987a22904e226 100644 --- a/src/harness/fakesHosts.ts +++ b/src/harness/fakesHosts.ts @@ -33,7 +33,8 @@ namespace fakes { } getWidthOfTerminal(): number { - return 0; + const testTerminalWidth = Number.parseInt(this.getEnvironmentVariable("TS_TEST_TERMINAL_WIDTH")); + return Number.isNaN(testTerminalWidth) ? 0 : testTerminalWidth; } // Pretty output diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index 11cae1cfbd8c1..14c4bc0df5127 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -10,7 +10,7 @@ namespace ts { IncrementalDtsChange = "incremental-declaration-changes", IncrementalDtsUnchanged = "incremental-declaration-doesnt-change", IncrementalHeadersChange = "incremental-headers-change-without-dts-changes", - NoChangeRun ="no-change-run" + NoChangeRun = "no-change-run" } export const noChangeRun: TscIncremental = { @@ -32,6 +32,7 @@ namespace ts { baselinePrograms?: boolean; baselineDependencies?: boolean; disableUseFileVersionAsSignature?: boolean; + environmentVariables?: Record; } export type CommandLineProgram = [Program, EmitAndSemanticDiagnosticsBuilderProgram?]; @@ -77,14 +78,15 @@ namespace ts { const { scenario, subScenario, buildKind, commandLineArgs, modifyFs, - baselineSourceMap, baselineReadFileCalls, baselinePrograms, baselineDependencies + baselineSourceMap, baselineReadFileCalls, baselinePrograms, baselineDependencies, + environmentVariables } = input; if (modifyFs) modifyFs(inputFs); inputFs.makeReadonly(); const fs = inputFs.shadow(); // Create system - const sys = new fakes.System(fs, { executingFilePath: "/lib/tsc" }) as TscCompileSystem; + const sys = new fakes.System(fs, { executingFilePath: "/lib/tsc", env: environmentVariables }) as TscCompileSystem; if (input.disableUseFileVersionAsSignature) sys.disableUseFileVersionAsSignature = true; fakes.patchHostForBuildInfoReadWrite(sys); const writtenFiles = sys.writtenFiles = new Set(); diff --git a/src/testRunner/unittests/tsc/runWithoutArgs.ts b/src/testRunner/unittests/tsc/runWithoutArgs.ts index ed53a16229490..d03468798d9e3 100644 --- a/src/testRunner/unittests/tsc/runWithoutArgs.ts +++ b/src/testRunner/unittests/tsc/runWithoutArgs.ts @@ -4,7 +4,8 @@ namespace ts { scenario: "runWithoutArgs", subScenario: "show help with ExitStatus.DiagnosticsPresent_OutputsSkipped", fs: () => loadProjectFromFiles({}), - commandLineArgs: [] + commandLineArgs: [], + environmentVariables: { TS_TEST_TERMINAL_WIDTH: "120" } }); }); } diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index d1e0ec1e90fb4..aea04fd608b5f 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -7,8 +7,8 @@ Input:: Output:: /lib/tsc Version FakeTSVersion -tsc: The Typescript Compiler - Version FakeTSVersion - +tsc: The Typescript Compiler - Version FakeTSVersion   +  TS  COMMON COMMANDS tsc @@ -35,99 +35,95 @@ tsc: The Typescript Compiler - Version FakeTSVersion COMMON COMPILER OPTIONS ---help, -h: Print this message. - type: boolean - ---watch, -w: Watch input files. - type: boolean - ---pretty: Stylize errors and messages using color and context (experimental). - type: boolean - default: true - ---all: Show all compiler options. - type: boolean - ---version, -v: Print the compiler's version. - type: boolean + --help, -h Print this message. + type: boolean ---init: Initializes a TypeScript project and creates a tsconfig.json file. - type: boolean + --watch, -w Watch input files. + type: boolean ---project, -p: Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. + --pretty Stylize errors and messages using color and context (experimental). + type: boolean + default: true ---build, -b: Build one or more projects and their dependencies, if out of date - type: boolean + --all Show all compiler options. + type: boolean ---showConfig: Print the final configuration instead of building. - type: boolean + --version, -v Print the compiler's version. + type: boolean ---target, -t: Specify ECMAScript target version. - one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext - default: ES3 + --init Initializes a TypeScript project and creates a tsconfig.json file. + type: boolean ---module, -m: Specify module code generation. - one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext + --project, -p Compile the project given the path to its configuration file, or to a folder with a 'tscon fig.json'. + --build, -b Build one or more projects and their dependencies, if out of date + type: boolean ---lib: Specify library files to be included in the compilation. - one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref + --showConfig Print the final configuration instead of building. + type: boolean ---allowJs: Allow javascript files to be compiled. - type: boolean - default: false + --target, -t Specify ECMAScript target version. + one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext + default: ES3 ---jsx: Specify JSX code generation. - one of: preserve, react-native, react, react-jsx, react-jsxdev - default: undefined + --module, -m Specify module code generation. + one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext ---declaration, -d: Generates corresponding '.d.ts' file. - type: boolean - default: `false`, unless `composite` is set + --lib Specify library files to be included in the compilation. + one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.it erable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, e s2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015. reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es20 17.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es 2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.objec t, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es202 0.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weak ref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext .string, esnext.promise, esnext.weakref ---declarationMap: Generates a sourcemap for each corresponding '.d.ts' file. - type: boolean - default: false + --allowJs Allow javascript files to be compiled. + type: boolean + default: false ---sourceMap: Generates corresponding '.map' file. - type: boolean - default: false + --jsx Specify JSX code generation. + one of: preserve, react-native, react, react-jsx, react-jsxdev + default: undefined ---outFile: Concatenate and emit output to single file. + --declaration, -d Generates corresponding '.d.ts' file. + type: boolean + default: `false`, unless `composite` is set ---outDir: Redirect output structure to the directory. + --declarationMap Generates a sourcemap for each corresponding '.d.ts' file. + type: boolean + default: false ---removeComments: Do not emit comments to output. - type: boolean - default: false + --sourceMap Generates corresponding '.map' file. + type: boolean + default: false ---noEmit: Do not emit outputs. - type: boolean - default: false + --outFile Concatenate and emit output to single file. + --outDir Redirect output structure to the directory. + --removeComments Do not emit comments to output. + type: boolean + default: false ---strict: Enable all strict type-checking options. - type: boolean - default: false + --noEmit Do not emit outputs. + type: boolean + default: false ---noImplicitAny: Raise error on expressions and declarations with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set + --strict Enable all strict type-checking options. + type: boolean + default: false ---strictNullChecks: Enable strict null checks. - type: boolean - default: `false`, unless `strict` is set + --noImplicitAny Raise error on expressions and declarations with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set ---strictOptionalProperties: Enable strict checking of optional properties. - type: boolean + --strictNullChecks Enable strict null checks. + type: boolean + default: `false`, unless `strict` is set ---noImplicitThis: Raise error on 'this' expressions with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set + --strictOptionalProperties Enable strict checking of optional properties. + type: boolean ---types: Type declaration files to be included in compilation. + --noImplicitThis Raise error on 'this' expressions with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set ---esModuleInterop: Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. - type: boolean - default: false + --types Type declaration files to be included in compilation. + --esModuleInterop Enables emit interoperability between CommonJS and ES Modules via creation of namespace ob jects for all imports. Implies 'allowSyntheticDefaultImports'. + type: boolean + default: false You can learn about all of the compiler options at https://aka.ms/tsconfig-reference From 11fd524e35cdebd080e56df338e4e797cc831af0 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Thu, 3 Jun 2021 22:59:01 +0800 Subject: [PATCH 15/21] fix merge issues. --- src/compiler/commandLineParser.ts | 2 +- .../tsconfig.json | 6 +- .../tsconfig.json | 204 +++++------ .../tsconfig.json | 198 +++++------ .../tsconfig.json | 198 +++++------ .../tsconfig.json | 208 +++++------ .../tsconfig.json | 198 +++++------ .../tsconfig.json | 198 +++++------ .../tsconfig.json | 198 +++++------ .../tsconfig.json | 198 +++++------ ...tatus.DiagnosticsPresent_OutputsSkipped.js | 163 +++++---- .../declarationDir-is-specified.js | 6 +- ...-outDir-and-declarationDir-is-specified.js | 276 +++++++-------- .../when-outDir-is-specified.js | 270 +++++++------- .../with-outFile.js | 334 +++++++++--------- ...e-is-specified-with-declaration-enabled.js | 276 +++++++-------- .../without-outDir-or-outFile-is-specified.js | 270 +++++++------- 17 files changed, 1617 insertions(+), 1586 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 19cf165cfb217..976e0fb0e09d4 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -440,7 +440,7 @@ namespace ts { paramType: Diagnostics.KIND, showInSimplifiedHelpView: true, category: Diagnostics.Language_and_Environment, - description: Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_react_react_jsx_or_react_jsxdev, + description: Diagnostics.Specify_JSX_code_generation, defaultValueDescription: "undefined" }, { diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index f26c204d28d9d..d38ec4f79ffac 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -11,9 +11,9 @@ // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version. */ // "lib": [], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ @@ -24,7 +24,7 @@ // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ /* Modules */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "module": "commonjs", /* Specify module code generation. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json index 9b6c844340b60..6c1d7bf11c45c 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -1,102 +1,102 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ - // "disableSolutionSearching": true, /* Projects */ - // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ - - /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ - // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ - // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ - // "noLib": true, /* Do not include the default library file (lib.d.ts). */ - // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ - - /* Modules */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ - // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ - - /* Emit */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ - // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ - // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ - // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ - "declarationDir": "lib", /* Output directory for generated declaration files. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ - // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ - "skipLibCheck": true, /* Skip type checking of declaration files. */ - - /* Output Formatting */ - "noErrorTruncation": true /* Do not truncate error messages. */ - } -} +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ + // "disableSolutionSearching": true, /* Projects */ + // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ + + /* Language and Environment */ + "target": "es5", /* Specify ECMAScript target version. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "jsx": "preserve", /* Specify JSX code generation. */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ + // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ + // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ + // "noLib": true, /* Do not include the default library file (lib.d.ts). */ + // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ + + /* Modules */ + "module": "commonjs", /* Specify module code generation. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ + // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ + + /* Emit */ + "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ + // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ + // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ + // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ + "declarationDir": "lib", /* Output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ + // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ + "skipLibCheck": true, /* Skip type checking of declaration files. */ + + /* Output Formatting */ + "noErrorTruncation": true /* Do not truncate error messages. */ + } +} diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index a1d33415b23fa..8a7a5c0fda720 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -1,99 +1,99 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ - // "disableSolutionSearching": true, /* Projects */ - // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ - - /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ - // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ - // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ - // "noLib": true, /* Do not include the default library file (lib.d.ts). */ - // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ - - /* Modules */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ - // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ - - /* Emit */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ - // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ - // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ - // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ - // "declarationDir": "./", /* Output directory for generated declaration files. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ - // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ - "skipLibCheck": true /* Skip type checking of declaration files. */ - } -} +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ + // "disableSolutionSearching": true, /* Projects */ + // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ + + /* Language and Environment */ + "target": "es5", /* Specify ECMAScript target version. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "jsx": "preserve", /* Specify JSX code generation. */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ + // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ + // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ + // "noLib": true, /* Do not include the default library file (lib.d.ts). */ + // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ + + /* Modules */ + "module": "commonjs", /* Specify module code generation. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ + // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ + + /* Emit */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ + // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ + // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ + // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ + // "declarationDir": "./", /* Output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ + // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ + } +} diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 183cb21ab8f84..a6f7e4d0c111f 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -1,99 +1,99 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ - // "disableSolutionSearching": true, /* Projects */ - // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ - - /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ - // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ - // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ - // "noLib": true, /* Do not include the default library file (lib.d.ts). */ - // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ - - /* Modules */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ - // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ - - /* Emit */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ - // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ - // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ - // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ - // "declarationDir": "./", /* Output directory for generated declaration files. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ - // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ - "skipLibCheck": true /* Skip type checking of declaration files. */ - } -} +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ + // "disableSolutionSearching": true, /* Projects */ + // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ + + /* Language and Environment */ + "target": "es5", /* Specify ECMAScript target version. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + "jsx": "react", /* Specify JSX code generation. */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ + // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ + // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ + // "noLib": true, /* Do not include the default library file (lib.d.ts). */ + // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ + + /* Modules */ + "module": "commonjs", /* Specify module code generation. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ + // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ + + /* Emit */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ + // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ + // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ + // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ + // "declarationDir": "./", /* Output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ + // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ + } +} diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index 93f53bd09cb76..a4a443c33cdb2 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -1,104 +1,104 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ - // "disableSolutionSearching": true, /* Projects */ - // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ - - /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ - // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ - // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ - // "noLib": true, /* Do not include the default library file (lib.d.ts). */ - // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ - - /* Modules */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ - // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ - - /* Emit */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ - // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ - // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ - // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ - // "declarationDir": "./", /* Output directory for generated declaration files. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ - // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ - "skipLibCheck": true /* Skip type checking of declaration files. */ - }, - "files": [ - "file0.st", - "file1.ts", - "file2.ts" - ] -} +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ + // "disableSolutionSearching": true, /* Projects */ + // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ + + /* Language and Environment */ + "target": "es5", /* Specify ECMAScript target version. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "jsx": "preserve", /* Specify JSX code generation. */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ + // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ + // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ + // "noLib": true, /* Do not include the default library file (lib.d.ts). */ + // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ + + /* Modules */ + "module": "commonjs", /* Specify module code generation. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ + // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ + + /* Emit */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ + // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ + // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ + // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ + // "declarationDir": "./", /* Output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ + // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ + }, + "files": [ + "file0.st", + "file1.ts", + "file2.ts" + ] +} diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index 6931f86d4f183..e8fb11d0cbcae 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -1,99 +1,99 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ - // "disableSolutionSearching": true, /* Projects */ - // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ - - /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "lib": ["es5","es2015.promise"], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ - // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ - // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ - // "noLib": true, /* Do not include the default library file (lib.d.ts). */ - // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ - - /* Modules */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ - // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ - - /* Emit */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ - // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ - // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ - // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ - // "declarationDir": "./", /* Output directory for generated declaration files. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ - // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ - "skipLibCheck": true /* Skip type checking of declaration files. */ - } -} +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ + // "disableSolutionSearching": true, /* Projects */ + // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ + + /* Language and Environment */ + "target": "es5", /* Specify ECMAScript target version. */ + "lib": ["es5","es2015.promise"], /* Specify library files to be included in the compilation. */ + // "jsx": "preserve", /* Specify JSX code generation. */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ + // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ + // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ + // "noLib": true, /* Do not include the default library file (lib.d.ts). */ + // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ + + /* Modules */ + "module": "commonjs", /* Specify module code generation. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ + // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ + + /* Emit */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ + // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ + // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ + // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ + // "declarationDir": "./", /* Output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ + // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ + } +} diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index be2e06952f2d2..d38ec4f79ffac 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -1,99 +1,99 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ - // "disableSolutionSearching": true, /* Projects */ - // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ - - /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ - // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ - // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ - // "noLib": true, /* Do not include the default library file (lib.d.ts). */ - // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ - - /* Modules */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ - // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ - - /* Emit */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ - // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ - // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ - // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ - // "declarationDir": "./", /* Output directory for generated declaration files. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ - // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ - "skipLibCheck": true /* Skip type checking of declaration files. */ - } -} +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ + // "disableSolutionSearching": true, /* Projects */ + // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ + + /* Language and Environment */ + "target": "es5", /* Specify ECMAScript target version. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "jsx": "preserve", /* Specify JSX code generation. */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ + // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ + // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ + // "noLib": true, /* Do not include the default library file (lib.d.ts). */ + // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ + + /* Modules */ + "module": "commonjs", /* Specify module code generation. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ + // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ + + /* Emit */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ + // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ + // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ + // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ + // "declarationDir": "./", /* Output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ + // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ + } +} diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index 2988d197298cd..040e8246d9c14 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -1,99 +1,99 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ - // "disableSolutionSearching": true, /* Projects */ - // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ - - /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "lib": ["es5","es2015.core"], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ - // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ - // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ - // "noLib": true, /* Do not include the default library file (lib.d.ts). */ - // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ - - /* Modules */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ - // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ - - /* Emit */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ - // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ - // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ - // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ - // "declarationDir": "./", /* Output directory for generated declaration files. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ - // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ - "skipLibCheck": true /* Skip type checking of declaration files. */ - } -} +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ + // "disableSolutionSearching": true, /* Projects */ + // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ + + /* Language and Environment */ + "target": "es5", /* Specify ECMAScript target version. */ + "lib": ["es5","es2015.core"], /* Specify library files to be included in the compilation. */ + // "jsx": "preserve", /* Specify JSX code generation. */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ + // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ + // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ + // "noLib": true, /* Do not include the default library file (lib.d.ts). */ + // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ + + /* Modules */ + "module": "commonjs", /* Specify module code generation. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ + // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ + + /* Emit */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ + // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ + // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ + // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ + // "declarationDir": "./", /* Output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ + // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ + } +} diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index 5842e2e6e353e..ef0ca314bf3c5 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -1,99 +1,99 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ - // "disableSolutionSearching": true, /* Projects */ - // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ - - /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ - // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ - // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ - // "noLib": true, /* Do not include the default library file (lib.d.ts). */ - // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ - - /* Modules */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - "types": ["jquery","mocha"], /* Type declaration files to be included in compilation. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ - // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ - - /* Emit */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ - // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ - // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ - // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ - // "declarationDir": "./", /* Output directory for generated declaration files. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ - // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ - "skipLibCheck": true /* Skip type checking of declaration files. */ - } -} +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ + // "disableSolutionSearching": true, /* Projects */ + // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ + + /* Language and Environment */ + "target": "es5", /* Specify ECMAScript target version. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "jsx": "preserve", /* Specify JSX code generation. */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ + // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ + // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ + // "noLib": true, /* Do not include the default library file (lib.d.ts). */ + // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ + + /* Modules */ + "module": "commonjs", /* Specify module code generation. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + "types": ["jquery","mocha"], /* Type declaration files to be included in compilation. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ + // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ + + /* Emit */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ + // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ + // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ + // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ + // "declarationDir": "./", /* Output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ + // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ + } +} diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index aea04fd608b5f..da407ca99be7b 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -35,95 +35,126 @@ tsc: The Typescript Compiler - Version FakeTSVersion COMMON COMPILER OPTIONS - --help, -h Print this message. - type: boolean + --help, -h Print this message. + type: boolean - --watch, -w Watch input files. - type: boolean + --watch, -w Watch input files. + type: boolean - --pretty Stylize errors and messages using color and context (experimental). - type: boolean - default: true + --pretty Stylize errors and messages using color and context (experimental). + type: boolean + default: true - --all Show all compiler options. - type: boolean + --all Show all compiler options. + type: boolean - --version, -v Print the compiler's version. - type: boolean + --version, -v Print the compiler's version. + type: boolean - --init Initializes a TypeScript project and creates a tsconfig.json file. - type: boolean + --init Initializes a TypeScript project and creates a tsconfig.json file. + type: boolean - --project, -p Compile the project given the path to its configuration file, or to a folder with a 'tscon fig.json'. - --build, -b Build one or more projects and their dependencies, if out of date - type: boolean + --project, -p Compile the project given the path to its configuration file, or to a folder with a 't sconfig.json'. + --build, -b Build one or more projects and their dependencies, if out of date + type: boolean - --showConfig Print the final configuration instead of building. - type: boolean + --showConfig Print the final configuration instead of building. + type: boolean - --target, -t Specify ECMAScript target version. - one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext - default: ES3 + --target, -t Specify ECMAScript target version. + one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext + default: ES3 - --module, -m Specify module code generation. - one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext + --module, -m Specify module code generation. + one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext - --lib Specify library files to be included in the compilation. - one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.it erable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, e s2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015. reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es20 17.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es 2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.objec t, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es202 0.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weak ref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext .string, esnext.promise, esnext.weakref + --lib Specify library files to be included in the compilation. + one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, do m.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015 .core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.pr oxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2 017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es201 8.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es 2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise , es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.pro mise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable , esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref - --allowJs Allow javascript files to be compiled. - type: boolean - default: false + --allowJs Allow javascript files to be compiled. + type: boolean + default: false - --jsx Specify JSX code generation. - one of: preserve, react-native, react, react-jsx, react-jsxdev - default: undefined + --jsx Specify JSX code generation. + one of: preserve, react-native, react, react-jsx, react-jsxdev + default: undefined - --declaration, -d Generates corresponding '.d.ts' file. - type: boolean - default: `false`, unless `composite` is set + --declaration, -d Generates corresponding '.d.ts' file. + type: boolean + default: `false`, unless `composite` is set - --declarationMap Generates a sourcemap for each corresponding '.d.ts' file. - type: boolean - default: false + --declarationMap Generates a sourcemap for each corresponding '.d.ts' file. + type: boolean + default: false - --sourceMap Generates corresponding '.map' file. - type: boolean - default: false + --sourceMap Generates corresponding '.map' file. + type: boolean + default: false - --outFile Concatenate and emit output to single file. - --outDir Redirect output structure to the directory. - --removeComments Do not emit comments to output. - type: boolean - default: false + --outFile Concatenate and emit output to single file. + --outDir Redirect output structure to the directory. + --removeComments Do not emit comments to output. + type: boolean + default: false - --noEmit Do not emit outputs. - type: boolean - default: false + --noEmit Do not emit outputs. + type: boolean + default: false - --strict Enable all strict type-checking options. - type: boolean - default: false + --strict Enable all strict type-checking options. + type: boolean + default: false - --noImplicitAny Raise error on expressions and declarations with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set + --noImplicitAny Raise error on expressions and declarations with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set - --strictNullChecks Enable strict null checks. - type: boolean - default: `false`, unless `strict` is set + --strictNullChecks Enable strict null checks. + type: boolean + default: `false`, unless `strict` is set - --strictOptionalProperties Enable strict checking of optional properties. - type: boolean + --strictFunctionTypes Enable strict checking of function types. + type: boolean + default: `false`, unless `strict` is set - --noImplicitThis Raise error on 'this' expressions with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set + --strictBindCallApply Enable strict 'bind', 'call', and 'apply' methods on functions. + type: boolean + default: `false`, unless `strict` is set - --types Type declaration files to be included in compilation. - --esModuleInterop Enables emit interoperability between CommonJS and ES Modules via creation of namespace ob jects for all imports. Implies 'allowSyntheticDefaultImports'. - type: boolean - default: false + --strictPropertyInitialization Enable strict checking of property initialization in classes. + type: boolean + default: `false`, unless `strict` is set + + --strictOptionalProperties Enable strict checking of optional properties. + type: boolean + + --noImplicitThis Raise error on 'this' expressions with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set + + --alwaysStrict Parse in strict mode and emit "use strict" for each source file. + type: boolean + default: `false`, unless `strict` is set + + --noUnusedLocals Report errors on unused locals. + type: boolean + default: false + + --noUnusedParameters Report errors on unused parameters. + type: boolean + default: false + + --noImplicitReturns Report error when not all code paths in function return a value. + type: boolean + default: false + + --noFallthroughCasesInSwitch Report errors for fallthrough cases in switch statement. + type: boolean + + --types Type declaration files to be included in compilation. + --esModuleInterop Enables emit interoperability between CommonJS and ES Modules via creation of namespac e objects for all imports. Implies 'allowSyntheticDefaultImports'. + type: boolean + default: false You can learn about all of the compiler options at https://aka.ms/tsconfig-reference diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js index c0dbd44255950..8841a8e0a5253 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js @@ -32,9 +32,9 @@ interface Array { length: number; [n: number]: T; } // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version. */ // "lib": [], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ @@ -45,7 +45,7 @@ interface Array { length: number; [n: number]: T; } // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ /* Modules */ - "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "module": "amd", /* Specify module code generation. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js index 3d8a22eb70a38..0b3bc8cffaf2d 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js @@ -6,128 +6,128 @@ export const c = 30; import {c} from "file1"; export const d = 30; //// [/a/lib/lib.d.ts] -/// -interface Boolean {} -interface Function {} -interface CallableFunction {} -interface NewableFunction {} -interface IArguments {} -interface Number { toExponential: any; } -interface Object {} -interface RegExp {} -interface String { charAt: any; } +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } interface Array { length: number; [n: number]: T; } //// [/user/username/projects/myproject/tsconfig.json] -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ - // "disableSolutionSearching": true, /* Projects */ - // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ - - /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ - // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ - // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ - // "noLib": true, /* Do not include the default library file (lib.d.ts). */ - // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ - - /* Modules */ - "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ - // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ - - /* Emit */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "build", /* Redirect output structure to the directory. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ - // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ - // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ - // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ - "declarationDir": "decls", /* Output directory for generated declaration files. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ - // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ - "skipLibCheck": true /* Skip type checking of declaration files. */ - } -} +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ + // "disableSolutionSearching": true, /* Projects */ + // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ + + /* Language and Environment */ + "target": "es5", /* Specify ECMAScript target version. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "jsx": "preserve", /* Specify JSX code generation. */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ + // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ + // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ + // "noLib": true, /* Do not include the default library file (lib.d.ts). */ + // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ + + /* Modules */ + "module": "amd", /* Specify module code generation. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ + // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ + + /* Emit */ + "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + "outDir": "build", /* Redirect output structure to the directory. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ + // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ + // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ + // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ + "declarationDir": "decls", /* Output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ + // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ + } +} /a/lib/tsc.js -w -p /user/username/projects/myproject/tsconfig.json Output:: >> Screen clear -[12:00:25 AM] Starting compilation in watch mode... - -[12:00:46 AM] Found 0 errors. Watching for file changes. - +[12:00:25 AM] Starting compilation in watch mode... + +[12:00:46 AM] Found 0 errors. Watching for file changes. + Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts"] @@ -166,29 +166,29 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/build/file1.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.c = void 0; - exports.c = 30; -}); +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.c = void 0; + exports.c = 30; +}); //// [/user/username/projects/myproject/decls/file1.d.ts] -export declare const c = 30; +export declare const c = 30; //// [/user/username/projects/myproject/build/src/file2.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.d = void 0; - exports.d = 30; -}); +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.d = void 0; + exports.d = 30; +}); //// [/user/username/projects/myproject/decls/src/file2.d.ts] -export declare const d = 30; +export declare const d = 30; @@ -230,10 +230,10 @@ export const y = 10; Output:: >> Screen clear -[12:00:49 AM] File change detected. Starting incremental compilation... - -[12:00:54 AM] Found 0 errors. Watching for file changes. - +[12:00:49 AM] File change detected. Starting incremental compilation... + +[12:00:54 AM] Found 0 errors. Watching for file changes. + Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts","/user/username/projects/myproject/src/file3.ts"] @@ -273,16 +273,16 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/build/src/file3.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.y = void 0; - exports.y = 10; -}); +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.y = void 0; + exports.y = 10; +}); //// [/user/username/projects/myproject/decls/src/file3.d.ts] -export declare const y = 10; +export declare const y = 10; diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js index cc101ef80e0d4..1adac99642728 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js @@ -6,128 +6,128 @@ export const c = 30; import {c} from "file1"; export const d = 30; //// [/a/lib/lib.d.ts] -/// -interface Boolean {} -interface Function {} -interface CallableFunction {} -interface NewableFunction {} -interface IArguments {} -interface Number { toExponential: any; } -interface Object {} -interface RegExp {} -interface String { charAt: any; } +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } interface Array { length: number; [n: number]: T; } //// [/user/username/projects/myproject/tsconfig.json] -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ - // "disableSolutionSearching": true, /* Projects */ - // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ - - /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ - // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ - // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ - // "noLib": true, /* Do not include the default library file (lib.d.ts). */ - // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ - - /* Modules */ - "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ - // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ - - /* Emit */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "build", /* Redirect output structure to the directory. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ - // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ - // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ - // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ - // "declarationDir": "./", /* Output directory for generated declaration files. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ - // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ - "skipLibCheck": true /* Skip type checking of declaration files. */ - } -} +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ + // "disableSolutionSearching": true, /* Projects */ + // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ + + /* Language and Environment */ + "target": "es5", /* Specify ECMAScript target version. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "jsx": "preserve", /* Specify JSX code generation. */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ + // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ + // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ + // "noLib": true, /* Do not include the default library file (lib.d.ts). */ + // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ + + /* Modules */ + "module": "amd", /* Specify module code generation. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ + // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ + + /* Emit */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + "outDir": "build", /* Redirect output structure to the directory. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ + // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ + // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ + // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ + // "declarationDir": "./", /* Output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ + // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ + } +} /a/lib/tsc.js -w -p /user/username/projects/myproject/tsconfig.json Output:: >> Screen clear -[12:00:25 AM] Starting compilation in watch mode... - -[12:00:36 AM] Found 0 errors. Watching for file changes. - +[12:00:25 AM] Starting compilation in watch mode... + +[12:00:36 AM] Found 0 errors. Watching for file changes. + Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts"] @@ -166,21 +166,21 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/build/file1.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.c = void 0; - exports.c = 30; -}); +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.c = void 0; + exports.c = 30; +}); //// [/user/username/projects/myproject/build/src/file2.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.d = void 0; - exports.d = 30; -}); +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.d = void 0; + exports.d = 30; +}); @@ -222,10 +222,10 @@ export const y = 10; Output:: >> Screen clear -[12:00:39 AM] File change detected. Starting incremental compilation... - -[12:00:42 AM] Found 0 errors. Watching for file changes. - +[12:00:39 AM] File change detected. Starting incremental compilation... + +[12:00:42 AM] Found 0 errors. Watching for file changes. + Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts","/user/username/projects/myproject/src/file3.ts"] @@ -265,12 +265,12 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/build/src/file3.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.y = void 0; - exports.y = 10; -}); +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.y = void 0; + exports.y = 10; +}); diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js index c8cdebdf36186..735959ebf27ee 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js @@ -1,11 +1,11 @@ -Input:: -//// [/user/username/projects/myproject/file1.ts] -export const c = 30; - -//// [/user/username/projects/myproject/src/file2.ts] -import {c} from "file1"; export const d = 30; - -//// [/a/lib/lib.d.ts] +Input:: +//// [/user/username/projects/myproject/file1.ts] +export const c = 30; + +//// [/user/username/projects/myproject/src/file2.ts] +import {c} from "file1"; export const d = 30; + +//// [/a/lib/lib.d.ts] /// interface Boolean {} interface Function {} @@ -16,9 +16,9 @@ interface Number { toExponential: any; } interface Object {} interface RegExp {} interface String { charAt: any; } -interface Array { length: number; [n: number]: T; } - -//// [/user/username/projects/myproject/tsconfig.json] +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/tsconfig.json] { "compilerOptions": { /* Visit https://aka.ms/tsconfig.json to read more about this file */ @@ -32,9 +32,9 @@ interface Array { length: number; [n: number]: T; } // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version. */ // "lib": [], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "jsx": "preserve", /* Specify JSX code generation. */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ @@ -45,7 +45,7 @@ interface Array { length: number; [n: number]: T; } // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ /* Modules */ - "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "module": "amd", /* Specify module code generation. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ @@ -118,51 +118,51 @@ interface Array { length: number; [n: number]: T; } "skipLibCheck": true /* Skip type checking of declaration files. */ } } - - - -/a/lib/tsc.js -w -p /user/username/projects/myproject/tsconfig.json -Output:: ->> Screen clear + + + +/a/lib/tsc.js -w -p /user/username/projects/myproject/tsconfig.json +Output:: +>> Screen clear [12:00:25 AM] Starting compilation in watch mode... [12:00:31 AM] Found 0 errors. Watching for file changes. - - -Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts"] -Program options: {"target":1,"module":2,"outFile":"/user/username/projects/myproject/build/outFile.js","esModuleInterop":true,"forceConsistentCasingInFileNames":true,"strict":true,"skipLibCheck":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not -Program files:: -/a/lib/lib.d.ts -/user/username/projects/myproject/file1.ts -/user/username/projects/myproject/src/file2.ts - -No cached semantic diagnostics in the builder:: - -WatchedFiles:: -/user/username/projects/myproject/tsconfig.json: - {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} -/user/username/projects/myproject/file1.ts: - {"fileName":"/user/username/projects/myproject/file1.ts","pollingInterval":250} -/user/username/projects/myproject/src/file2.ts: - {"fileName":"/user/username/projects/myproject/src/file2.ts","pollingInterval":250} -/a/lib/lib.d.ts: - {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} - -FsWatches:: - -FsWatchesRecursive:: -/user/username/projects/myproject/src: - {"directoryName":"/user/username/projects/myproject/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} -/user/username/projects/myproject/node_modules/@types: - {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} -/user/username/projects/myproject: - {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} - -exitCode:: ExitStatus.undefined - -//// [/user/username/projects/myproject/build/outFile.js] + + +Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts"] +Program options: {"target":1,"module":2,"outFile":"/user/username/projects/myproject/build/outFile.js","esModuleInterop":true,"forceConsistentCasingInFileNames":true,"strict":true,"skipLibCheck":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/file1.ts +/user/username/projects/myproject/src/file2.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/file1.ts: + {"fileName":"/user/username/projects/myproject/file1.ts","pollingInterval":250} +/user/username/projects/myproject/src/file2.ts: + {"fileName":"/user/username/projects/myproject/src/file2.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/src: + {"directoryName":"/user/username/projects/myproject/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/build/outFile.js] define("file1", ["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -175,89 +175,89 @@ define("src/file2", ["require", "exports"], function (require, exports) { exports.d = void 0; exports.d = 30; }); - - - -Change:: No change - -Input:: - -Output:: - -WatchedFiles:: -/user/username/projects/myproject/tsconfig.json: - {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} -/user/username/projects/myproject/file1.ts: - {"fileName":"/user/username/projects/myproject/file1.ts","pollingInterval":250} -/user/username/projects/myproject/src/file2.ts: - {"fileName":"/user/username/projects/myproject/src/file2.ts","pollingInterval":250} -/a/lib/lib.d.ts: - {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} - -FsWatches:: - -FsWatchesRecursive:: -/user/username/projects/myproject/src: - {"directoryName":"/user/username/projects/myproject/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} -/user/username/projects/myproject/node_modules/@types: - {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} -/user/username/projects/myproject: - {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} - -exitCode:: ExitStatus.undefined - - -Change:: Add new file - -Input:: -//// [/user/username/projects/myproject/src/file3.ts] -export const y = 10; - - -Output:: ->> Screen clear + + + +Change:: No change + +Input:: + +Output:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/file1.ts: + {"fileName":"/user/username/projects/myproject/file1.ts","pollingInterval":250} +/user/username/projects/myproject/src/file2.ts: + {"fileName":"/user/username/projects/myproject/src/file2.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/src: + {"directoryName":"/user/username/projects/myproject/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + + +Change:: Add new file + +Input:: +//// [/user/username/projects/myproject/src/file3.ts] +export const y = 10; + + +Output:: +>> Screen clear [12:00:34 AM] File change detected. Starting incremental compilation... [12:00:38 AM] Found 0 errors. Watching for file changes. - - -Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts","/user/username/projects/myproject/src/file3.ts"] -Program options: {"target":1,"module":2,"outFile":"/user/username/projects/myproject/build/outFile.js","esModuleInterop":true,"forceConsistentCasingInFileNames":true,"strict":true,"skipLibCheck":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not -Program files:: -/a/lib/lib.d.ts -/user/username/projects/myproject/file1.ts -/user/username/projects/myproject/src/file2.ts -/user/username/projects/myproject/src/file3.ts - -No cached semantic diagnostics in the builder:: - -WatchedFiles:: -/user/username/projects/myproject/tsconfig.json: - {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} -/user/username/projects/myproject/file1.ts: - {"fileName":"/user/username/projects/myproject/file1.ts","pollingInterval":250} -/user/username/projects/myproject/src/file2.ts: - {"fileName":"/user/username/projects/myproject/src/file2.ts","pollingInterval":250} -/a/lib/lib.d.ts: - {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} -/user/username/projects/myproject/src/file3.ts: - {"fileName":"/user/username/projects/myproject/src/file3.ts","pollingInterval":250} - -FsWatches:: - -FsWatchesRecursive:: -/user/username/projects/myproject/src: - {"directoryName":"/user/username/projects/myproject/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} -/user/username/projects/myproject/node_modules/@types: - {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} -/user/username/projects/myproject: - {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} - -exitCode:: ExitStatus.undefined - -//// [/user/username/projects/myproject/build/outFile.js] + + +Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts","/user/username/projects/myproject/src/file3.ts"] +Program options: {"target":1,"module":2,"outFile":"/user/username/projects/myproject/build/outFile.js","esModuleInterop":true,"forceConsistentCasingInFileNames":true,"strict":true,"skipLibCheck":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/file1.ts +/user/username/projects/myproject/src/file2.ts +/user/username/projects/myproject/src/file3.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/file1.ts: + {"fileName":"/user/username/projects/myproject/file1.ts","pollingInterval":250} +/user/username/projects/myproject/src/file2.ts: + {"fileName":"/user/username/projects/myproject/src/file2.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/src/file3.ts: + {"fileName":"/user/username/projects/myproject/src/file3.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/src: + {"directoryName":"/user/username/projects/myproject/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/build/outFile.js] define("file1", ["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -276,36 +276,36 @@ define("src/file3", ["require", "exports"], function (require, exports) { exports.y = void 0; exports.y = 10; }); - - - -Change:: No change - -Input:: - -Output:: - -WatchedFiles:: -/user/username/projects/myproject/tsconfig.json: - {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} -/user/username/projects/myproject/file1.ts: - {"fileName":"/user/username/projects/myproject/file1.ts","pollingInterval":250} -/user/username/projects/myproject/src/file2.ts: - {"fileName":"/user/username/projects/myproject/src/file2.ts","pollingInterval":250} -/a/lib/lib.d.ts: - {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} -/user/username/projects/myproject/src/file3.ts: - {"fileName":"/user/username/projects/myproject/src/file3.ts","pollingInterval":250} - -FsWatches:: - -FsWatchesRecursive:: -/user/username/projects/myproject/src: - {"directoryName":"/user/username/projects/myproject/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} -/user/username/projects/myproject/node_modules/@types: - {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} -/user/username/projects/myproject: - {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} - -exitCode:: ExitStatus.undefined - + + + +Change:: No change + +Input:: + +Output:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/file1.ts: + {"fileName":"/user/username/projects/myproject/file1.ts","pollingInterval":250} +/user/username/projects/myproject/src/file2.ts: + {"fileName":"/user/username/projects/myproject/src/file2.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/src/file3.ts: + {"fileName":"/user/username/projects/myproject/src/file3.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/src: + {"directoryName":"/user/username/projects/myproject/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js index b3faaf3c21597..d2a0818c54ce0 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js @@ -6,128 +6,128 @@ export const c = 30; import {c} from "file1"; export const d = 30; //// [/a/lib/lib.d.ts] -/// -interface Boolean {} -interface Function {} -interface CallableFunction {} -interface NewableFunction {} -interface IArguments {} -interface Number { toExponential: any; } -interface Object {} -interface RegExp {} -interface String { charAt: any; } +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } interface Array { length: number; [n: number]: T; } //// [/user/username/projects/myproject/tsconfig.json] -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ - // "disableSolutionSearching": true, /* Projects */ - // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ - - /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ - // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ - // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ - // "noLib": true, /* Do not include the default library file (lib.d.ts). */ - // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ - - /* Modules */ - "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ - // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ - - /* Emit */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ - // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ - // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ - // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ - // "declarationDir": "./", /* Output directory for generated declaration files. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ - // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ - "skipLibCheck": true /* Skip type checking of declaration files. */ - } -} +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ + // "disableSolutionSearching": true, /* Projects */ + // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ + + /* Language and Environment */ + "target": "es5", /* Specify ECMAScript target version. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "jsx": "preserve", /* Specify JSX code generation. */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ + // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ + // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ + // "noLib": true, /* Do not include the default library file (lib.d.ts). */ + // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ + + /* Modules */ + "module": "amd", /* Specify module code generation. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ + // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ + + /* Emit */ + "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ + // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ + // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ + // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ + // "declarationDir": "./", /* Output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ + // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ + } +} /a/lib/tsc.js -w -p /user/username/projects/myproject/tsconfig.json Output:: >> Screen clear -[12:00:25 AM] Starting compilation in watch mode... - -[12:00:34 AM] Found 0 errors. Watching for file changes. - +[12:00:25 AM] Starting compilation in watch mode... + +[12:00:34 AM] Found 0 errors. Watching for file changes. + Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts"] @@ -166,29 +166,29 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/file1.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.c = void 0; - exports.c = 30; -}); +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.c = void 0; + exports.c = 30; +}); //// [/user/username/projects/myproject/file1.d.ts] -export declare const c = 30; +export declare const c = 30; //// [/user/username/projects/myproject/src/file2.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.d = void 0; - exports.d = 30; -}); +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.d = void 0; + exports.d = 30; +}); //// [/user/username/projects/myproject/src/file2.d.ts] -export declare const d = 30; +export declare const d = 30; @@ -230,10 +230,10 @@ export const y = 10; Output:: >> Screen clear -[12:00:37 AM] File change detected. Starting incremental compilation... - -[12:00:42 AM] Found 0 errors. Watching for file changes. - +[12:00:37 AM] File change detected. Starting incremental compilation... + +[12:00:42 AM] Found 0 errors. Watching for file changes. + Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts","/user/username/projects/myproject/src/file3.ts"] @@ -273,16 +273,16 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/src/file3.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.y = void 0; - exports.y = 10; -}); +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.y = void 0; + exports.y = 10; +}); //// [/user/username/projects/myproject/src/file3.d.ts] -export declare const y = 10; +export declare const y = 10; diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js index b6fc2fc283851..d849c5c87ad44 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js @@ -6,128 +6,128 @@ export const c = 30; import {c} from "file1"; export const d = 30; //// [/a/lib/lib.d.ts] -/// -interface Boolean {} -interface Function {} -interface CallableFunction {} -interface NewableFunction {} -interface IArguments {} -interface Number { toExponential: any; } -interface Object {} -interface RegExp {} -interface String { charAt: any; } +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } interface Array { length: number; [n: number]: T; } //// [/user/username/projects/myproject/tsconfig.json] -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ - // "disableSolutionSearching": true, /* Projects */ - // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ - - /* Language and Environment */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ - // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ - // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ - // "noLib": true, /* Do not include the default library file (lib.d.ts). */ - // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ - - /* Modules */ - "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ - // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ - - /* Emit */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ - // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ - // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ - // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ - // "declarationDir": "./", /* Output directory for generated declaration files. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ - // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ - "skipLibCheck": true /* Skip type checking of declaration files. */ - } -} +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable use of source files instead of declaration files from referenced projects. */ + // "disableSolutionSearching": true, /* Projects */ + // "disableReferencedProjectLoad": true, /* Disable loading referenced projects. */ + + /* Language and Environment */ + "target": "es5", /* Specify ECMAScript target version. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "jsx": "preserve", /* Specify JSX code generation. */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + // "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */ + // "jsxImportSource": "", /* Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react */ + // "reactNamespace": "", /* [Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit */ + // "noLib": true, /* Do not include the default library file (lib.d.ts). */ + // "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */ + + /* Modules */ + "module": "amd", /* Specify module code generation. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Include modules imported with '.json' extension */ + // "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */ + + /* Emit */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */ + // "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */ + // "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */ + // "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */ + // "declarationDir": "./", /* Output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "strictOptionalProperties": true, /* Enable strict checking of optional properties. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + // "allowUnusedLabels": true, /* Do not report errors on unused labels. */ + // "allowUnreachableCode": true, /* Do not report errors on unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* [Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ + } +} /a/lib/tsc.js -w -p /user/username/projects/myproject/tsconfig.json Output:: >> Screen clear -[12:00:25 AM] Starting compilation in watch mode... - -[12:00:30 AM] Found 0 errors. Watching for file changes. - +[12:00:25 AM] Starting compilation in watch mode... + +[12:00:30 AM] Found 0 errors. Watching for file changes. + Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts"] @@ -166,21 +166,21 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/file1.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.c = void 0; - exports.c = 30; -}); +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.c = void 0; + exports.c = 30; +}); //// [/user/username/projects/myproject/src/file2.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.d = void 0; - exports.d = 30; -}); +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.d = void 0; + exports.d = 30; +}); @@ -222,10 +222,10 @@ export const y = 10; Output:: >> Screen clear -[12:00:33 AM] File change detected. Starting incremental compilation... - -[12:00:36 AM] Found 0 errors. Watching for file changes. - +[12:00:33 AM] File change detected. Starting incremental compilation... + +[12:00:36 AM] Found 0 errors. Watching for file changes. + Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts","/user/username/projects/myproject/src/file3.ts"] @@ -265,12 +265,12 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/src/file3.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.y = void 0; - exports.y = 10; -}); +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.y = void 0; + exports.y = 10; +}); From 36dd59dcd2cb613b6c759cc1b1511f056714c561 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Thu, 3 Jun 2021 23:16:54 +0800 Subject: [PATCH 16/21] No `No Category` --- src/executeCommandLine/executeCommandLine.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 6d3f6c3ac0854..64781e251bb39 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -296,7 +296,10 @@ namespace ts { } const categoryMap = new Map(); for (const option of options) { - const curCategory = option.category ? getDiagnosticText(option.category) : "No category"; + if (!option.category) { + continue; + } + const curCategory = getDiagnosticText(option.category); const optionsOfCurCategory = categoryMap.get(curCategory) ?? []; optionsOfCurCategory.push(option); categoryMap.set(curCategory, optionsOfCurCategory); From fa88df16f45949371795a7951717b1ac53d38aa4 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Sat, 5 Jun 2021 08:35:47 +0800 Subject: [PATCH 17/21] make getWidthOfTerminal optional. --- src/compiler/sys.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 6fc3e5249f794..86029e971ccad 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1162,7 +1162,7 @@ namespace ts { useCaseSensitiveFileNames: boolean; write(s: string): void; writeOutputIsTTY?(): boolean; - getWidthOfTerminal(): number; + getWidthOfTerminal?(): number; readFile(path: string, encoding?: string): string | undefined; getFileSize?(path: string): number; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; From e30eba1c9f5ba255ca07bcea9c4d1cdb2ed31867 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Sat, 5 Jun 2021 09:24:37 +0800 Subject: [PATCH 18/21] fix test --- src/executeCommandLine/executeCommandLine.ts | 12 ++++++------ tests/baselines/reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 64781e251bb39..d23a3c112776f 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -109,7 +109,7 @@ namespace ts { return `--${option.name}${option.shortName ? `, -${option.shortName}` : ""}`; } - function generateOptionOutput(sys: System,option: CommandLineOption, rightAlignOfLeft: number, leftAlignOfRight: number) { + function generateOptionOutput(sys: System, option: CommandLineOption, rightAlignOfLeft: number, leftAlignOfRight: number) { interface ValueCandidate { // "one or more" or "any of" valueType: string; @@ -124,7 +124,7 @@ namespace ts { // value type and possible value const valueCandidates = getValueCandidate(option); const defaultValueDescription = typeof option.defaultValueDescription === "object" ? getDiagnosticText(option.defaultValueDescription) : option.defaultValueDescription; - const terminalWidth = sys.getWidthOfTerminal(); + const terminalWidth = sys.getWidthOfTerminal?.() ?? 0; // Note: child_process might return `terminalWidth` as undefined. if (terminalWidth >= leftAlignOfRight + 20) { @@ -156,7 +156,7 @@ namespace ts { text.push(padLeft("", leftPad), `${valueCandidates.valueType} ${valueCandidates.possibleValues}`); } if (defaultValueDescription) { - if(valueCandidates) text.push(sys.newLine); + if (valueCandidates) text.push(sys.newLine); const diagType = getDiagnosticText(Diagnostics.default_Colon); const leftPad = Math.max(name.length + 1 - diagType.length, 2); text.push(padLeft("", leftPad), `${diagType} ${defaultValueDescription}`); @@ -256,7 +256,7 @@ namespace ts { } } - function generateGroupOptionOutput(sys: System,optionsList: readonly CommandLineOption[]) { + function generateGroupOptionOutput(sys: System, optionsList: readonly CommandLineOption[]) { let maxLength = 0; for (const option of optionsList) { const curLength = getDisplayNameTextOfOption(option).length; @@ -359,7 +359,7 @@ namespace ts { function getHelpHeader(sys: System) { const header: string[] = []; const tscexplaination = `tsc: The Typescript Compiler - ${getDiagnosticText(Diagnostics.Version_0, version)}`; - const terminalWidth = sys.getWidthOfTerminal(); + const terminalWidth = sys.getWidthOfTerminal?.() ?? 0;; const tsIconLength = 5; const tsIconFirstLine = blueBackground(padLeft("", tsIconLength)); @@ -861,7 +861,7 @@ namespace ts { if (canTrace(system, compilerOptions)) { startTracing(isBuildMode ? "build" : "project", - compilerOptions.generateTrace!, compilerOptions.configFilePath); + compilerOptions.generateTrace!, compilerOptions.configFilePath); } } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index b141dd5e1913c..284a998bba4ff 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3981,7 +3981,7 @@ declare namespace ts { useCaseSensitiveFileNames: boolean; write(s: string): void; writeOutputIsTTY?(): boolean; - getWidthOfTerminal(): number; + getWidthOfTerminal?(): number; readFile(path: string, encoding?: string): string | undefined; getFileSize?(path: string): number; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 1eb30355707ba..584f8350d72d1 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3981,7 +3981,7 @@ declare namespace ts { useCaseSensitiveFileNames: boolean; write(s: string): void; writeOutputIsTTY?(): boolean; - getWidthOfTerminal(): number; + getWidthOfTerminal?(): number; readFile(path: string, encoding?: string): string | undefined; getFileSize?(path: string): number; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; From d319a8b98958dcf7b0880d7673f02d2de10e8749 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Tue, 8 Jun 2021 10:13:01 +0800 Subject: [PATCH 19/21] fix review. --- src/harness/fakesHosts.ts | 6 +- src/harness/harnessLanguageService.ts | 4 - src/harness/virtualFileSystemWithWatch.ts | 4 - .../unittests/tsc/runWithoutArgs.ts | 7 + src/testRunner/unittests/tsserver/session.ts | 1 - src/webServer/webServer.ts | 1 - ...-when-host-can't-provide-terminal-width.js | 170 ++++++++++++++++ ...tatus.DiagnosticsPresent_OutputsSkipped.js | 190 +++++++++--------- 8 files changed, 276 insertions(+), 107 deletions(-) create mode 100644 tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js diff --git a/src/harness/fakesHosts.ts b/src/harness/fakesHosts.ts index 987a22904e226..58b29a4c7ef98 100644 --- a/src/harness/fakesHosts.ts +++ b/src/harness/fakesHosts.ts @@ -32,10 +32,8 @@ namespace fakes { this._env = env; } - getWidthOfTerminal(): number { - const testTerminalWidth = Number.parseInt(this.getEnvironmentVariable("TS_TEST_TERMINAL_WIDTH")); - return Number.isNaN(testTerminalWidth) ? 0 : testTerminalWidth; - } + private testTerminalWidth = Number.parseInt(this.getEnvironmentVariable("TS_TEST_TERMINAL_WIDTH")); + getWidthOfTerminal = Number.isNaN(this.testTerminalWidth) ? undefined : () => this.testTerminalWidth; // Pretty output writeOutputIsTTY() { diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 0ba489158845c..6b4dc207a3e33 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -726,10 +726,6 @@ namespace Harness.LanguageService { this.newLine = this.host.getNewLine(); } - getWidthOfTerminal(): number { - return 0; - } - onMessage = ts.noop; writeMessage = ts.noop; // overridden write(message: string): void { diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index d4bb988cbab9b..62c6cd042ef93 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -1027,10 +1027,6 @@ interface Array { length: number; [n: number]: T; }` this.modifyFile(path, this.readFile(path) + content, options); } - getWidthOfTerminal(): number { - return 0; - } - write(message: string) { this.output.push(message); } diff --git a/src/testRunner/unittests/tsc/runWithoutArgs.ts b/src/testRunner/unittests/tsc/runWithoutArgs.ts index d03468798d9e3..d09ffec78f93c 100644 --- a/src/testRunner/unittests/tsc/runWithoutArgs.ts +++ b/src/testRunner/unittests/tsc/runWithoutArgs.ts @@ -7,5 +7,12 @@ namespace ts { commandLineArgs: [], environmentVariables: { TS_TEST_TERMINAL_WIDTH: "120" } }); + + verifyTsc({ + scenario: "runWithoutArgs", + subScenario: "show help with ExitStatus.DiagnosticsPresent_OutputsSkipped when host can't provide terminal width", + fs: () => loadProjectFromFiles({}), + commandLineArgs: [], + }); }); } diff --git a/src/testRunner/unittests/tsserver/session.ts b/src/testRunner/unittests/tsserver/session.ts index 9b0fd7d02086a..652879227dadc 100644 --- a/src/testRunner/unittests/tsserver/session.ts +++ b/src/testRunner/unittests/tsserver/session.ts @@ -7,7 +7,6 @@ namespace ts.server { args: [], newLine: "\n", useCaseSensitiveFileNames: true, - getWidthOfTerminal: () => 0, write(s): void { lastWrittenToHost = s; }, readFile: returnUndefined, writeFile: noop, diff --git a/src/webServer/webServer.ts b/src/webServer/webServer.ts index 5362979728939..fe3d6aa44a45d 100644 --- a/src/webServer/webServer.ts +++ b/src/webServer/webServer.ts @@ -122,7 +122,6 @@ namespace ts.server { const webPath = getWebPath(path); return webPath && host.readFile(webPath); }, - getWidthOfTerminal: () => Number.MAX_VALUE, // TODO: could we assume this is infinate? or this is zero? write: host.writeMessage.bind(host), watchFile: returnNoopFileWatcher, watchDirectory: returnNoopFileWatcher, diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js new file mode 100644 index 0000000000000..5321add2343a8 --- /dev/null +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -0,0 +1,170 @@ +Input:: +//// [/lib/lib.d.ts] + + + + +Output:: +/lib/tsc +Version FakeTSVersion +tsc: The Typescript Compiler - Version FakeTSVersion + +COMMON COMMANDS + + tsc + Compiles the current project (tsconfig.json in the working diirectory.) + + tsc app.ts util.ts + Ignoring tsconfig.json, compiles the specified files with default compiler options + + tsc -b + Build a composite project in the working directory. + + tsc --init + Creates a tsconfig.json with the recommended settings in the working directory. + + tsc -p .path/to/tsconfig.json + compiles the Typescript project located at the specified path + + tsc --help --all + An expanded version of this information, showing all possible compiler options + + tsc --noEmit + tsc --target esnext + Compiles the current project, with additional settings. + +COMMON COMPILER OPTIONS + +--help, -h: Print this message. + type: boolean + +--watch, -w: Watch input files. + type: boolean + +--pretty: Stylize errors and messages using color and context (experimental). + type: boolean + default: true + +--all: Show all compiler options. + type: boolean + +--version, -v: Print the compiler's version. + type: boolean + +--init: Initializes a TypeScript project and creates a tsconfig.json file. + type: boolean + +--project, -p: Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. + +--build, -b: Build one or more projects and their dependencies, if out of date + type: boolean + +--showConfig: Print the final configuration instead of building. + type: boolean + +--target, -t: Specify ECMAScript target version. + one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext + default: ES3 + +--module, -m: Specify module code generation. + one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext + +--lib: Specify library files to be included in the compilation. + one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref + +--allowJs: Allow javascript files to be compiled. + type: boolean + default: false + +--jsx: Specify JSX code generation. + one of: preserve, react-native, react, react-jsx, react-jsxdev + default: undefined + +--declaration, -d: Generates corresponding '.d.ts' file. + type: boolean + default: `false`, unless `composite` is set + +--declarationMap: Generates a sourcemap for each corresponding '.d.ts' file. + type: boolean + default: false + +--sourceMap: Generates corresponding '.map' file. + type: boolean + default: false + +--outFile: Concatenate and emit output to single file. + +--outDir: Redirect output structure to the directory. + +--removeComments: Do not emit comments to output. + type: boolean + default: false + +--noEmit: Do not emit outputs. + type: boolean + default: false + +--strict: Enable all strict type-checking options. + type: boolean + default: false + +--noImplicitAny: Raise error on expressions and declarations with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set + +--strictNullChecks: Enable strict null checks. + type: boolean + default: `false`, unless `strict` is set + +--strictFunctionTypes: Enable strict checking of function types. + type: boolean + default: `false`, unless `strict` is set + +--strictBindCallApply: Enable strict 'bind', 'call', and 'apply' methods on functions. + type: boolean + default: `false`, unless `strict` is set + +--strictPropertyInitialization: Enable strict checking of property initialization in classes. + type: boolean + default: `false`, unless `strict` is set + +--strictOptionalProperties: Enable strict checking of optional properties. + type: boolean + +--noImplicitThis: Raise error on 'this' expressions with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set + +--useUnknownInCatchVariables: Type catch clause variables as 'unknown' instead of 'any'. + type: boolean + +--alwaysStrict: Parse in strict mode and emit "use strict" for each source file. + type: boolean + default: `false`, unless `strict` is set + +--noUnusedLocals: Report errors on unused locals. + type: boolean + default: false + +--noUnusedParameters: Report errors on unused parameters. + type: boolean + default: false + +--noImplicitReturns: Report error when not all code paths in function return a value. + type: boolean + default: false + +--noFallthroughCasesInSwitch: Report errors for fallthrough cases in switch statement. + type: boolean + +--types: Type declaration files to be included in compilation. + +--esModuleInterop: Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. + type: boolean + default: false + +You can learn about all of the compiler options at https://aka.ms/tsconfig-reference + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 344667e08b41d..5321add2343a8 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -7,8 +7,8 @@ Input:: Output:: /lib/tsc Version FakeTSVersion -tsc: The Typescript Compiler - Version FakeTSVersion   -  TS  +tsc: The Typescript Compiler - Version FakeTSVersion + COMMON COMMANDS tsc @@ -35,129 +35,133 @@ tsc: The Typescript Compiler - Version FakeTSVersion COMMON COMPILER OPTIONS - --help, -h Print this message. - type: boolean +--help, -h: Print this message. + type: boolean + +--watch, -w: Watch input files. + type: boolean + +--pretty: Stylize errors and messages using color and context (experimental). + type: boolean + default: true + +--all: Show all compiler options. + type: boolean + +--version, -v: Print the compiler's version. + type: boolean - --watch, -w Watch input files. - type: boolean +--init: Initializes a TypeScript project and creates a tsconfig.json file. + type: boolean - --pretty Stylize errors and messages using color and context (experimental). - type: boolean - default: true +--project, -p: Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. - --all Show all compiler options. - type: boolean +--build, -b: Build one or more projects and their dependencies, if out of date + type: boolean - --version, -v Print the compiler's version. - type: boolean +--showConfig: Print the final configuration instead of building. + type: boolean - --init Initializes a TypeScript project and creates a tsconfig.json file. - type: boolean +--target, -t: Specify ECMAScript target version. + one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext + default: ES3 - --project, -p Compile the project given the path to its configuration file, or to a folder with a 't sconfig.json'. - --build, -b Build one or more projects and their dependencies, if out of date - type: boolean +--module, -m: Specify module code generation. + one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext - --showConfig Print the final configuration instead of building. - type: boolean +--lib: Specify library files to be included in the compilation. + one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref - --target, -t Specify ECMAScript target version. - one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext - default: ES3 +--allowJs: Allow javascript files to be compiled. + type: boolean + default: false - --module, -m Specify module code generation. - one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext +--jsx: Specify JSX code generation. + one of: preserve, react-native, react, react-jsx, react-jsxdev + default: undefined - --lib Specify library files to be included in the compilation. - one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, do m.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015 .core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.pr oxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2 017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es201 8.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es 2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise , es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.pro mise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable , esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +--declaration, -d: Generates corresponding '.d.ts' file. + type: boolean + default: `false`, unless `composite` is set - --allowJs Allow javascript files to be compiled. - type: boolean - default: false +--declarationMap: Generates a sourcemap for each corresponding '.d.ts' file. + type: boolean + default: false - --jsx Specify JSX code generation. - one of: preserve, react-native, react, react-jsx, react-jsxdev - default: undefined +--sourceMap: Generates corresponding '.map' file. + type: boolean + default: false - --declaration, -d Generates corresponding '.d.ts' file. - type: boolean - default: `false`, unless `composite` is set +--outFile: Concatenate and emit output to single file. - --declarationMap Generates a sourcemap for each corresponding '.d.ts' file. - type: boolean - default: false +--outDir: Redirect output structure to the directory. - --sourceMap Generates corresponding '.map' file. - type: boolean - default: false +--removeComments: Do not emit comments to output. + type: boolean + default: false - --outFile Concatenate and emit output to single file. - --outDir Redirect output structure to the directory. - --removeComments Do not emit comments to output. - type: boolean - default: false +--noEmit: Do not emit outputs. + type: boolean + default: false - --noEmit Do not emit outputs. - type: boolean - default: false +--strict: Enable all strict type-checking options. + type: boolean + default: false - --strict Enable all strict type-checking options. - type: boolean - default: false +--noImplicitAny: Raise error on expressions and declarations with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set - --noImplicitAny Raise error on expressions and declarations with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set +--strictNullChecks: Enable strict null checks. + type: boolean + default: `false`, unless `strict` is set - --strictNullChecks Enable strict null checks. - type: boolean - default: `false`, unless `strict` is set +--strictFunctionTypes: Enable strict checking of function types. + type: boolean + default: `false`, unless `strict` is set - --strictFunctionTypes Enable strict checking of function types. - type: boolean - default: `false`, unless `strict` is set +--strictBindCallApply: Enable strict 'bind', 'call', and 'apply' methods on functions. + type: boolean + default: `false`, unless `strict` is set - --strictBindCallApply Enable strict 'bind', 'call', and 'apply' methods on functions. - type: boolean - default: `false`, unless `strict` is set +--strictPropertyInitialization: Enable strict checking of property initialization in classes. + type: boolean + default: `false`, unless `strict` is set - --strictPropertyInitialization Enable strict checking of property initialization in classes. - type: boolean - default: `false`, unless `strict` is set +--strictOptionalProperties: Enable strict checking of optional properties. + type: boolean - --strictOptionalProperties Enable strict checking of optional properties. - type: boolean +--noImplicitThis: Raise error on 'this' expressions with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set - --noImplicitThis Raise error on 'this' expressions with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set +--useUnknownInCatchVariables: Type catch clause variables as 'unknown' instead of 'any'. + type: boolean - --useUnknownInCatchVariables Type catch clause variables as 'unknown' instead of 'any'. - type: boolean +--alwaysStrict: Parse in strict mode and emit "use strict" for each source file. + type: boolean + default: `false`, unless `strict` is set - --alwaysStrict Parse in strict mode and emit "use strict" for each source file. - type: boolean - default: `false`, unless `strict` is set +--noUnusedLocals: Report errors on unused locals. + type: boolean + default: false - --noUnusedLocals Report errors on unused locals. - type: boolean - default: false +--noUnusedParameters: Report errors on unused parameters. + type: boolean + default: false - --noUnusedParameters Report errors on unused parameters. - type: boolean - default: false +--noImplicitReturns: Report error when not all code paths in function return a value. + type: boolean + default: false - --noImplicitReturns Report error when not all code paths in function return a value. - type: boolean - default: false +--noFallthroughCasesInSwitch: Report errors for fallthrough cases in switch statement. + type: boolean - --noFallthroughCasesInSwitch Report errors for fallthrough cases in switch statement. - type: boolean +--types: Type declaration files to be included in compilation. - --types Type declaration files to be included in compilation. - --esModuleInterop Enables emit interoperability between CommonJS and ES Modules via creation of namespac e objects for all imports. Implies 'allowSyntheticDefaultImports'. - type: boolean - default: false +--esModuleInterop: Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. + type: boolean + default: false You can learn about all of the compiler options at https://aka.ms/tsconfig-reference From fef9f9fd01aa24548e1769c9feb26bc80adf4207 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Tue, 8 Jun 2021 10:13:01 +0800 Subject: [PATCH 20/21] fix review. --- src/compiler/commandLineParser.ts | 19 +- src/compiler/diagnosticMessages.json | 56 ++++++ src/executeCommandLine/executeCommandLine.ts | 133 +++++++----- src/harness/fakesHosts.ts | 6 +- src/harness/harnessLanguageService.ts | 4 - src/harness/virtualFileSystemWithWatch.ts | 4 - .../unittests/tsc/runWithoutArgs.ts | 7 + src/testRunner/unittests/tsserver/session.ts | 1 - src/webServer/webServer.ts | 1 - ...-when-host-can't-provide-terminal-width.js | 170 ++++++++++++++++ ...tatus.DiagnosticsPresent_OutputsSkipped.js | 190 +++++++++--------- 11 files changed, 416 insertions(+), 175 deletions(-) create mode 100644 tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index e19795a258918..3b0c70d698600 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -427,6 +427,7 @@ namespace ts { { name: "checkJs", type: "boolean", + showInSimplifiedHelpView: true, category: Diagnostics.JavaScript_Support, description: Diagnostics.Report_errors_in_js_files, defaultValueDescription: "false" @@ -468,6 +469,8 @@ namespace ts { name: "emitDeclarationOnly", type: "boolean", affectsEmit: true, + showInSimplifiedHelpView: true, + category: Diagnostics.Emit, description: Diagnostics.Only_emit_d_ts_declaration_files, transpileOptionValue: undefined, @@ -607,7 +610,6 @@ namespace ts { type: "boolean", affectsSemanticDiagnostics: true, strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, defaultValueDescription: Diagnostics.false_unless_strict_is_set @@ -617,7 +619,6 @@ namespace ts { type: "boolean", affectsSemanticDiagnostics: true, strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Enable_strict_null_checks, defaultValueDescription: Diagnostics.false_unless_strict_is_set @@ -625,9 +626,7 @@ namespace ts { { name: "strictFunctionTypes", type: "boolean", - affectsSemanticDiagnostics: true, strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Enable_strict_checking_of_function_types, defaultValueDescription: Diagnostics.false_unless_strict_is_set @@ -636,7 +635,6 @@ namespace ts { name: "strictBindCallApply", type: "boolean", strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Enable_strict_bind_call_and_apply_methods_on_functions, defaultValueDescription: Diagnostics.false_unless_strict_is_set @@ -646,7 +644,6 @@ namespace ts { type: "boolean", affectsSemanticDiagnostics: true, strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Enable_strict_checking_of_property_initialization_in_classes, defaultValueDescription: Diagnostics.false_unless_strict_is_set @@ -656,7 +653,6 @@ namespace ts { type: "boolean", affectsSemanticDiagnostics: true, strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Enable_strict_checking_of_optional_properties }, @@ -665,7 +661,6 @@ namespace ts { type: "boolean", affectsSemanticDiagnostics: true, strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, defaultValueDescription: Diagnostics.false_unless_strict_is_set @@ -675,7 +670,6 @@ namespace ts { type: "boolean", affectsSemanticDiagnostics: true, strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Type_catch_clause_variables_as_unknown_instead_of_any, }, @@ -684,7 +678,6 @@ namespace ts { type: "boolean", affectsSourceFile: true, strictFlag: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file, defaultValueDescription: Diagnostics.false_unless_strict_is_set @@ -695,7 +688,6 @@ namespace ts { name: "noUnusedLocals", type: "boolean", affectsSemanticDiagnostics: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Report_errors_on_unused_locals, defaultValueDescription: "false" @@ -704,7 +696,6 @@ namespace ts { name: "noUnusedParameters", type: "boolean", affectsSemanticDiagnostics: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Report_errors_on_unused_parameters, defaultValueDescription: "false" @@ -713,7 +704,6 @@ namespace ts { name: "noImplicitReturns", type: "boolean", affectsSemanticDiagnostics: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value, defaultValueDescription: "false" @@ -723,7 +713,6 @@ namespace ts { type: "boolean", affectsBindDiagnostics: true, affectsSemanticDiagnostics: true, - showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement }, @@ -731,7 +720,6 @@ namespace ts { name: "noUncheckedIndexedAccess", type: "boolean", affectsSemanticDiagnostics: true, - showInSimplifiedHelpView: false, category: Diagnostics.Type_Checking, description: Diagnostics.Include_undefined_in_index_signature_results }, @@ -739,7 +727,6 @@ namespace ts { name: "noImplicitOverride", type: "boolean", affectsSemanticDiagnostics: true, - showInSimplifiedHelpView: false, category: Diagnostics.Type_Checking, description: Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 065546b9779e1..d4d5f0ca70adb 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -5267,6 +5267,62 @@ "category": "Message", "code": 6915 }, + "COMMON COMMANDS": { + "category": "Message", + "code": 6916 + }, + "ALL COMPILER OPTIONS": { + "category": "Message", + "code": 6917 + }, + "WATCH OPTIONS": { + "category": "Message", + "code": 6918 + }, + "BUILD OPTIONS": { + "category": "Message", + "code": 6919 + }, + "COMMON COMPILER OPTIONS": { + "category": "Message", + "code": 6920 + }, + "COMMAND LINE FLAGS": { + "category": "Message", + "code": 6921 + }, + "tsc: The TypeScript Compiler": { + "category": "Message", + "code": 6922 + }, + "Compiles the current project (tsconfig.json in the working directory.)": { + "category": "Message", + "code": 6923 + }, + "Ignoring tsconfig.json, compiles the specified files with default compiler options": { + "category": "Message", + "code": 6924 + }, + "Build a composite project in the working directory.": { + "category": "Message", + "code": 6925 + }, + "Creates a tsconfig.json with the recommended settings in the working directory.": { + "category": "Message", + "code": 6926 + }, + "Compiles the TypeScript project located at the specified path": { + "category": "Message", + "code": 6927 + }, + "An expanded version of this information, showing all possible compiler options": { + "category": "Message", + "code": 6928 + }, + "Compiles the current project, with additional settings": { + "category": "Message", + "code": 6929 + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index d23a3c112776f..888172b87325e 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -89,20 +89,35 @@ namespace ts { sys.write(getDiagnosticText(Diagnostics.Version_0, version) + sys.newLine); } - function bold(str: string) { - return `\x1b[1m${str}\x1b[22m`; - } - - function blue(str: string) { - return `\x1b[34m${str}\x1b[39m`; - } - - function blueBackground(str: string) { - return `\x1b[44m${str}\x1b[49m`; - } + function createColors(sys: System) { + const showColors = defaultIsPretty(sys); + if (!showColors) { + return { + bold: (str: string) => str, + blue: (str: string) => str, + blueBackground: (str: string) => str, + white: (str: string) => str + }; + } - function white(str: string) { - return `\x1b[37m${str}\x1b[39m`; + function bold(str: string) { + return `\x1b[1m${str}\x1b[22m`; + } + function blue(str: string) { + return `\x1b[34m${str}\x1b[39m`; + } + function blueBackground(str: string) { + return `\x1b[44m${str}\x1b[49m`; + } + function white(str: string) { + return `\x1b[37m${str}\x1b[39m`; + } + return { + bold, + blue, + white, + blueBackground + }; } function getDisplayNameTextOfOption(option: CommandLineOption) { @@ -117,6 +132,7 @@ namespace ts { } const text: string[] = []; + const colors = createColors(sys); // name and description const name = getDisplayNameTextOfOption(option); @@ -127,39 +143,37 @@ namespace ts { const terminalWidth = sys.getWidthOfTerminal?.() ?? 0; // Note: child_process might return `terminalWidth` as undefined. - if (terminalWidth >= leftAlignOfRight + 20) { + if (terminalWidth >= 60) { let description = ""; if (option.description) { description = getDiagnosticText(option.description); } text.push(...getPrettyOutput(name, description, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ true), sys.newLine); - if (showAdditionalInfoOutput(valueCandidates, option.defaultValueDescription)) { + if (showAdditionalInfoOutput(valueCandidates, option)) { if (valueCandidates) { text.push(...getPrettyOutput(valueCandidates.valueType, valueCandidates.possibleValues, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ false), sys.newLine); } if (defaultValueDescription) { text.push(...getPrettyOutput(getDiagnosticText(Diagnostics.default_Colon), defaultValueDescription, rightAlignOfLeft, leftAlignOfRight, terminalWidth, /*colorLeft*/ false), sys.newLine); } - text.push(sys.newLine); } + text.push(sys.newLine); } else { - text.push(blue(name), ": "); + text.push(colors.blue(name), sys.newLine); if (option.description) { const description = getDiagnosticText(option.description); text.push(description); } text.push(sys.newLine); - if (showAdditionalInfoOutput(valueCandidates, option.defaultValueDescription)) { + if (showAdditionalInfoOutput(valueCandidates, option)) { if (valueCandidates) { - const leftPad = Math.max(name.length + 1 - valueCandidates.valueType.length, 2); - text.push(padLeft("", leftPad), `${valueCandidates.valueType} ${valueCandidates.possibleValues}`); + text.push(`${valueCandidates.valueType} ${valueCandidates.possibleValues}`); } if (defaultValueDescription) { if (valueCandidates) text.push(sys.newLine); const diagType = getDiagnosticText(Diagnostics.default_Colon); - const leftPad = Math.max(name.length + 1 - diagType.length, 2); - text.push(padLeft("", leftPad), `${diagType} ${defaultValueDescription}`); + text.push(`${diagType} ${defaultValueDescription}`); } text.push(sys.newLine); @@ -168,9 +182,12 @@ namespace ts { } return text; - function showAdditionalInfoOutput(valueCandidates: ValueCandidate | undefined, defaultValueDescription: string | DiagnosticMessage | undefined): boolean { + function showAdditionalInfoOutput(valueCandidates: ValueCandidate | undefined, option: CommandLineOption): boolean { const ignoreValues = ["string"]; const ignoredDescriptions = [undefined, "false", "n/a"]; + const defaultValueDescription = option.defaultValueDescription; + if (option.category === Diagnostics.Command_line_Options) return false; + if (contains(ignoreValues, valueCandidates?.possibleValues) && contains(ignoredDescriptions, defaultValueDescription)) { return false; } @@ -187,7 +204,7 @@ namespace ts { if (isFirstLine) { curLeft = padLeft(left, rightAlignOfLeft); curLeft = padRight(curLeft, leftAlignOfRight); - curLeft = colorLeft ? blue(curLeft) : curLeft; + curLeft = colorLeft ? colors.blue(curLeft) : curLeft; } else { curLeft = padLeft("", leftAlignOfRight); @@ -283,7 +300,7 @@ namespace ts { function generateSectionOptionsOutput(sys: System, sectionName: string, options: readonly CommandLineOption[], subCategory: boolean, beforeOptionsDescription?: string, afterOptionsDescription?: string) { let res: string[] = []; - res.push(bold(sectionName) + sys.newLine + sys.newLine); + res.push(createColors(sys).bold(sectionName) + sys.newLine + sys.newLine); if (beforeOptionsDescription) { res.push(beforeOptionsDescription + sys.newLine + sys.newLine); } @@ -315,34 +332,45 @@ namespace ts { } function printEasyHelp(sys: System, simpleOptions: readonly CommandLineOption[]) { + const colors = createColors(sys); let output: string[] = [...getHelpHeader(sys)]; - output.push(bold("COMMON COMMANDS") + sys.newLine + sys.newLine); - output.push(" " + blue("tsc") + sys.newLine); - output.push(" " + "Compiles the current project (tsconfig.json in the working diirectory.)" + sys.newLine + sys.newLine); - output.push(" " + blue("tsc app.ts util.ts" + sys.newLine)); - output.push(" " + "Ignoring tsconfig.json, compiles the specified files with default compiler options" + sys.newLine + sys.newLine); - output.push(" " + blue("tsc -b" + sys.newLine)); - output.push(" " + "Build a composite project in the working directory." + sys.newLine + sys.newLine); - output.push(" " + blue("tsc --init" + sys.newLine)); - output.push(" " + "Creates a tsconfig.json with the recommended settings in the working directory." + sys.newLine + sys.newLine); - output.push(" " + blue("tsc -p .path/to/tsconfig.json" + sys.newLine)); - output.push(" " + "compiles the Typescript project located at the specified path" + sys.newLine + sys.newLine); - output.push(" " + blue("tsc --help --all" + sys.newLine)); - output.push(" " + "An expanded version of this information, showing all possible compiler options" + sys.newLine + sys.newLine); - output.push(" " + blue("tsc --noEmit" + sys.newLine)); - output.push(" " + blue("tsc --target esnext" + sys.newLine)); - output.push(" " + "Compiles the current project, with additional settings." + sys.newLine + sys.newLine); - output = [...output, ...generateSectionOptionsOutput(sys, "COMMON COMPILER OPTIONS", simpleOptions, /*subCategory*/ false, /* beforeOptionsDescription */ undefined, formatMessage(/*_dummy*/ undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; + output.push(colors.bold(getDiagnosticText(Diagnostics.COMMON_COMMANDS)) + sys.newLine + sys.newLine); + + example("tsc", Diagnostics.Compiles_the_current_project_tsconfig_json_in_the_working_directory); + example("tsc app.ts util.ts", Diagnostics.Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options); + example("tsc -b", Diagnostics.Build_a_composite_project_in_the_working_directory); + example("tsc --init", Diagnostics.Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory); + example("tsc -p .path/to/tsconfig.json", Diagnostics.Compiles_the_TypeScript_project_located_at_the_specified_path); + example("tsc --help --all", Diagnostics.An_expanded_version_of_this_information_showing_all_possible_compiler_options); + example(["tsc --noEmit", "tsc --target esnext"], Diagnostics.Compiles_the_current_project_with_additional_settings); + + const cliCommands = simpleOptions.filter(opt => opt.isCommandLineOnly || opt.category === Diagnostics.Command_line_Options); + const configOpts = simpleOptions.filter(opt => !contains(cliCommands, opt)); + + output = [ + ...output, + ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.COMMAND_LINE_FLAGS), cliCommands, /*subCategory*/ false, /* beforeOptionsDescription */ undefined, /* afterOptionsDescription*/ undefined), + ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.COMMON_COMPILER_OPTIONS), configOpts, /*subCategory*/ false, /* beforeOptionsDescription */ undefined, formatMessage(/*_dummy*/ undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference")) + ]; + for (const line of output) { sys.write(line); } + + function example(ex: string | string[], desc: DiagnosticMessage) { + const examples = typeof ex === "string" ? [ex] : ex; + for (const example of examples) { + output.push(" " + colors.blue(example) + sys.newLine); + } + output.push(" " + getDiagnosticText(desc) + sys.newLine + sys.newLine); + } } function printAllHelp(sys: System, compilerOptions: readonly CommandLineOption[], buildOptions: readonly CommandLineOption[], watchOptions: readonly CommandLineOption[]) { let output: string[] = [...getHelpHeader(sys)]; - output = [...output, ...generateSectionOptionsOutput(sys, "ALL COMPILER OPTIONS", compilerOptions, /*subCategory*/ true, /* beforeOptionsDescription */ undefined, formatMessage(/*_dummy*/ undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; - output = [...output, ...generateSectionOptionsOutput(sys, "WATCH OPTIONS", watchOptions, /*subCategory*/ false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))]; - output = [...output, ...generateSectionOptionsOutput(sys, "BUILD OPTIONS", buildOptions, /*subCategory*/ false, formatMessage(/*_dummy*/ undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; + output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.ALL_COMPILER_OPTIONS), compilerOptions, /*subCategory*/ true, /* beforeOptionsDescription */ undefined, formatMessage(/*_dummy*/ undefined, Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference"))]; + output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.WATCH_OPTIONS), watchOptions, /*subCategory*/ false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))]; + output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.BUILD_OPTIONS), buildOptions, /*subCategory*/ false, formatMessage(/*_dummy*/ undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; for (const line of output) { sys.write(line); } @@ -350,30 +378,31 @@ namespace ts { function printBuildHelp(sys: System, buildOptions: readonly CommandLineOption[]) { let output: string[] = [...getHelpHeader(sys)]; - output = [...output, ...generateSectionOptionsOutput(sys, "BUILD OPTIONS", buildOptions, /*subCategory*/ false, formatMessage(/*_dummy*/ undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; + output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.BUILD_OPTIONS), buildOptions, /*subCategory*/ false, formatMessage(/*_dummy*/ undefined, Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; for (const line of output) { sys.write(line); } } function getHelpHeader(sys: System) { + const colors = createColors(sys); const header: string[] = []; - const tscexplaination = `tsc: The Typescript Compiler - ${getDiagnosticText(Diagnostics.Version_0, version)}`; + const tscExplanation = `${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`; const terminalWidth = sys.getWidthOfTerminal?.() ?? 0;; const tsIconLength = 5; - const tsIconFirstLine = blueBackground(padLeft("", tsIconLength)); - const tsIconSecondLine = blueBackground(white(padLeft("TS ", tsIconLength))); + const tsIconFirstLine = colors.blueBackground(padLeft("", tsIconLength)); + const tsIconSecondLine = colors.blueBackground(colors.white(padLeft("TS ", tsIconLength))); // If we have enough space, print TS icon. - if (terminalWidth >= tscexplaination.length + tsIconLength) { + if (terminalWidth >= tscExplanation.length + tsIconLength) { // right align of the icon is 120 at most. const rightAlign = terminalWidth > 120 ? 120 : terminalWidth; const leftAlign = rightAlign - tsIconLength; - header.push(padRight(tscexplaination, leftAlign) + tsIconFirstLine + sys.newLine); + header.push(padRight(tscExplanation, leftAlign) + tsIconFirstLine + sys.newLine); header.push(padLeft("", leftAlign) + tsIconSecondLine + sys.newLine); } else { - header.push(tscexplaination + sys.newLine); + header.push(tscExplanation + sys.newLine); header.push(sys.newLine); } return header; diff --git a/src/harness/fakesHosts.ts b/src/harness/fakesHosts.ts index 987a22904e226..58b29a4c7ef98 100644 --- a/src/harness/fakesHosts.ts +++ b/src/harness/fakesHosts.ts @@ -32,10 +32,8 @@ namespace fakes { this._env = env; } - getWidthOfTerminal(): number { - const testTerminalWidth = Number.parseInt(this.getEnvironmentVariable("TS_TEST_TERMINAL_WIDTH")); - return Number.isNaN(testTerminalWidth) ? 0 : testTerminalWidth; - } + private testTerminalWidth = Number.parseInt(this.getEnvironmentVariable("TS_TEST_TERMINAL_WIDTH")); + getWidthOfTerminal = Number.isNaN(this.testTerminalWidth) ? undefined : () => this.testTerminalWidth; // Pretty output writeOutputIsTTY() { diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 0ba489158845c..6b4dc207a3e33 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -726,10 +726,6 @@ namespace Harness.LanguageService { this.newLine = this.host.getNewLine(); } - getWidthOfTerminal(): number { - return 0; - } - onMessage = ts.noop; writeMessage = ts.noop; // overridden write(message: string): void { diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index d4bb988cbab9b..62c6cd042ef93 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -1027,10 +1027,6 @@ interface Array { length: number; [n: number]: T; }` this.modifyFile(path, this.readFile(path) + content, options); } - getWidthOfTerminal(): number { - return 0; - } - write(message: string) { this.output.push(message); } diff --git a/src/testRunner/unittests/tsc/runWithoutArgs.ts b/src/testRunner/unittests/tsc/runWithoutArgs.ts index d03468798d9e3..d09ffec78f93c 100644 --- a/src/testRunner/unittests/tsc/runWithoutArgs.ts +++ b/src/testRunner/unittests/tsc/runWithoutArgs.ts @@ -7,5 +7,12 @@ namespace ts { commandLineArgs: [], environmentVariables: { TS_TEST_TERMINAL_WIDTH: "120" } }); + + verifyTsc({ + scenario: "runWithoutArgs", + subScenario: "show help with ExitStatus.DiagnosticsPresent_OutputsSkipped when host can't provide terminal width", + fs: () => loadProjectFromFiles({}), + commandLineArgs: [], + }); }); } diff --git a/src/testRunner/unittests/tsserver/session.ts b/src/testRunner/unittests/tsserver/session.ts index 9b0fd7d02086a..652879227dadc 100644 --- a/src/testRunner/unittests/tsserver/session.ts +++ b/src/testRunner/unittests/tsserver/session.ts @@ -7,7 +7,6 @@ namespace ts.server { args: [], newLine: "\n", useCaseSensitiveFileNames: true, - getWidthOfTerminal: () => 0, write(s): void { lastWrittenToHost = s; }, readFile: returnUndefined, writeFile: noop, diff --git a/src/webServer/webServer.ts b/src/webServer/webServer.ts index 5362979728939..fe3d6aa44a45d 100644 --- a/src/webServer/webServer.ts +++ b/src/webServer/webServer.ts @@ -122,7 +122,6 @@ namespace ts.server { const webPath = getWebPath(path); return webPath && host.readFile(webPath); }, - getWidthOfTerminal: () => Number.MAX_VALUE, // TODO: could we assume this is infinate? or this is zero? write: host.writeMessage.bind(host), watchFile: returnNoopFileWatcher, watchDirectory: returnNoopFileWatcher, diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js new file mode 100644 index 0000000000000..5321add2343a8 --- /dev/null +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -0,0 +1,170 @@ +Input:: +//// [/lib/lib.d.ts] + + + + +Output:: +/lib/tsc +Version FakeTSVersion +tsc: The Typescript Compiler - Version FakeTSVersion + +COMMON COMMANDS + + tsc + Compiles the current project (tsconfig.json in the working diirectory.) + + tsc app.ts util.ts + Ignoring tsconfig.json, compiles the specified files with default compiler options + + tsc -b + Build a composite project in the working directory. + + tsc --init + Creates a tsconfig.json with the recommended settings in the working directory. + + tsc -p .path/to/tsconfig.json + compiles the Typescript project located at the specified path + + tsc --help --all + An expanded version of this information, showing all possible compiler options + + tsc --noEmit + tsc --target esnext + Compiles the current project, with additional settings. + +COMMON COMPILER OPTIONS + +--help, -h: Print this message. + type: boolean + +--watch, -w: Watch input files. + type: boolean + +--pretty: Stylize errors and messages using color and context (experimental). + type: boolean + default: true + +--all: Show all compiler options. + type: boolean + +--version, -v: Print the compiler's version. + type: boolean + +--init: Initializes a TypeScript project and creates a tsconfig.json file. + type: boolean + +--project, -p: Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. + +--build, -b: Build one or more projects and their dependencies, if out of date + type: boolean + +--showConfig: Print the final configuration instead of building. + type: boolean + +--target, -t: Specify ECMAScript target version. + one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext + default: ES3 + +--module, -m: Specify module code generation. + one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext + +--lib: Specify library files to be included in the compilation. + one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref + +--allowJs: Allow javascript files to be compiled. + type: boolean + default: false + +--jsx: Specify JSX code generation. + one of: preserve, react-native, react, react-jsx, react-jsxdev + default: undefined + +--declaration, -d: Generates corresponding '.d.ts' file. + type: boolean + default: `false`, unless `composite` is set + +--declarationMap: Generates a sourcemap for each corresponding '.d.ts' file. + type: boolean + default: false + +--sourceMap: Generates corresponding '.map' file. + type: boolean + default: false + +--outFile: Concatenate and emit output to single file. + +--outDir: Redirect output structure to the directory. + +--removeComments: Do not emit comments to output. + type: boolean + default: false + +--noEmit: Do not emit outputs. + type: boolean + default: false + +--strict: Enable all strict type-checking options. + type: boolean + default: false + +--noImplicitAny: Raise error on expressions and declarations with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set + +--strictNullChecks: Enable strict null checks. + type: boolean + default: `false`, unless `strict` is set + +--strictFunctionTypes: Enable strict checking of function types. + type: boolean + default: `false`, unless `strict` is set + +--strictBindCallApply: Enable strict 'bind', 'call', and 'apply' methods on functions. + type: boolean + default: `false`, unless `strict` is set + +--strictPropertyInitialization: Enable strict checking of property initialization in classes. + type: boolean + default: `false`, unless `strict` is set + +--strictOptionalProperties: Enable strict checking of optional properties. + type: boolean + +--noImplicitThis: Raise error on 'this' expressions with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set + +--useUnknownInCatchVariables: Type catch clause variables as 'unknown' instead of 'any'. + type: boolean + +--alwaysStrict: Parse in strict mode and emit "use strict" for each source file. + type: boolean + default: `false`, unless `strict` is set + +--noUnusedLocals: Report errors on unused locals. + type: boolean + default: false + +--noUnusedParameters: Report errors on unused parameters. + type: boolean + default: false + +--noImplicitReturns: Report error when not all code paths in function return a value. + type: boolean + default: false + +--noFallthroughCasesInSwitch: Report errors for fallthrough cases in switch statement. + type: boolean + +--types: Type declaration files to be included in compilation. + +--esModuleInterop: Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. + type: boolean + default: false + +You can learn about all of the compiler options at https://aka.ms/tsconfig-reference + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 344667e08b41d..5321add2343a8 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -7,8 +7,8 @@ Input:: Output:: /lib/tsc Version FakeTSVersion -tsc: The Typescript Compiler - Version FakeTSVersion   -  TS  +tsc: The Typescript Compiler - Version FakeTSVersion + COMMON COMMANDS tsc @@ -35,129 +35,133 @@ tsc: The Typescript Compiler - Version FakeTSVersion COMMON COMPILER OPTIONS - --help, -h Print this message. - type: boolean +--help, -h: Print this message. + type: boolean + +--watch, -w: Watch input files. + type: boolean + +--pretty: Stylize errors and messages using color and context (experimental). + type: boolean + default: true + +--all: Show all compiler options. + type: boolean + +--version, -v: Print the compiler's version. + type: boolean - --watch, -w Watch input files. - type: boolean +--init: Initializes a TypeScript project and creates a tsconfig.json file. + type: boolean - --pretty Stylize errors and messages using color and context (experimental). - type: boolean - default: true +--project, -p: Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. - --all Show all compiler options. - type: boolean +--build, -b: Build one or more projects and their dependencies, if out of date + type: boolean - --version, -v Print the compiler's version. - type: boolean +--showConfig: Print the final configuration instead of building. + type: boolean - --init Initializes a TypeScript project and creates a tsconfig.json file. - type: boolean +--target, -t: Specify ECMAScript target version. + one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext + default: ES3 - --project, -p Compile the project given the path to its configuration file, or to a folder with a 't sconfig.json'. - --build, -b Build one or more projects and their dependencies, if out of date - type: boolean +--module, -m: Specify module code generation. + one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext - --showConfig Print the final configuration instead of building. - type: boolean +--lib: Specify library files to be included in the compilation. + one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref - --target, -t Specify ECMAScript target version. - one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext - default: ES3 +--allowJs: Allow javascript files to be compiled. + type: boolean + default: false - --module, -m Specify module code generation. - one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext +--jsx: Specify JSX code generation. + one of: preserve, react-native, react, react-jsx, react-jsxdev + default: undefined - --lib Specify library files to be included in the compilation. - one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, do m.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015 .core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.pr oxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2 017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es201 8.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es 2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise , es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.pro mise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable , esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +--declaration, -d: Generates corresponding '.d.ts' file. + type: boolean + default: `false`, unless `composite` is set - --allowJs Allow javascript files to be compiled. - type: boolean - default: false +--declarationMap: Generates a sourcemap for each corresponding '.d.ts' file. + type: boolean + default: false - --jsx Specify JSX code generation. - one of: preserve, react-native, react, react-jsx, react-jsxdev - default: undefined +--sourceMap: Generates corresponding '.map' file. + type: boolean + default: false - --declaration, -d Generates corresponding '.d.ts' file. - type: boolean - default: `false`, unless `composite` is set +--outFile: Concatenate and emit output to single file. - --declarationMap Generates a sourcemap for each corresponding '.d.ts' file. - type: boolean - default: false +--outDir: Redirect output structure to the directory. - --sourceMap Generates corresponding '.map' file. - type: boolean - default: false +--removeComments: Do not emit comments to output. + type: boolean + default: false - --outFile Concatenate and emit output to single file. - --outDir Redirect output structure to the directory. - --removeComments Do not emit comments to output. - type: boolean - default: false +--noEmit: Do not emit outputs. + type: boolean + default: false - --noEmit Do not emit outputs. - type: boolean - default: false +--strict: Enable all strict type-checking options. + type: boolean + default: false - --strict Enable all strict type-checking options. - type: boolean - default: false +--noImplicitAny: Raise error on expressions and declarations with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set - --noImplicitAny Raise error on expressions and declarations with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set +--strictNullChecks: Enable strict null checks. + type: boolean + default: `false`, unless `strict` is set - --strictNullChecks Enable strict null checks. - type: boolean - default: `false`, unless `strict` is set +--strictFunctionTypes: Enable strict checking of function types. + type: boolean + default: `false`, unless `strict` is set - --strictFunctionTypes Enable strict checking of function types. - type: boolean - default: `false`, unless `strict` is set +--strictBindCallApply: Enable strict 'bind', 'call', and 'apply' methods on functions. + type: boolean + default: `false`, unless `strict` is set - --strictBindCallApply Enable strict 'bind', 'call', and 'apply' methods on functions. - type: boolean - default: `false`, unless `strict` is set +--strictPropertyInitialization: Enable strict checking of property initialization in classes. + type: boolean + default: `false`, unless `strict` is set - --strictPropertyInitialization Enable strict checking of property initialization in classes. - type: boolean - default: `false`, unless `strict` is set +--strictOptionalProperties: Enable strict checking of optional properties. + type: boolean - --strictOptionalProperties Enable strict checking of optional properties. - type: boolean +--noImplicitThis: Raise error on 'this' expressions with an implied 'any' type. + type: boolean + default: `false`, unless `strict` is set - --noImplicitThis Raise error on 'this' expressions with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set +--useUnknownInCatchVariables: Type catch clause variables as 'unknown' instead of 'any'. + type: boolean - --useUnknownInCatchVariables Type catch clause variables as 'unknown' instead of 'any'. - type: boolean +--alwaysStrict: Parse in strict mode and emit "use strict" for each source file. + type: boolean + default: `false`, unless `strict` is set - --alwaysStrict Parse in strict mode and emit "use strict" for each source file. - type: boolean - default: `false`, unless `strict` is set +--noUnusedLocals: Report errors on unused locals. + type: boolean + default: false - --noUnusedLocals Report errors on unused locals. - type: boolean - default: false +--noUnusedParameters: Report errors on unused parameters. + type: boolean + default: false - --noUnusedParameters Report errors on unused parameters. - type: boolean - default: false +--noImplicitReturns: Report error when not all code paths in function return a value. + type: boolean + default: false - --noImplicitReturns Report error when not all code paths in function return a value. - type: boolean - default: false +--noFallthroughCasesInSwitch: Report errors for fallthrough cases in switch statement. + type: boolean - --noFallthroughCasesInSwitch Report errors for fallthrough cases in switch statement. - type: boolean +--types: Type declaration files to be included in compilation. - --types Type declaration files to be included in compilation. - --esModuleInterop Enables emit interoperability between CommonJS and ES Modules via creation of namespac e objects for all imports. Implies 'allowSyntheticDefaultImports'. - type: boolean - default: false +--esModuleInterop: Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. + type: boolean + default: false You can learn about all of the compiler options at https://aka.ms/tsconfig-reference From 36de5ff31e287efa0bab5a98798d5b8df8bad767 Mon Sep 17 00:00:00 2001 From: Orta Date: Wed, 9 Jun 2021 15:43:58 +0100 Subject: [PATCH 21/21] Update baselines --- ...-when-host-can't-provide-terminal-width.js | 248 ++++++++---------- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 248 ++++++++---------- 2 files changed, 228 insertions(+), 268 deletions(-) diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index 5321add2343a8..205fc0e1c45d8 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -7,161 +7,141 @@ Input:: Output:: /lib/tsc Version FakeTSVersion -tsc: The Typescript Compiler - Version FakeTSVersion +tsc: The TypeScript Compiler - Version FakeTSVersion COMMON COMMANDS tsc - Compiles the current project (tsconfig.json in the working diirectory.) + Compiles the current project (tsconfig.json in the working directory.) - tsc app.ts util.ts - Ignoring tsconfig.json, compiles the specified files with default compiler options + tsc app.ts util.ts + Ignoring tsconfig.json, compiles the specified files with default compiler options - tsc -b - Build a composite project in the working directory. + tsc -b + Build a composite project in the working directory. - tsc --init - Creates a tsconfig.json with the recommended settings in the working directory. + tsc --init + Creates a tsconfig.json with the recommended settings in the working directory. - tsc -p .path/to/tsconfig.json - compiles the Typescript project located at the specified path + tsc -p .path/to/tsconfig.json + Compiles the TypeScript project located at the specified path - tsc --help --all - An expanded version of this information, showing all possible compiler options + tsc --help --all + An expanded version of this information, showing all possible compiler options - tsc --noEmit - tsc --target esnext - Compiles the current project, with additional settings. + tsc --noEmit + tsc --target esnext + Compiles the current project, with additional settings -COMMON COMPILER OPTIONS - ---help, -h: Print this message. - type: boolean - ---watch, -w: Watch input files. - type: boolean - ---pretty: Stylize errors and messages using color and context (experimental). - type: boolean - default: true - ---all: Show all compiler options. - type: boolean - ---version, -v: Print the compiler's version. - type: boolean - ---init: Initializes a TypeScript project and creates a tsconfig.json file. - type: boolean - ---project, -p: Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. - ---build, -b: Build one or more projects and their dependencies, if out of date - type: boolean - ---showConfig: Print the final configuration instead of building. - type: boolean - ---target, -t: Specify ECMAScript target version. - one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext - default: ES3 - ---module, -m: Specify module code generation. - one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext - ---lib: Specify library files to be included in the compilation. - one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref - ---allowJs: Allow javascript files to be compiled. - type: boolean - default: false - ---jsx: Specify JSX code generation. - one of: preserve, react-native, react, react-jsx, react-jsxdev - default: undefined +COMMAND LINE FLAGS ---declaration, -d: Generates corresponding '.d.ts' file. - type: boolean - default: `false`, unless `composite` is set +--help, -h +Print this message. ---declarationMap: Generates a sourcemap for each corresponding '.d.ts' file. - type: boolean - default: false +--watch, -w +Watch input files. ---sourceMap: Generates corresponding '.map' file. - type: boolean - default: false +--all +Show all compiler options. ---outFile: Concatenate and emit output to single file. +--version, -v +Print the compiler's version. ---outDir: Redirect output structure to the directory. +--init +Initializes a TypeScript project and creates a tsconfig.json file. ---removeComments: Do not emit comments to output. - type: boolean - default: false +--project, -p +Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. ---noEmit: Do not emit outputs. - type: boolean - default: false +--build, -b +Build one or more projects and their dependencies, if out of date ---strict: Enable all strict type-checking options. - type: boolean - default: false +--showConfig +Print the final configuration instead of building. ---noImplicitAny: Raise error on expressions and declarations with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set - ---strictNullChecks: Enable strict null checks. - type: boolean - default: `false`, unless `strict` is set - ---strictFunctionTypes: Enable strict checking of function types. - type: boolean - default: `false`, unless `strict` is set - ---strictBindCallApply: Enable strict 'bind', 'call', and 'apply' methods on functions. - type: boolean - default: `false`, unless `strict` is set - ---strictPropertyInitialization: Enable strict checking of property initialization in classes. - type: boolean - default: `false`, unless `strict` is set - ---strictOptionalProperties: Enable strict checking of optional properties. - type: boolean - ---noImplicitThis: Raise error on 'this' expressions with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set - ---useUnknownInCatchVariables: Type catch clause variables as 'unknown' instead of 'any'. - type: boolean - ---alwaysStrict: Parse in strict mode and emit "use strict" for each source file. - type: boolean - default: `false`, unless `strict` is set - ---noUnusedLocals: Report errors on unused locals. - type: boolean - default: false - ---noUnusedParameters: Report errors on unused parameters. - type: boolean - default: false - ---noImplicitReturns: Report error when not all code paths in function return a value. - type: boolean - default: false - ---noFallthroughCasesInSwitch: Report errors for fallthrough cases in switch statement. - type: boolean - ---types: Type declaration files to be included in compilation. +COMMON COMPILER OPTIONS ---esModuleInterop: Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. - type: boolean - default: false +--pretty +Stylize errors and messages using color and context (experimental). +type: boolean +default: true + +--target, -t +Specify ECMAScript target version. +one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext +default: ES3 + +--module, -m +Specify module code generation. +one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext + +--lib +Specify library files to be included in the compilation. +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref + +--allowJs +Allow javascript files to be compiled. +type: boolean +default: false + +--checkJs +Report errors in .js files. +type: boolean +default: false + +--jsx +Specify JSX code generation. +one of: preserve, react-native, react, react-jsx, react-jsxdev +default: undefined + +--declaration, -d +Generates corresponding '.d.ts' file. +type: boolean +default: `false`, unless `composite` is set + +--declarationMap +Generates a sourcemap for each corresponding '.d.ts' file. +type: boolean +default: false + +--emitDeclarationOnly +Only emit '.d.ts' declaration files. +type: boolean +default: false + +--sourceMap +Generates corresponding '.map' file. +type: boolean +default: false + +--outFile +Concatenate and emit output to single file. + +--outDir +Redirect output structure to the directory. + +--removeComments +Do not emit comments to output. +type: boolean +default: false + +--noEmit +Do not emit outputs. +type: boolean +default: false + +--strict +Enable all strict type-checking options. +type: boolean +default: false + +--types +Type declaration files to be included in compilation. + +--esModuleInterop +Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. +type: boolean +default: false You can learn about all of the compiler options at https://aka.ms/tsconfig-reference diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 5321add2343a8..205fc0e1c45d8 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -7,161 +7,141 @@ Input:: Output:: /lib/tsc Version FakeTSVersion -tsc: The Typescript Compiler - Version FakeTSVersion +tsc: The TypeScript Compiler - Version FakeTSVersion COMMON COMMANDS tsc - Compiles the current project (tsconfig.json in the working diirectory.) + Compiles the current project (tsconfig.json in the working directory.) - tsc app.ts util.ts - Ignoring tsconfig.json, compiles the specified files with default compiler options + tsc app.ts util.ts + Ignoring tsconfig.json, compiles the specified files with default compiler options - tsc -b - Build a composite project in the working directory. + tsc -b + Build a composite project in the working directory. - tsc --init - Creates a tsconfig.json with the recommended settings in the working directory. + tsc --init + Creates a tsconfig.json with the recommended settings in the working directory. - tsc -p .path/to/tsconfig.json - compiles the Typescript project located at the specified path + tsc -p .path/to/tsconfig.json + Compiles the TypeScript project located at the specified path - tsc --help --all - An expanded version of this information, showing all possible compiler options + tsc --help --all + An expanded version of this information, showing all possible compiler options - tsc --noEmit - tsc --target esnext - Compiles the current project, with additional settings. + tsc --noEmit + tsc --target esnext + Compiles the current project, with additional settings -COMMON COMPILER OPTIONS - ---help, -h: Print this message. - type: boolean - ---watch, -w: Watch input files. - type: boolean - ---pretty: Stylize errors and messages using color and context (experimental). - type: boolean - default: true - ---all: Show all compiler options. - type: boolean - ---version, -v: Print the compiler's version. - type: boolean - ---init: Initializes a TypeScript project and creates a tsconfig.json file. - type: boolean - ---project, -p: Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. - ---build, -b: Build one or more projects and their dependencies, if out of date - type: boolean - ---showConfig: Print the final configuration instead of building. - type: boolean - ---target, -t: Specify ECMAScript target version. - one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext - default: ES3 - ---module, -m: Specify module code generation. - one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext - ---lib: Specify library files to be included in the compilation. - one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref - ---allowJs: Allow javascript files to be compiled. - type: boolean - default: false - ---jsx: Specify JSX code generation. - one of: preserve, react-native, react, react-jsx, react-jsxdev - default: undefined +COMMAND LINE FLAGS ---declaration, -d: Generates corresponding '.d.ts' file. - type: boolean - default: `false`, unless `composite` is set +--help, -h +Print this message. ---declarationMap: Generates a sourcemap for each corresponding '.d.ts' file. - type: boolean - default: false +--watch, -w +Watch input files. ---sourceMap: Generates corresponding '.map' file. - type: boolean - default: false +--all +Show all compiler options. ---outFile: Concatenate and emit output to single file. +--version, -v +Print the compiler's version. ---outDir: Redirect output structure to the directory. +--init +Initializes a TypeScript project and creates a tsconfig.json file. ---removeComments: Do not emit comments to output. - type: boolean - default: false +--project, -p +Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. ---noEmit: Do not emit outputs. - type: boolean - default: false +--build, -b +Build one or more projects and their dependencies, if out of date ---strict: Enable all strict type-checking options. - type: boolean - default: false +--showConfig +Print the final configuration instead of building. ---noImplicitAny: Raise error on expressions and declarations with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set - ---strictNullChecks: Enable strict null checks. - type: boolean - default: `false`, unless `strict` is set - ---strictFunctionTypes: Enable strict checking of function types. - type: boolean - default: `false`, unless `strict` is set - ---strictBindCallApply: Enable strict 'bind', 'call', and 'apply' methods on functions. - type: boolean - default: `false`, unless `strict` is set - ---strictPropertyInitialization: Enable strict checking of property initialization in classes. - type: boolean - default: `false`, unless `strict` is set - ---strictOptionalProperties: Enable strict checking of optional properties. - type: boolean - ---noImplicitThis: Raise error on 'this' expressions with an implied 'any' type. - type: boolean - default: `false`, unless `strict` is set - ---useUnknownInCatchVariables: Type catch clause variables as 'unknown' instead of 'any'. - type: boolean - ---alwaysStrict: Parse in strict mode and emit "use strict" for each source file. - type: boolean - default: `false`, unless `strict` is set - ---noUnusedLocals: Report errors on unused locals. - type: boolean - default: false - ---noUnusedParameters: Report errors on unused parameters. - type: boolean - default: false - ---noImplicitReturns: Report error when not all code paths in function return a value. - type: boolean - default: false - ---noFallthroughCasesInSwitch: Report errors for fallthrough cases in switch statement. - type: boolean - ---types: Type declaration files to be included in compilation. +COMMON COMPILER OPTIONS ---esModuleInterop: Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. - type: boolean - default: false +--pretty +Stylize errors and messages using color and context (experimental). +type: boolean +default: true + +--target, -t +Specify ECMAScript target version. +one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext +default: ES3 + +--module, -m +Specify module code generation. +one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext + +--lib +Specify library files to be included in the compilation. +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref + +--allowJs +Allow javascript files to be compiled. +type: boolean +default: false + +--checkJs +Report errors in .js files. +type: boolean +default: false + +--jsx +Specify JSX code generation. +one of: preserve, react-native, react, react-jsx, react-jsxdev +default: undefined + +--declaration, -d +Generates corresponding '.d.ts' file. +type: boolean +default: `false`, unless `composite` is set + +--declarationMap +Generates a sourcemap for each corresponding '.d.ts' file. +type: boolean +default: false + +--emitDeclarationOnly +Only emit '.d.ts' declaration files. +type: boolean +default: false + +--sourceMap +Generates corresponding '.map' file. +type: boolean +default: false + +--outFile +Concatenate and emit output to single file. + +--outDir +Redirect output structure to the directory. + +--removeComments +Do not emit comments to output. +type: boolean +default: false + +--noEmit +Do not emit outputs. +type: boolean +default: false + +--strict +Enable all strict type-checking options. +type: boolean +default: false + +--types +Type declaration files to be included in compilation. + +--esModuleInterop +Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. +type: boolean +default: false You can learn about all of the compiler options at https://aka.ms/tsconfig-reference