From 9a8badd238a12db762c6f332fe41092521866bb2 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Sat, 11 Mar 2023 00:09:47 +0000 Subject: [PATCH] Bump version to 5.0.2 and LKG --- lib/tsc.js | 259 ++++++++-------- lib/tsserver.js | 590 ++++++++++++++++++++---------------- lib/tsserverlibrary.d.ts | 6 + lib/tsserverlibrary.js | 591 +++++++++++++++++++++---------------- lib/typescript.d.ts | 6 + lib/typescript.js | 590 ++++++++++++++++++++---------------- lib/typingsInstaller.js | 9 +- package.json | 2 +- src/compiler/corePublic.ts | 2 +- 9 files changed, 1147 insertions(+), 908 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index 92bf3cf998750..455e89ea50ece 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -23,7 +23,7 @@ var __export = (target, all) => { // src/compiler/corePublic.ts var versionMajorMinor = "5.0"; -var version = `${versionMajorMinor}.1-rc`; +var version = "5.0.2"; // src/compiler/core.ts var emptyArray = []; @@ -3854,6 +3854,7 @@ function diagnosticCategoryName(d, lowerCase = true) { } var ModuleResolutionKind = /* @__PURE__ */ ((ModuleResolutionKind2) => { ModuleResolutionKind2[ModuleResolutionKind2["Classic"] = 1] = "Classic"; + ModuleResolutionKind2[ModuleResolutionKind2["NodeJs"] = 2] = "NodeJs"; ModuleResolutionKind2[ModuleResolutionKind2["Node10"] = 2] = "Node10"; ModuleResolutionKind2[ModuleResolutionKind2["Node16"] = 3] = "Node16"; ModuleResolutionKind2[ModuleResolutionKind2["NodeNext"] = 99] = "NodeNext"; @@ -6894,12 +6895,14 @@ var Diagnostics = { Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."), An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."), Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."), - Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecat_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`), - Flag_0_is_deprecated_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Flag_0_is_deprecated_Please_remove_it_from_your_configuration_5102", "Flag '{0}' is deprecated. Please remove it from your configuration."), + Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprec_5101", `Option '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`), + Option_0_has_been_removed_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Option_0_has_been_removed_Please_remove_it_from_your_configuration_5102", "Option '{0}' has been removed. Please remove it from your configuration."), Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."), Option_0_is_redundant_and_cannot_be_specified_with_option_1: diag(5104, 1 /* Error */, "Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104", "Option '{0}' is redundant and cannot be specified with option '{1}'."), Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System: diag(5105, 1 /* Error */, "Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System_5105", "Option 'verbatimModuleSyntax' cannot be used when 'module' is set to 'UMD', 'AMD', or 'System'."), Use_0_instead: diag(5106, 3 /* Message */, "Use_0_instead_5106", "Use '{0}' instead."), + Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error: diag(5107, 1 /* Error */, "Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDepr_5107", `Option '{0}={1}' is deprecated and will stop functioning in TypeScript {2}. Specify compilerOption '"ignoreDeprecations": "{3}"' to silence this error.`), + Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."), Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."), Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), @@ -58167,6 +58170,9 @@ function createTypeChecker(host) { function isTypeSubtypeOf(source, target) { return isTypeRelatedTo(source, target, subtypeRelation); } + function isTypeStrictSubtypeOf(source, target) { + return isTypeRelatedTo(source, target, strictSubtypeRelation); + } function isTypeAssignableTo(source, target) { return isTypeRelatedTo(source, target, assignableRelation); } @@ -60075,7 +60081,7 @@ function createTypeChecker(host) { 0 /* None */ ); } - } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) { + } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => t === target2 || !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) { result2 &= propertiesRelatedTo( source2, target2, @@ -65262,7 +65268,7 @@ function createTypeChecker(host) { const narrowedType = mapType(candidate, (c) => { const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName); const matching = discriminant && getConstituentTypeForKeyType(type, discriminant); - const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType); + const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType); return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated; }); return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); @@ -112911,6 +112917,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2 } = createProgramOptions; let { oldProgram } = createProgramOptions; + const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations)); let processingDefaultLibFiles; let processingOtherFiles; let files; @@ -115337,127 +115344,131 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config } } } - function getVersionForDeprecationDiagnostics(reportInvalidIgnoreDeprecations) { - const version2 = typeScriptVersion2 || versionMajorMinor; + function getIgnoreDeprecationsVersion() { const ignoreDeprecations = options.ignoreDeprecations; if (ignoreDeprecations) { - if (ignoreDeprecations === "5.0" /* v5_0 */ && (version2 === "5.0" /* v5_0 */ || version2 === "5.5" /* v5_5 */)) { - return; - } else if (reportInvalidIgnoreDeprecations) { - createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations); - } + if (ignoreDeprecations === "5.0") { + return new Version(ignoreDeprecations); + } + reportInvalidIgnoreDeprecations(); + } + return Version.zero; + } + function checkDeprecations(deprecatedIn, removedIn, createDiagnostic, fn) { + const deprecatedInVersion = new Version(deprecatedIn); + const removedInVersion = new Version(removedIn); + const typescriptVersion = new Version(typeScriptVersion2 || versionMajorMinor); + const ignoreDeprecationsVersion = getIgnoreDeprecationsVersion(); + const mustBeRemoved = !(removedInVersion.compareTo(typescriptVersion) === 1 /* GreaterThan */); + const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === -1 /* LessThan */; + if (mustBeRemoved || canBeSilenced) { + fn((name, value, useInstead) => { + if (mustBeRemoved) { + if (value === void 0) { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name); + } else { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value); + } + } else { + if (value === void 0) { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn); + } else { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn); + } + } + }); } - return version2; } function verifyDeprecatedCompilerOptions() { - const version2 = getVersionForDeprecationDiagnostics( - /*reportInvalidIgnoreDeprecations*/ - true - ); - if (!version2) - return; - if (options.target === 0 /* ES3 */) { - createDeprecatedDiagnosticForOption(version2, "target", "ES3"); - } - if (options.noImplicitUseStrict) { - createDeprecatedDiagnosticForOption(version2, "noImplicitUseStrict"); - } - if (options.keyofStringsOnly) { - createDeprecatedDiagnosticForOption(version2, "keyofStringsOnly"); - } - if (options.suppressExcessPropertyErrors) { - createDeprecatedDiagnosticForOption(version2, "suppressExcessPropertyErrors"); - } - if (options.suppressImplicitAnyIndexErrors) { - createDeprecatedDiagnosticForOption(version2, "suppressImplicitAnyIndexErrors"); - } - if (options.noStrictGenericChecks) { - createDeprecatedDiagnosticForOption(version2, "noStrictGenericChecks"); - } - if (options.charset) { - createDeprecatedDiagnosticForOption(version2, "charset"); - } - if (options.out) { - createDeprecatedDiagnosticForOption(version2, "out"); - } - if (options.importsNotUsedAsValues) { - createDeprecatedDiagnosticForOption( - version2, - "importsNotUsedAsValues", - /*value*/ - void 0, - "verbatimModuleSyntax" - ); - } - if (options.preserveValueImports) { - createDeprecatedDiagnosticForOption( - version2, - "preserveValueImports", - /*value*/ - void 0, - "verbatimModuleSyntax" - ); - } - } - function verifyDeprecatedProjectReference(ref, parentFile, index) { - if (ref.prepend) { - const version2 = getVersionForDeprecationDiagnostics( - /*reportInvalidIgnoreDeprecations*/ - false - ); - if (version2) { - createDeprecatedOptionForVersionDiagnostic( - version2, - (message, arg0, arg1, arg2) => createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2), - "prepend" + function createDiagnostic(name, value, useInstead, message, arg0, arg1, arg2, arg3) { + if (useInstead) { + const details = chainDiagnosticMessages( + /*details*/ + void 0, + Diagnostics.Use_0_instead, + useInstead + ); + const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2, arg3); + createDiagnosticForOption( + /*onKey*/ + !value, + name, + /*option2*/ + void 0, + chain + ); + } else { + createDiagnosticForOption( + /*onKey*/ + !value, + name, + /*option2*/ + void 0, + message, + arg0, + arg1, + arg2, + arg3 ); } } + checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => { + if (options.target === 0 /* ES3 */) { + createDeprecatedDiagnostic("target", "ES3"); + } + if (options.noImplicitUseStrict) { + createDeprecatedDiagnostic("noImplicitUseStrict"); + } + if (options.keyofStringsOnly) { + createDeprecatedDiagnostic("keyofStringsOnly"); + } + if (options.suppressExcessPropertyErrors) { + createDeprecatedDiagnostic("suppressExcessPropertyErrors"); + } + if (options.suppressImplicitAnyIndexErrors) { + createDeprecatedDiagnostic("suppressImplicitAnyIndexErrors"); + } + if (options.noStrictGenericChecks) { + createDeprecatedDiagnostic("noStrictGenericChecks"); + } + if (options.charset) { + createDeprecatedDiagnostic("charset"); + } + if (options.out) { + createDeprecatedDiagnostic( + "out", + /*value*/ + void 0, + "outFile" + ); + } + if (options.importsNotUsedAsValues) { + createDeprecatedDiagnostic( + "importsNotUsedAsValues", + /*value*/ + void 0, + "verbatimModuleSyntax" + ); + } + if (options.preserveValueImports) { + createDeprecatedDiagnostic( + "preserveValueImports", + /*value*/ + void 0, + "verbatimModuleSyntax" + ); + } + }); } - function createDeprecatedDiagnosticForOption(version2, name, value, useInstead) { - return createDeprecatedOptionForVersionDiagnostic( - version2, - (message, arg0, arg1, arg2) => { - if (useInstead) { - const details = chainDiagnosticMessages( - /*details*/ - void 0, - Diagnostics.Use_0_instead, - useInstead - ); - const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2); - createDiagnosticForOption( - /*onKey*/ - !value, - name, - /*option2*/ - void 0, - chain - ); - } else { - createDiagnosticForOption( - /*onKey*/ - !value, - name, - /*option2*/ - void 0, - message, - arg0, - arg1, - arg2 - ); - } - }, - name, - value - ); - } - function createDeprecatedOptionForVersionDiagnostic(version2, createDiagnostic, name, value) { - if (version2 === "6.0" /* v6_0 */) { - createDiagnostic(Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name); - } else { - createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */); + function verifyDeprecatedProjectReference(ref, parentFile, index) { + function createDiagnostic(_name, _value, _useInstead, message, arg0, arg1, arg2, arg3) { + createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2, arg3); } + checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => { + if (ref.prepend) { + createDeprecatedDiagnostic("prepend"); + } + }); } function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) { var _a3; @@ -115710,25 +115721,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config arg1 ); } - function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2) { + function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2, arg3) { const referencesSyntax = firstDefined( getTsConfigPropArray(sourceFile || options.configFile, "references"), (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0 ); if (referencesSyntax && referencesSyntax.elements.length > index) { - programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2)); + programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2, arg3)); } else { - programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2)); + programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3)); } } - function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2) { + function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2, arg3) { const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); - const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2); + const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2, arg3); if (needCompilerDiagnostic) { if ("messageText" in message) { programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message)); } else { - programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2)); + programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3)); } } } @@ -115747,13 +115758,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config } return _compilerOptionsObjectLiteralSyntax || void 0; } - function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2) { + function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2, arg3) { const props = getPropertyAssignment(objectLiteral, key1, key2); for (const prop of props) { if ("messageText" in message) { programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message)); } else { - programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2)); + programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2, arg3)); } } return !!props.length; diff --git a/lib/tsserver.js b/lib/tsserver.js index 20cb517f86aaa..31ae89cd7fee9 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -62,7 +62,6 @@ __export(server_exports, { ContextFlags: () => ContextFlags, CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter, Debug: () => Debug, - DeprecationVersion: () => DeprecationVersion, DiagnosticCategory: () => DiagnosticCategory, Diagnostics: () => Diagnostics, DocumentHighlights: () => DocumentHighlights, @@ -2288,7 +2287,7 @@ module.exports = __toCommonJS(server_exports); // src/compiler/corePublic.ts var versionMajorMinor = "5.0"; -var version = `${versionMajorMinor}.1-rc`; +var version = "5.0.2"; var Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -6885,6 +6884,7 @@ function diagnosticCategoryName(d, lowerCase = true) { } var ModuleResolutionKind = /* @__PURE__ */ ((ModuleResolutionKind3) => { ModuleResolutionKind3[ModuleResolutionKind3["Classic"] = 1] = "Classic"; + ModuleResolutionKind3[ModuleResolutionKind3["NodeJs"] = 2] = "NodeJs"; ModuleResolutionKind3[ModuleResolutionKind3["Node10"] = 2] = "Node10"; ModuleResolutionKind3[ModuleResolutionKind3["Node16"] = 3] = "Node16"; ModuleResolutionKind3[ModuleResolutionKind3["NodeNext"] = 99] = "NodeNext"; @@ -7449,12 +7449,6 @@ var commentPragmas = { kind: 4 /* MultiLine */ } }; -var DeprecationVersion = /* @__PURE__ */ ((DeprecationVersion2) => { - DeprecationVersion2["v5_0"] = "5.0"; - DeprecationVersion2["v5_5"] = "5.5"; - DeprecationVersion2["v6_0"] = "6.0"; - return DeprecationVersion2; -})(DeprecationVersion || {}); // src/compiler/sys.ts function generateDjb2Hash(data) { @@ -10358,12 +10352,14 @@ var Diagnostics = { Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."), An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."), Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."), - Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecat_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`), - Flag_0_is_deprecated_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Flag_0_is_deprecated_Please_remove_it_from_your_configuration_5102", "Flag '{0}' is deprecated. Please remove it from your configuration."), + Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprec_5101", `Option '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`), + Option_0_has_been_removed_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Option_0_has_been_removed_Please_remove_it_from_your_configuration_5102", "Option '{0}' has been removed. Please remove it from your configuration."), Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."), Option_0_is_redundant_and_cannot_be_specified_with_option_1: diag(5104, 1 /* Error */, "Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104", "Option '{0}' is redundant and cannot be specified with option '{1}'."), Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System: diag(5105, 1 /* Error */, "Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System_5105", "Option 'verbatimModuleSyntax' cannot be used when 'module' is set to 'UMD', 'AMD', or 'System'."), Use_0_instead: diag(5106, 3 /* Message */, "Use_0_instead_5106", "Use '{0}' instead."), + Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error: diag(5107, 1 /* Error */, "Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDepr_5107", `Option '{0}={1}' is deprecated and will stop functioning in TypeScript {2}. Specify compilerOption '"ignoreDeprecations": "{3}"' to silence this error.`), + Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."), Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."), Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), @@ -62774,6 +62770,9 @@ function createTypeChecker(host) { function isTypeSubtypeOf(source, target) { return isTypeRelatedTo(source, target, subtypeRelation); } + function isTypeStrictSubtypeOf(source, target) { + return isTypeRelatedTo(source, target, strictSubtypeRelation); + } function isTypeAssignableTo(source, target) { return isTypeRelatedTo(source, target, assignableRelation); } @@ -64682,7 +64681,7 @@ function createTypeChecker(host) { 0 /* None */ ); } - } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) { + } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => t === target2 || !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) { result2 &= propertiesRelatedTo( source2, target2, @@ -69869,7 +69868,7 @@ function createTypeChecker(host) { const narrowedType = mapType(candidate, (c) => { const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName); const matching = discriminant && getConstituentTypeForKeyType(type, discriminant); - const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType); + const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType); return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated; }); return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); @@ -117754,6 +117753,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions; let { oldProgram } = createProgramOptions; + const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations)); let processingDefaultLibFiles; let processingOtherFiles; let files; @@ -120180,127 +120180,131 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config } } } - function getVersionForDeprecationDiagnostics(reportInvalidIgnoreDeprecations) { - const version2 = typeScriptVersion3 || versionMajorMinor; + function getIgnoreDeprecationsVersion() { const ignoreDeprecations = options.ignoreDeprecations; if (ignoreDeprecations) { - if (ignoreDeprecations === "5.0" /* v5_0 */ && (version2 === "5.0" /* v5_0 */ || version2 === "5.5" /* v5_5 */)) { - return; - } else if (reportInvalidIgnoreDeprecations) { - createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations); - } + if (ignoreDeprecations === "5.0") { + return new Version(ignoreDeprecations); + } + reportInvalidIgnoreDeprecations(); + } + return Version.zero; + } + function checkDeprecations(deprecatedIn, removedIn, createDiagnostic, fn) { + const deprecatedInVersion = new Version(deprecatedIn); + const removedInVersion = new Version(removedIn); + const typescriptVersion = new Version(typeScriptVersion3 || versionMajorMinor); + const ignoreDeprecationsVersion = getIgnoreDeprecationsVersion(); + const mustBeRemoved = !(removedInVersion.compareTo(typescriptVersion) === 1 /* GreaterThan */); + const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === -1 /* LessThan */; + if (mustBeRemoved || canBeSilenced) { + fn((name, value, useInstead) => { + if (mustBeRemoved) { + if (value === void 0) { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name); + } else { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value); + } + } else { + if (value === void 0) { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn); + } else { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn); + } + } + }); } - return version2; } function verifyDeprecatedCompilerOptions() { - const version2 = getVersionForDeprecationDiagnostics( - /*reportInvalidIgnoreDeprecations*/ - true - ); - if (!version2) - return; - if (options.target === 0 /* ES3 */) { - createDeprecatedDiagnosticForOption(version2, "target", "ES3"); - } - if (options.noImplicitUseStrict) { - createDeprecatedDiagnosticForOption(version2, "noImplicitUseStrict"); - } - if (options.keyofStringsOnly) { - createDeprecatedDiagnosticForOption(version2, "keyofStringsOnly"); - } - if (options.suppressExcessPropertyErrors) { - createDeprecatedDiagnosticForOption(version2, "suppressExcessPropertyErrors"); - } - if (options.suppressImplicitAnyIndexErrors) { - createDeprecatedDiagnosticForOption(version2, "suppressImplicitAnyIndexErrors"); - } - if (options.noStrictGenericChecks) { - createDeprecatedDiagnosticForOption(version2, "noStrictGenericChecks"); - } - if (options.charset) { - createDeprecatedDiagnosticForOption(version2, "charset"); - } - if (options.out) { - createDeprecatedDiagnosticForOption(version2, "out"); - } - if (options.importsNotUsedAsValues) { - createDeprecatedDiagnosticForOption( - version2, - "importsNotUsedAsValues", - /*value*/ - void 0, - "verbatimModuleSyntax" - ); - } - if (options.preserveValueImports) { - createDeprecatedDiagnosticForOption( - version2, - "preserveValueImports", - /*value*/ - void 0, - "verbatimModuleSyntax" - ); - } - } - function verifyDeprecatedProjectReference(ref, parentFile, index) { - if (ref.prepend) { - const version2 = getVersionForDeprecationDiagnostics( - /*reportInvalidIgnoreDeprecations*/ - false - ); - if (version2) { - createDeprecatedOptionForVersionDiagnostic( - version2, - (message, arg0, arg1, arg2) => createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2), - "prepend" + function createDiagnostic(name, value, useInstead, message, arg0, arg1, arg2, arg3) { + if (useInstead) { + const details = chainDiagnosticMessages( + /*details*/ + void 0, + Diagnostics.Use_0_instead, + useInstead + ); + const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2, arg3); + createDiagnosticForOption( + /*onKey*/ + !value, + name, + /*option2*/ + void 0, + chain + ); + } else { + createDiagnosticForOption( + /*onKey*/ + !value, + name, + /*option2*/ + void 0, + message, + arg0, + arg1, + arg2, + arg3 ); } } + checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => { + if (options.target === 0 /* ES3 */) { + createDeprecatedDiagnostic("target", "ES3"); + } + if (options.noImplicitUseStrict) { + createDeprecatedDiagnostic("noImplicitUseStrict"); + } + if (options.keyofStringsOnly) { + createDeprecatedDiagnostic("keyofStringsOnly"); + } + if (options.suppressExcessPropertyErrors) { + createDeprecatedDiagnostic("suppressExcessPropertyErrors"); + } + if (options.suppressImplicitAnyIndexErrors) { + createDeprecatedDiagnostic("suppressImplicitAnyIndexErrors"); + } + if (options.noStrictGenericChecks) { + createDeprecatedDiagnostic("noStrictGenericChecks"); + } + if (options.charset) { + createDeprecatedDiagnostic("charset"); + } + if (options.out) { + createDeprecatedDiagnostic( + "out", + /*value*/ + void 0, + "outFile" + ); + } + if (options.importsNotUsedAsValues) { + createDeprecatedDiagnostic( + "importsNotUsedAsValues", + /*value*/ + void 0, + "verbatimModuleSyntax" + ); + } + if (options.preserveValueImports) { + createDeprecatedDiagnostic( + "preserveValueImports", + /*value*/ + void 0, + "verbatimModuleSyntax" + ); + } + }); } - function createDeprecatedDiagnosticForOption(version2, name, value, useInstead) { - return createDeprecatedOptionForVersionDiagnostic( - version2, - (message, arg0, arg1, arg2) => { - if (useInstead) { - const details = chainDiagnosticMessages( - /*details*/ - void 0, - Diagnostics.Use_0_instead, - useInstead - ); - const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2); - createDiagnosticForOption( - /*onKey*/ - !value, - name, - /*option2*/ - void 0, - chain - ); - } else { - createDiagnosticForOption( - /*onKey*/ - !value, - name, - /*option2*/ - void 0, - message, - arg0, - arg1, - arg2 - ); - } - }, - name, - value - ); - } - function createDeprecatedOptionForVersionDiagnostic(version2, createDiagnostic, name, value) { - if (version2 === "6.0" /* v6_0 */) { - createDiagnostic(Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name); - } else { - createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */); + function verifyDeprecatedProjectReference(ref, parentFile, index) { + function createDiagnostic(_name, _value, _useInstead, message, arg0, arg1, arg2, arg3) { + createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2, arg3); } + checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => { + if (ref.prepend) { + createDeprecatedDiagnostic("prepend"); + } + }); } function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) { var _a3; @@ -120553,25 +120557,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config arg1 ); } - function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2) { + function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2, arg3) { const referencesSyntax = firstDefined( getTsConfigPropArray(sourceFile || options.configFile, "references"), (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0 ); if (referencesSyntax && referencesSyntax.elements.length > index) { - programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2)); + programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2, arg3)); } else { - programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2)); + programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3)); } } - function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2) { + function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2, arg3) { const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); - const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2); + const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2, arg3); if (needCompilerDiagnostic) { if ("messageText" in message) { programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message)); } else { - programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2)); + programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3)); } } } @@ -120590,13 +120594,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config } return _compilerOptionsObjectLiteralSyntax || void 0; } - function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2) { + function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2, arg3) { const props = getPropertyAssignment(objectLiteral, key1, key2); for (const prop of props) { if ("messageText" in message) { programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message)); } else { - programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2)); + programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2, arg3)); } } return !!props.length; @@ -141198,53 +141202,121 @@ function getTypeExportSpecifiers(originExportSpecifier, context) { } // src/services/codefixes/convertToTypeOnlyImport.ts -var errorCodes14 = [Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code]; +var errorCodes14 = [ + Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code, + Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code +]; var fixId13 = "convertToTypeOnlyImport"; registerCodeFix({ errorCodes: errorCodes14, getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => { - const importDeclaration = getImportDeclarationForDiagnosticSpan(context.span, context.sourceFile); - fixSingleImportDeclaration(t, importDeclaration, context); - }); - if (changes.length) { + const declaration = getDeclaration2(context.sourceFile, context.span.start); + if (declaration) { + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, context.sourceFile, declaration)); return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)]; } + return void 0; }, fixIds: [fixId13], getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) { return codeFixAll(context, errorCodes14, (changes, diag2) => { - const importDeclaration = getImportDeclarationForDiagnosticSpan(diag2, context.sourceFile); - fixSingleImportDeclaration(changes, importDeclaration, context); + const declaration = getDeclaration2(diag2.file, diag2.start); + if (declaration) { + doChange4(changes, diag2.file, declaration); + } }); } }); -function getImportDeclarationForDiagnosticSpan(span, sourceFile) { - return tryCast(getTokenAtPosition(sourceFile, span.start).parent, isImportDeclaration); +function getDeclaration2(sourceFile, pos) { + const { parent: parent2 } = getTokenAtPosition(sourceFile, pos); + return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0; } -function fixSingleImportDeclaration(changes, importDeclaration, context) { - if (!(importDeclaration == null ? void 0 : importDeclaration.importClause)) { - return; - } - const { importClause } = importDeclaration; - changes.insertText(context.sourceFile, importDeclaration.getStart() + "import".length, " type"); - if (importClause.name && importClause.namedBindings) { - changes.deleteNodeRangeExcludingEnd(context.sourceFile, importClause.name, importDeclaration.importClause.namedBindings); - changes.insertNodeBefore(context.sourceFile, importDeclaration, factory.updateImportDeclaration( - importDeclaration, - /*modifiers*/ - void 0, - factory.createImportClause( - /*isTypeOnly*/ - true, - importClause.name, - /*namedBindings*/ - void 0 - ), - importDeclaration.moduleSpecifier, - /*assertClause*/ - void 0 +function doChange4(changes, sourceFile, declaration) { + if (isImportSpecifier(declaration)) { + changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier( + declaration, + /*isTypeOnly*/ + true, + declaration.propertyName, + declaration.name )); + } else { + const importClause = declaration.importClause; + if (importClause.name && importClause.namedBindings) { + changes.replaceNodeWithNodes(sourceFile, declaration, [ + factory.createImportDeclaration( + getSynthesizedDeepClones( + declaration.modifiers, + /*includeTrivia*/ + true + ), + factory.createImportClause( + /*isTypeOnly*/ + true, + getSynthesizedDeepClone( + importClause.name, + /*includeTrivia*/ + true + ), + /*namedBindings*/ + void 0 + ), + getSynthesizedDeepClone( + declaration.moduleSpecifier, + /*includeTrivia*/ + true + ), + getSynthesizedDeepClone( + declaration.assertClause, + /*includeTrivia*/ + true + ) + ), + factory.createImportDeclaration( + getSynthesizedDeepClones( + declaration.modifiers, + /*includeTrivia*/ + true + ), + factory.createImportClause( + /*isTypeOnly*/ + true, + /*name*/ + void 0, + getSynthesizedDeepClone( + importClause.namedBindings, + /*includeTrivia*/ + true + ) + ), + getSynthesizedDeepClone( + declaration.moduleSpecifier, + /*includeTrivia*/ + true + ), + getSynthesizedDeepClone( + declaration.assertClause, + /*includeTrivia*/ + true + ) + ) + ]); + } else { + const importDeclaration = factory.updateImportDeclaration( + declaration, + declaration.modifiers, + factory.updateImportClause( + importClause, + /*isTypeOnly*/ + true, + importClause.name, + importClause.namedBindings + ), + declaration.moduleSpecifier, + declaration.assertClause + ); + changes.replaceNode(sourceFile, declaration, importDeclaration); + } } } @@ -141260,14 +141332,14 @@ registerCodeFix({ return void 0; } const { name, constraint } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, sourceFile, info)); return [createCodeFixAction(fixId14, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId14, Diagnostics.Convert_all_type_literals_to_mapped_type)]; }, fixIds: [fixId14], getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => { const info = getInfo2(diag2.file, diag2.start); if (info) { - doChange4(changes, diag2.file, info); + doChange5(changes, diag2.file, info); } }) }); @@ -141285,7 +141357,7 @@ function getInfo2(sourceFile, pos) { } return void 0; } -function doChange4(changes, sourceFile, { container, typeNode, constraint, name }) { +function doChange5(changes, sourceFile, { container, typeNode, constraint, name }) { changes.replaceNode(sourceFile, container, factory.createMappedTypeNode( /*readonlyToken*/ void 0, @@ -142878,12 +142950,12 @@ registerCodeFix({ getCodeActions(context) { const { sourceFile, span, preferences } = context; const property = getPropertyAccessExpression(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, context.sourceFile, property, preferences)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange6(t, context.sourceFile, property, preferences)); return [createCodeFixAction(fixId17, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId17, Diagnostics.Use_element_access_for_all_undeclared_properties)]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => doChange5(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences)) + getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => doChange6(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences)) }); -function doChange5(changes, sourceFile, node, preferences) { +function doChange6(changes, sourceFile, node, preferences) { const quotePreference = getQuotePreference(sourceFile, preferences); const argumentsExpression = factory.createStringLiteral(node.name.text, quotePreference === 0 /* Single */); changes.replaceNode( @@ -142905,16 +142977,16 @@ registerCodeFix({ const { sourceFile, program, span } = context; let diagnostic; const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => { - diagnostic = doChange6(t, sourceFile, span.start, program.getTypeChecker()); + diagnostic = doChange7(t, sourceFile, span.start, program.getTypeChecker()); }); return diagnostic ? [createCodeFixAction(fixId18, changes, diagnostic, fixId18, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray; }, fixIds: [fixId18], getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => { - doChange6(changes, diag2.file, diag2.start, context.program.getTypeChecker()); + doChange7(changes, diag2.file, diag2.start, context.program.getTypeChecker()); }) }); -function doChange6(changes, sourceFile, pos, checker) { +function doChange7(changes, sourceFile, pos, checker) { const token = getTokenAtPosition(sourceFile, pos); if (!isThis(token)) return void 0; @@ -142969,7 +143041,7 @@ registerCodeFix({ const info = getInfo4(sourceFile, span.start, program); if (info === void 0) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange7(t, program, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, program, info)); return [createCodeFixAction(fixId19, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId19, Diagnostics.Export_all_referenced_locals)]; }, getAllCodeActions(context) { @@ -143049,7 +143121,7 @@ function getInfo4(sourceFile, pos, program) { } return void 0; } -function doChange7(changes, program, { exportName, node, moduleSourceFile }) { +function doChange8(changes, program, { exportName, node, moduleSourceFile }) { const exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly); if (exportDeclaration) { updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]); @@ -143143,7 +143215,7 @@ registerCodeFix({ getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) { const { sourceFile, span } = context; const namedTupleMember = getNamedTupleMember(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, sourceFile, namedTupleMember)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, sourceFile, namedTupleMember)); return [createCodeFixAction(fixId20, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId20, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)]; }, fixIds: [fixId20] @@ -143152,7 +143224,7 @@ function getNamedTupleMember(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); return findAncestor(token, (t) => t.kind === 199 /* NamedTupleMember */); } -function doChange8(changes, sourceFile, namedTupleMember) { +function doChange9(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { return; } @@ -143207,7 +143279,7 @@ registerCodeFix({ return void 0; const { node, suggestedSymbol } = info; const target = getEmitScriptTarget(context.host.getCompilationSettings()); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, sourceFile, node, suggestedSymbol, target)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, node, suggestedSymbol, target)); return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId21, Diagnostics.Fix_all_detected_spelling_errors)]; }, fixIds: [fixId21], @@ -143215,7 +143287,7 @@ registerCodeFix({ const info = getInfo5(diag2.file, diag2.start, context, diag2.code); const target = getEmitScriptTarget(context.host.getCompilationSettings()); if (info) - doChange9(changes, context.sourceFile, info.node, info.suggestedSymbol, target); + doChange10(changes, context.sourceFile, info.node, info.suggestedSymbol, target); }) }); function getInfo5(sourceFile, pos, context, errorCode) { @@ -143267,7 +143339,7 @@ function getInfo5(sourceFile, pos, context, errorCode) { } return suggestedSymbol === void 0 ? void 0 : { node, suggestedSymbol }; } -function doChange9(changes, sourceFile, node, suggestedSymbol, target) { +function doChange10(changes, sourceFile, node, suggestedSymbol, target) { const suggestion = symbolName(suggestedSymbol); if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) { const valDecl = suggestedSymbol.valueDeclaration; @@ -144325,7 +144397,7 @@ registerCodeFix({ if (!nodes) return void 0; const { constructor, superCall } = nodes; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, constructor, superCall)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, constructor, superCall)); return [createCodeFixAction(fixId25, changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId25, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)]; }, fixIds: [fixId25], @@ -144338,12 +144410,12 @@ registerCodeFix({ return; const { constructor, superCall } = nodes; if (addToSeen(seenClasses, getNodeId(constructor.parent))) { - doChange10(changes, sourceFile, constructor, superCall); + doChange11(changes, sourceFile, constructor, superCall); } }); } }); -function doChange10(changes, sourceFile, constructor, superCall) { +function doChange11(changes, sourceFile, constructor, superCall) { changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall); changes.delete(sourceFile, superCall); } @@ -144367,18 +144439,18 @@ registerCodeFix({ getCodeActions(context) { const { sourceFile, span } = context; const ctr = getNode(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, ctr)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, sourceFile, ctr)); return [createCodeFixAction(fixId26, changes, Diagnostics.Add_missing_super_call, fixId26, Diagnostics.Add_all_missing_super_calls)]; }, fixIds: [fixId26], - getAllCodeActions: (context) => codeFixAll(context, errorCodes31, (changes, diag2) => doChange11(changes, context.sourceFile, getNode(diag2.file, diag2.start))) + getAllCodeActions: (context) => codeFixAll(context, errorCodes31, (changes, diag2) => doChange12(changes, context.sourceFile, getNode(diag2.file, diag2.start))) }); function getNode(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration"); return token.parent; } -function doChange11(changes, sourceFile, ctr) { +function doChange12(changes, sourceFile, ctr) { const superCall = factory.createExpressionStatement(factory.createCallExpression( factory.createSuper(), /*typeArguments*/ @@ -144401,7 +144473,7 @@ registerCodeFix({ } const changes = ts_textChanges_exports.ChangeTracker.with( context, - (changeTracker) => doChange12(changeTracker, configFile) + (changeTracker) => doChange13(changeTracker, configFile) ); return [ createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file) @@ -144413,10 +144485,10 @@ registerCodeFix({ if (configFile === void 0) { return void 0; } - doChange12(changes, configFile); + doChange13(changes, configFile); }) }); -function doChange12(changeTracker, configFile) { +function doChange13(changeTracker, configFile) { setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react")); } @@ -144433,7 +144505,7 @@ registerCodeFix({ if (info === void 0) return; const { suggestion, expression, arg } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange13(t, sourceFile, arg, expression)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, sourceFile, arg, expression)); return [createCodeFixAction(fixId27, changes, [Diagnostics.Use_0, suggestion], fixId27, Diagnostics.Use_Number_isNaN_in_all_conditions)]; }, fixIds: [fixId27], @@ -144441,7 +144513,7 @@ registerCodeFix({ return codeFixAll(context, errorCodes33, (changes, diag2) => { const info = getInfo8(context.program, diag2.file, createTextSpan(diag2.start, diag2.length)); if (info) { - doChange13(changes, diag2.file, info.arg, info.expression); + doChange14(changes, diag2.file, info.arg, info.expression); } }); } @@ -144461,7 +144533,7 @@ function getInfo8(program, sourceFile, span) { } return void 0; } -function doChange13(changes, sourceFile, arg, expression) { +function doChange14(changes, sourceFile, arg, expression) { const callExpression = factory.createCallExpression( factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")), /*typeArguments*/ @@ -144531,12 +144603,12 @@ registerCodeFix({ getCodeActions(context) { const { sourceFile, span } = context; const property = getProperty2(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, context.sourceFile, property)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, context.sourceFile, property)); return [createCodeFixAction(fixId28, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId28, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) => doChange14(changes, diag2.file, getProperty2(diag2.file, diag2.start))) + getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) => doChange15(changes, diag2.file, getProperty2(diag2.file, diag2.start))) }); -function doChange14(changes, sourceFile, node) { +function doChange15(changes, sourceFile, node) { changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer)); } function getProperty2(sourceFile, pos) { @@ -144601,14 +144673,14 @@ registerCodeFix({ if (!info) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, sourceFile, info)); return [createCodeFixAction(fixId30, changes, [Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId30, Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)]; }, fixIds: [fixId30], getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => { const info = getInfo9(diag2.file, diag2.start, diag2.code); if (info) - doChange15(changes, context.sourceFile, info); + doChange16(changes, context.sourceFile, info); }) }); function getInfo9(sourceFile, pos, diagCode) { @@ -144617,7 +144689,7 @@ function getInfo9(sourceFile, pos, diagCode) { return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 }; } } -function doChange15(changes, sourceFile, { node, className }) { +function doChange16(changes, sourceFile, { node, className }) { suppressLeadingAndTrailingTrivia(node); changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node)); } @@ -144634,7 +144706,7 @@ registerCodeFix({ fixIds: [fixIdExpression, fixIdHtmlEntity], getCodeActions(context) { const { sourceFile, preferences, span } = context; - const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16( + const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17( t, preferences, sourceFile, @@ -144642,7 +144714,7 @@ registerCodeFix({ /* useHtmlEntity */ false )); - const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16( + const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17( t, preferences, sourceFile, @@ -144656,7 +144728,7 @@ registerCodeFix({ ]; }, getAllCodeActions(context) { - return codeFixAll(context, errorCodes37, (changes, diagnostic) => doChange16(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity)); + return codeFixAll(context, errorCodes37, (changes, diagnostic) => doChange17(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity)); } }); var htmlEntity = { @@ -144666,7 +144738,7 @@ var htmlEntity = { function isValidCharacter(character) { return hasProperty(htmlEntity, character); } -function doChange16(changes, preferences, sourceFile, start2, useHtmlEntity) { +function doChange17(changes, preferences, sourceFile, start2, useHtmlEntity) { const character = sourceFile.getText()[start2]; if (!isValidCharacter(character)) { return; @@ -145142,13 +145214,13 @@ registerCodeFix({ const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken); if (syntacticDiagnostics.length) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(t, context.sourceFile, context.span.start, context.span.length, context.errorCode)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, context.sourceFile, context.span.start, context.span.length, context.errorCode)); return [createCodeFixAction(fixId32, changes, Diagnostics.Remove_unreachable_code, fixId32, Diagnostics.Remove_all_unreachable_code)]; }, fixIds: [fixId32], - getAllCodeActions: (context) => codeFixAll(context, errorCodes41, (changes, diag2) => doChange17(changes, diag2.file, diag2.start, diag2.length, diag2.code)) + getAllCodeActions: (context) => codeFixAll(context, errorCodes41, (changes, diag2) => doChange18(changes, diag2.file, diag2.start, diag2.length, diag2.code)) }); -function doChange17(changes, sourceFile, start2, length2, errorCode) { +function doChange18(changes, sourceFile, start2, length2, errorCode) { const token = getTokenAtPosition(sourceFile, start2); const statement = findAncestor(token, isStatement); if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) { @@ -145203,13 +145275,13 @@ var errorCodes42 = [Diagnostics.Unused_label.code]; registerCodeFix({ errorCodes: errorCodes42, getCodeActions(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, context.sourceFile, context.span.start)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, context.span.start)); return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unused_label, fixId33, Diagnostics.Remove_all_unused_labels)]; }, fixIds: [fixId33], - getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange18(changes, diag2.file, diag2.start)) + getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange19(changes, diag2.file, diag2.start)) }); -function doChange18(changes, sourceFile, start2) { +function doChange19(changes, sourceFile, start2) { const token = getTokenAtPosition(sourceFile, start2); const labeledStatement = cast(token.parent, isLabeledStatement); const pos = token.getStart(sourceFile); @@ -145247,7 +145319,7 @@ registerCodeFix({ } return actions2; function fix(type2, fixId51, fixAllDescription) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, sourceFile, typeNode, type2, checker)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, sourceFile, typeNode, type2, checker)); return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId51, fixAllDescription); } }, @@ -145261,11 +145333,11 @@ registerCodeFix({ return; const { typeNode, type } = info; const fixedType = typeNode.kind === 317 /* JSDocNullableType */ && fixId51 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type; - doChange19(changes, sourceFile, typeNode, fixedType, checker); + doChange20(changes, sourceFile, typeNode, fixedType, checker); }); } }); -function doChange19(changes, sourceFile, oldTypeNode, newType, checker) { +function doChange20(changes, sourceFile, oldTypeNode, newType, checker) { changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode( newType, /*enclosingDeclaration*/ @@ -145328,16 +145400,16 @@ registerCodeFix({ const callName = getCallName(sourceFile, span.start); if (!callName) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, context.sourceFile, callName)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, context.sourceFile, callName)); return [createCodeFixAction(fixId34, changes, Diagnostics.Add_missing_call_parentheses, fixId34, Diagnostics.Add_all_missing_call_parentheses)]; }, getAllCodeActions: (context) => codeFixAll(context, errorCodes44, (changes, diag2) => { const callName = getCallName(diag2.file, diag2.start); if (callName) - doChange20(changes, diag2.file, callName); + doChange21(changes, diag2.file, callName); }) }); -function doChange20(changes, sourceFile, name) { +function doChange21(changes, sourceFile, name) { changes.replaceNodeWithText(sourceFile, name, `${name.text}()`); } function getCallName(sourceFile, start2) { @@ -145369,7 +145441,7 @@ registerCodeFix({ const nodes = getNodes3(sourceFile, span.start); if (!nodes) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, nodes)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange22(t, sourceFile, nodes)); return [createCodeFixAction(fixId35, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId35, Diagnostics.Add_all_missing_async_modifiers)]; }, fixIds: [fixId35], @@ -145379,7 +145451,7 @@ registerCodeFix({ const nodes = getNodes3(diag2.file, diag2.start); if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore))) return; - doChange21(changes, context.sourceFile, nodes); + doChange22(changes, context.sourceFile, nodes); }); } }); @@ -145418,7 +145490,7 @@ function getNodes3(sourceFile, start2) { returnType: getReturnType(containingFunction) }; } -function doChange21(changes, sourceFile, { insertBefore, returnType }) { +function doChange22(changes, sourceFile, { insertBefore, returnType }) { if (returnType) { const entityName = getEntityNameFromTypeNode(returnType); if (!entityName || entityName.kind !== 79 /* Identifier */ || entityName.text !== "Promise") { @@ -145437,14 +145509,14 @@ var fixId36 = "fixPropertyOverrideAccessor"; registerCodeFix({ errorCodes: errorCodes46, getCodeActions(context) { - const edits = doChange22(context.sourceFile, context.span.start, context.span.length, context.errorCode, context); + const edits = doChange23(context.sourceFile, context.span.start, context.span.length, context.errorCode, context); if (edits) { return [createCodeFixAction(fixId36, edits, Diagnostics.Generate_get_and_set_accessors, fixId36, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)]; } }, fixIds: [fixId36], getAllCodeActions: (context) => codeFixAll(context, errorCodes46, (changes, diag2) => { - const edits = doChange22(diag2.file, diag2.start, diag2.length, diag2.code, context); + const edits = doChange23(diag2.file, diag2.start, diag2.length, diag2.code, context); if (edits) { for (const edit of edits) { changes.pushRaw(context.sourceFile, edit); @@ -145452,7 +145524,7 @@ registerCodeFix({ } }) }); -function doChange22(file, start2, length2, code, context) { +function doChange23(file, start2, length2, code, context) { let startPosition; let endPosition; if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) { @@ -145522,7 +145594,7 @@ registerCodeFix({ const token = getTokenAtPosition(sourceFile, start2); let declaration; const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => { - declaration = doChange23( + declaration = doChange24( changes2, sourceFile, token, @@ -145543,7 +145615,7 @@ registerCodeFix({ const { sourceFile, program, cancellationToken, host, preferences } = context; const markSeen = nodeSeenTracker(); return codeFixAll(context, errorCodes47, (changes, err) => { - doChange23(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences); + doChange24(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences); }); } }); @@ -145582,7 +145654,7 @@ function mapSuggestionDiagnostic(errorCode) { } return errorCode; } -function doChange23(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) { +function doChange24(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) { if (!isParameterPropertyModifier(token.kind) && token.kind !== 79 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 108 /* ThisKeyword */) { return void 0; } @@ -146493,7 +146565,7 @@ registerCodeFix({ return void 0; } const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange24(t, sourceFile, returnTypeNode, promisedTypeNode)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, sourceFile, returnTypeNode, promisedTypeNode)); return [createCodeFixAction( fixId38, changes, @@ -146509,7 +146581,7 @@ registerCodeFix({ getAllCodeActions: (context) => codeFixAll(context, errorCodes48, (changes, diag2) => { const info = getInfo12(diag2.file, context.program.getTypeChecker(), diag2.start); if (info) { - doChange24(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode); + doChange25(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode); } }) }); @@ -146536,7 +146608,7 @@ function getInfo12(sourceFile, checker, pos) { return { returnTypeNode, returnType, promisedTypeNode, promisedType }; } } -function doChange24(changes, sourceFile, returnTypeNode, promisedTypeNode) { +function doChange25(changes, sourceFile, returnTypeNode, promisedTypeNode) { changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode])); } @@ -147707,18 +147779,18 @@ registerCodeFix({ if (!info) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, context.sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, context.sourceFile, info)); return [createCodeFixAction(fixId40, changes, Diagnostics.Convert_require_to_import, fixId40, Diagnostics.Convert_all_require_to_import)]; }, fixIds: [fixId40], getAllCodeActions: (context) => codeFixAll(context, errorCodes51, (changes, diag2) => { const info = getInfo14(diag2.file, context.program, diag2.start); if (info) { - doChange25(changes, context.sourceFile, info); + doChange26(changes, context.sourceFile, info); } }) }); -function doChange25(changes, sourceFile, info) { +function doChange26(changes, sourceFile, info) { const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info; changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration( /*modifiers*/ @@ -147791,14 +147863,14 @@ registerCodeFix({ const info = getInfo15(sourceFile, start2); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, sourceFile, info, context.preferences)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, sourceFile, info, context.preferences)); return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_to_default_import, fixId41, Diagnostics.Convert_all_to_default_imports)]; }, fixIds: [fixId41], getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => { const info = getInfo15(diag2.file, diag2.start); if (info) - doChange26(changes, diag2.file, info, context.preferences); + doChange27(changes, diag2.file, info, context.preferences); }) }); function getInfo15(sourceFile, pos) { @@ -147813,7 +147885,7 @@ function getInfo15(sourceFile, pos) { return { importNode, name, moduleSpecifier: importNode.moduleSpecifier }; } } -function doChange26(changes, sourceFile, info, preferences) { +function doChange27(changes, sourceFile, info, preferences) { changes.replaceNode(sourceFile, info.importNode, makeImport( info.name, /*namedImports*/ @@ -147859,11 +147931,11 @@ registerCodeFix({ getCodeActions: function getCodeActionsToAddMissingTypeof(context) { const { sourceFile, span } = context; const importType = getImportTypeNode(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, sourceFile, importType)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, importType)); return [createCodeFixAction(fixId43, changes, Diagnostics.Add_missing_typeof, fixId43, Diagnostics.Add_missing_typeof)]; }, fixIds: [fixId43], - getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => doChange27(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start))) + getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => doChange28(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start))) }); function getImportTypeNode(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); @@ -147871,7 +147943,7 @@ function getImportTypeNode(sourceFile, pos) { Debug.assert(token.parent.kind === 202 /* ImportType */, "Token parent should be an ImportType"); return token.parent; } -function doChange27(changes, sourceFile, importType) { +function doChange28(changes, sourceFile, importType) { const newTypeNode = factory.updateImportTypeNode( importType, importType.argument, @@ -147894,7 +147966,7 @@ registerCodeFix({ const node = findNodeToFix(sourceFile, span.start); if (!node) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, node)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, node)); return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)]; }, fixIds: [fixID2], @@ -147902,7 +147974,7 @@ registerCodeFix({ const node = findNodeToFix(context.sourceFile, diag2.start); if (!node) return void 0; - doChange28(changes, context.sourceFile, node); + doChange29(changes, context.sourceFile, node); }) }); function findNodeToFix(sourceFile, pos) { @@ -147918,7 +147990,7 @@ function findNodeToFix(sourceFile, pos) { return void 0; return binaryExpr; } -function doChange28(changeTracker, sf, node) { +function doChange29(changeTracker, sf, node) { const jsx = flattenInvalidBinaryExpr(node); if (jsx) changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment())); @@ -147952,7 +148024,7 @@ registerCodeFix({ const info = getInfo16(sourceFile, span.start); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, info)); const name = idText(info.container.name); return [createCodeFixAction(fixId44, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId44, [Diagnostics.Convert_0_to_mapped_object_type, name])]; }, @@ -147960,7 +148032,7 @@ registerCodeFix({ getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => { const info = getInfo16(diag2.file, diag2.start); if (info) - doChange29(changes, diag2.file, info); + doChange30(changes, diag2.file, info); }) }); function getInfo16(sourceFile, pos) { @@ -147976,7 +148048,7 @@ function getInfo16(sourceFile, pos) { function createTypeAliasFromInterface(declaration, type) { return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type); } -function doChange29(changes, sourceFile, { indexSignature, container }) { +function doChange30(changes, sourceFile, { indexSignature, container }) { const members = isInterfaceDeclaration(container) ? container.members : container.type.members; const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member)); const parameter = first(indexSignature.parameters); @@ -148130,7 +148202,7 @@ registerCodeFix({ const info = getInfo17(sourceFile, span.start, program); if (info === void 0) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, info.token)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info.token)); return [createCodeFixActionMaybeFixAll(fixId48, changes, Diagnostics.Convert_const_to_let, fixId48, Diagnostics.Convert_all_const_to_let)]; }, getAllCodeActions: (context) => { @@ -148141,7 +148213,7 @@ registerCodeFix({ const info = getInfo17(diag2.file, diag2.start, program); if (info) { if (addToSeen(seen, getSymbolId(info.symbol))) { - return doChange30(changes, diag2.file, info.token); + return doChange31(changes, diag2.file, info.token); } } return void 0; @@ -148164,7 +148236,7 @@ function getInfo17(sourceFile, pos, program) { return; return { symbol, token: constToken }; } -function doChange30(changes, sourceFile, token) { +function doChange31(changes, sourceFile, token) { changes.replaceNode(sourceFile, token, factory.createToken(119 /* LetKeyword */)); } @@ -148179,7 +148251,7 @@ registerCodeFix({ const info = getInfo18(sourceFile, context.span.start, context.errorCode); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(t, sourceFile, info)); return [createCodeFixAction( fixId49, changes, @@ -148192,14 +148264,14 @@ registerCodeFix({ getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, diag2) => { const info = getInfo18(diag2.file, diag2.start, diag2.code); if (info) - doChange31(changes, context.sourceFile, info); + doChange32(changes, context.sourceFile, info); }) }); function getInfo18(sourceFile, pos, _) { const node = getTokenAtPosition(sourceFile, pos); return node.kind === 26 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0; } -function doChange31(changes, sourceFile, { node }) { +function doChange32(changes, sourceFile, { node }) { const newNode = factory.createToken(27 /* CommaToken */); changes.replaceNode(sourceFile, node, newNode); } @@ -157256,7 +157328,7 @@ registerRefactor(refactorName, { Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name"); const info = getInfo19(context); Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(context.file, context.program, info, t, context.cancellationToken)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(context.file, context.program, info, t, context.cancellationToken)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } }); @@ -157309,7 +157381,7 @@ function getInfo19(context, considerPartialSpans = true) { return void 0; } } -function doChange32(exportingSourceFile, program, info, changes, cancellationToken) { +function doChange33(exportingSourceFile, program, info, changes, cancellationToken) { changeExport(exportingSourceFile, info, changes, program.getTypeChecker()); changeImports(program, info, changes, cancellationToken); } @@ -157504,7 +157576,7 @@ registerRefactor(refactorName2, { Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name"); const info = getImportConversionInfo(context); Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(context.file, context.program, t, info)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, t, info)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } }); @@ -157535,7 +157607,7 @@ function getImportConversionInfo(context, considerPartialSpans = true) { function getShouldUseDefault(program, importClause) { return getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker()); } -function doChange33(sourceFile, program, changes, info) { +function doChange34(sourceFile, program, changes, info) { const checker = program.getTypeChecker(); if (info.convertTo === 0 /* Named */) { doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, getAllowSyntheticDefaultImports(program.getCompilerOptions())); @@ -158008,7 +158080,7 @@ registerRefactor(refactorName4, { getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) { Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked"); const statements = Debug.checkDefined(getStatementsToMove(context)); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, statements, t, context.host, context.preferences)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(context.file, context.program, statements, t, context.host, context.preferences)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } }); @@ -158033,7 +158105,7 @@ function getRangeToMove(context) { afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex] }; } -function doChange34(oldFile, program, toMove, changes, host, preferences) { +function doChange35(oldFile, program, toMove, changes, host, preferences) { const checker = program.getTypeChecker(); const usage = getUsageInfo(oldFile, toMove.all, checker); const currentDirectory = getDirectoryPath(oldFile.fileName); @@ -159405,12 +159477,12 @@ function getRefactorEditsToConvertParametersToDestructuredObject(context, action return void 0; const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken); if (groupedReferences.valid) { - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(file, program, host, t, functionDeclaration, groupedReferences)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(file, program, host, t, functionDeclaration, groupedReferences)); return { renameFilename: void 0, renameLocation: void 0, edits }; } return { edits: [] }; } -function doChange35(sourceFile, program, host, changes, functionDeclaration, groupedReferences) { +function doChange36(sourceFile, program, host, changes, functionDeclaration, groupedReferences) { const signature = groupedReferences.signature; const newFunctionDeclarationParams = map(createNewParameters(functionDeclaration, program, host), (param) => getSynthesizedDeepClone(param)); if (signature) { @@ -160174,7 +160246,7 @@ function getRefactorEditsToConvertToOptionalChain(context, actionName2) { Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); const edits = ts_textChanges_exports.ChangeTracker.with( context, - (t) => doChange36(context.file, context.program.getTypeChecker(), t, info, actionName2) + (t) => doChange37(context.file, context.program.getTypeChecker(), t, info, actionName2) ); return { edits, renameFilename: void 0, renameLocation: void 0 }; } @@ -160330,7 +160402,7 @@ function convertOccurrences(checker, toConvert, occurrences) { } return toConvert; } -function doChange36(sourceFile, checker, changes, info, _actionName) { +function doChange37(sourceFile, checker, changes, info, _actionName) { const { finalExpression, occurrences, expression } = info; const firstOccurrence = occurrences[occurrences.length - 1]; const convertedChain = convertOccurrences(checker, finalExpression, occurrences); @@ -162025,7 +162097,7 @@ registerRefactor(refactorName12, { function getRefactorEditsToInferReturnType(context) { const info = getInfo21(context); if (info && !isRefactorErrorInfo(info)) { - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(context.file, t, info.declaration, info.returnTypeNode)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange38(context.file, t, info.declaration, info.returnTypeNode)); return { renameFilename: void 0, renameLocation: void 0, edits }; } return void 0; @@ -162050,7 +162122,7 @@ function getRefactorActionsToInferReturnType(context) { } return emptyArray; } -function doChange37(sourceFile, changes, declaration, typeNode) { +function doChange38(sourceFile, changes, declaration, typeNode) { const closeParen = findChildOfKind(declaration, 21 /* CloseParenToken */, sourceFile); const needParens = isArrowFunction(declaration) && closeParen === void 0; const endNode2 = needParens ? first(declaration.parameters) : closeParen; @@ -167693,7 +167765,6 @@ __export(ts_exports3, { ContextFlags: () => ContextFlags, CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter, Debug: () => Debug, - DeprecationVersion: () => DeprecationVersion, DiagnosticCategory: () => DiagnosticCategory, Diagnostics: () => Diagnostics, DocumentHighlights: () => DocumentHighlights, @@ -181643,7 +181714,6 @@ start(initializeNodeSystem(), require("os").platform()); ContextFlags, CoreServicesShimHostAdapter, Debug, - DeprecationVersion, DiagnosticCategory, Diagnostics, DocumentHighlights, diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index 34006d63b2ea5..f23fc06fcc24a 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -6991,6 +6991,12 @@ declare namespace ts { } enum ModuleResolutionKind { Classic = 1, + /** + * @deprecated + * `NodeJs` was renamed to `Node10` to better reflect the version of Node that it targets. + * Use the new name or consider switching to a modern module resolution target. + */ + NodeJs = 2, Node10 = 2, Node16 = 3, NodeNext = 99, diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index a69e846e71fc5..d15d5ed7220f3 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -35,7 +35,7 @@ var ts = (() => { "src/compiler/corePublic.ts"() { "use strict"; versionMajorMinor = "5.0"; - version = `${versionMajorMinor}.1-rc`; + version = "5.0.2"; Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -3585,7 +3585,7 @@ ${lanes.join("\n")} const name = DiagnosticCategory[d.category]; return lowerCase ? name.toLowerCase() : name; } - var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas, DeprecationVersion; + var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas; var init_types = __esm({ "src/compiler/types.ts"() { "use strict"; @@ -4686,6 +4686,7 @@ ${lanes.join("\n")} })(DiagnosticCategory || {}); ModuleResolutionKind = /* @__PURE__ */ ((ModuleResolutionKind3) => { ModuleResolutionKind3[ModuleResolutionKind3["Classic"] = 1] = "Classic"; + ModuleResolutionKind3[ModuleResolutionKind3["NodeJs"] = 2] = "NodeJs"; ModuleResolutionKind3[ModuleResolutionKind3["Node10"] = 2] = "Node10"; ModuleResolutionKind3[ModuleResolutionKind3["Node16"] = 3] = "Node16"; ModuleResolutionKind3[ModuleResolutionKind3["NodeNext"] = 99] = "NodeNext"; @@ -5250,12 +5251,6 @@ ${lanes.join("\n")} kind: 4 /* MultiLine */ } }; - DeprecationVersion = /* @__PURE__ */ ((DeprecationVersion2) => { - DeprecationVersion2["v5_0"] = "5.0"; - DeprecationVersion2["v5_5"] = "5.5"; - DeprecationVersion2["v6_0"] = "6.0"; - return DeprecationVersion2; - })(DeprecationVersion || {}); } }); @@ -8180,12 +8175,14 @@ ${lanes.join("\n")} Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."), An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."), Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."), - Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecat_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`), - Flag_0_is_deprecated_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Flag_0_is_deprecated_Please_remove_it_from_your_configuration_5102", "Flag '{0}' is deprecated. Please remove it from your configuration."), + Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprec_5101", `Option '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`), + Option_0_has_been_removed_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Option_0_has_been_removed_Please_remove_it_from_your_configuration_5102", "Option '{0}' has been removed. Please remove it from your configuration."), Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."), Option_0_is_redundant_and_cannot_be_specified_with_option_1: diag(5104, 1 /* Error */, "Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104", "Option '{0}' is redundant and cannot be specified with option '{1}'."), Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System: diag(5105, 1 /* Error */, "Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System_5105", "Option 'verbatimModuleSyntax' cannot be used when 'module' is set to 'UMD', 'AMD', or 'System'."), Use_0_instead: diag(5106, 3 /* Message */, "Use_0_instead_5106", "Use '{0}' instead."), + Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error: diag(5107, 1 /* Error */, "Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDepr_5107", `Option '{0}={1}' is deprecated and will stop functioning in TypeScript {2}. Specify compilerOption '"ignoreDeprecations": "{3}"' to silence this error.`), + Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."), Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."), Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), @@ -60582,6 +60579,9 @@ ${lanes.join("\n")} function isTypeSubtypeOf(source, target) { return isTypeRelatedTo(source, target, subtypeRelation); } + function isTypeStrictSubtypeOf(source, target) { + return isTypeRelatedTo(source, target, strictSubtypeRelation); + } function isTypeAssignableTo(source, target) { return isTypeRelatedTo(source, target, assignableRelation); } @@ -62490,7 +62490,7 @@ ${lanes.join("\n")} 0 /* None */ ); } - } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) { + } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => t === target2 || !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) { result2 &= propertiesRelatedTo( source2, target2, @@ -67677,7 +67677,7 @@ ${lanes.join("\n")} const narrowedType = mapType(candidate, (c) => { const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName); const matching = discriminant && getConstituentTypeForKeyType(type, discriminant); - const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType); + const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType); return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated; }); return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); @@ -115770,6 +115770,7 @@ ${lanes.join("\n")} const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions; let { oldProgram } = createProgramOptions; + const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations)); let processingDefaultLibFiles; let processingOtherFiles; let files; @@ -118196,127 +118197,131 @@ ${lanes.join("\n")} } } } - function getVersionForDeprecationDiagnostics(reportInvalidIgnoreDeprecations) { - const version2 = typeScriptVersion3 || versionMajorMinor; + function getIgnoreDeprecationsVersion() { const ignoreDeprecations = options.ignoreDeprecations; if (ignoreDeprecations) { - if (ignoreDeprecations === "5.0" /* v5_0 */ && (version2 === "5.0" /* v5_0 */ || version2 === "5.5" /* v5_5 */)) { - return; - } else if (reportInvalidIgnoreDeprecations) { - createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations); - } + if (ignoreDeprecations === "5.0") { + return new Version(ignoreDeprecations); + } + reportInvalidIgnoreDeprecations(); + } + return Version.zero; + } + function checkDeprecations(deprecatedIn, removedIn, createDiagnostic, fn) { + const deprecatedInVersion = new Version(deprecatedIn); + const removedInVersion = new Version(removedIn); + const typescriptVersion = new Version(typeScriptVersion3 || versionMajorMinor); + const ignoreDeprecationsVersion = getIgnoreDeprecationsVersion(); + const mustBeRemoved = !(removedInVersion.compareTo(typescriptVersion) === 1 /* GreaterThan */); + const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === -1 /* LessThan */; + if (mustBeRemoved || canBeSilenced) { + fn((name, value, useInstead) => { + if (mustBeRemoved) { + if (value === void 0) { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name); + } else { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value); + } + } else { + if (value === void 0) { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn); + } else { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn); + } + } + }); } - return version2; } function verifyDeprecatedCompilerOptions() { - const version2 = getVersionForDeprecationDiagnostics( - /*reportInvalidIgnoreDeprecations*/ - true - ); - if (!version2) - return; - if (options.target === 0 /* ES3 */) { - createDeprecatedDiagnosticForOption(version2, "target", "ES3"); - } - if (options.noImplicitUseStrict) { - createDeprecatedDiagnosticForOption(version2, "noImplicitUseStrict"); - } - if (options.keyofStringsOnly) { - createDeprecatedDiagnosticForOption(version2, "keyofStringsOnly"); - } - if (options.suppressExcessPropertyErrors) { - createDeprecatedDiagnosticForOption(version2, "suppressExcessPropertyErrors"); - } - if (options.suppressImplicitAnyIndexErrors) { - createDeprecatedDiagnosticForOption(version2, "suppressImplicitAnyIndexErrors"); - } - if (options.noStrictGenericChecks) { - createDeprecatedDiagnosticForOption(version2, "noStrictGenericChecks"); - } - if (options.charset) { - createDeprecatedDiagnosticForOption(version2, "charset"); - } - if (options.out) { - createDeprecatedDiagnosticForOption(version2, "out"); - } - if (options.importsNotUsedAsValues) { - createDeprecatedDiagnosticForOption( - version2, - "importsNotUsedAsValues", - /*value*/ - void 0, - "verbatimModuleSyntax" - ); - } - if (options.preserveValueImports) { - createDeprecatedDiagnosticForOption( - version2, - "preserveValueImports", - /*value*/ - void 0, - "verbatimModuleSyntax" - ); - } - } - function verifyDeprecatedProjectReference(ref, parentFile, index) { - if (ref.prepend) { - const version2 = getVersionForDeprecationDiagnostics( - /*reportInvalidIgnoreDeprecations*/ - false - ); - if (version2) { - createDeprecatedOptionForVersionDiagnostic( - version2, - (message, arg0, arg1, arg2) => createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2), - "prepend" + function createDiagnostic(name, value, useInstead, message, arg0, arg1, arg2, arg3) { + if (useInstead) { + const details = chainDiagnosticMessages( + /*details*/ + void 0, + Diagnostics.Use_0_instead, + useInstead + ); + const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2, arg3); + createDiagnosticForOption( + /*onKey*/ + !value, + name, + /*option2*/ + void 0, + chain + ); + } else { + createDiagnosticForOption( + /*onKey*/ + !value, + name, + /*option2*/ + void 0, + message, + arg0, + arg1, + arg2, + arg3 ); } } + checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => { + if (options.target === 0 /* ES3 */) { + createDeprecatedDiagnostic("target", "ES3"); + } + if (options.noImplicitUseStrict) { + createDeprecatedDiagnostic("noImplicitUseStrict"); + } + if (options.keyofStringsOnly) { + createDeprecatedDiagnostic("keyofStringsOnly"); + } + if (options.suppressExcessPropertyErrors) { + createDeprecatedDiagnostic("suppressExcessPropertyErrors"); + } + if (options.suppressImplicitAnyIndexErrors) { + createDeprecatedDiagnostic("suppressImplicitAnyIndexErrors"); + } + if (options.noStrictGenericChecks) { + createDeprecatedDiagnostic("noStrictGenericChecks"); + } + if (options.charset) { + createDeprecatedDiagnostic("charset"); + } + if (options.out) { + createDeprecatedDiagnostic( + "out", + /*value*/ + void 0, + "outFile" + ); + } + if (options.importsNotUsedAsValues) { + createDeprecatedDiagnostic( + "importsNotUsedAsValues", + /*value*/ + void 0, + "verbatimModuleSyntax" + ); + } + if (options.preserveValueImports) { + createDeprecatedDiagnostic( + "preserveValueImports", + /*value*/ + void 0, + "verbatimModuleSyntax" + ); + } + }); } - function createDeprecatedDiagnosticForOption(version2, name, value, useInstead) { - return createDeprecatedOptionForVersionDiagnostic( - version2, - (message, arg0, arg1, arg2) => { - if (useInstead) { - const details = chainDiagnosticMessages( - /*details*/ - void 0, - Diagnostics.Use_0_instead, - useInstead - ); - const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2); - createDiagnosticForOption( - /*onKey*/ - !value, - name, - /*option2*/ - void 0, - chain - ); - } else { - createDiagnosticForOption( - /*onKey*/ - !value, - name, - /*option2*/ - void 0, - message, - arg0, - arg1, - arg2 - ); - } - }, - name, - value - ); - } - function createDeprecatedOptionForVersionDiagnostic(version2, createDiagnostic, name, value) { - if (version2 === "6.0" /* v6_0 */) { - createDiagnostic(Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name); - } else { - createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */); + function verifyDeprecatedProjectReference(ref, parentFile, index) { + function createDiagnostic(_name, _value, _useInstead, message, arg0, arg1, arg2, arg3) { + createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2, arg3); } + checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => { + if (ref.prepend) { + createDeprecatedDiagnostic("prepend"); + } + }); } function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) { var _a3; @@ -118569,25 +118574,25 @@ ${lanes.join("\n")} arg1 ); } - function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2) { + function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2, arg3) { const referencesSyntax = firstDefined( getTsConfigPropArray(sourceFile || options.configFile, "references"), (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0 ); if (referencesSyntax && referencesSyntax.elements.length > index) { - programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2)); + programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2, arg3)); } else { - programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2)); + programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3)); } } - function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2) { + function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2, arg3) { const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); - const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2); + const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2, arg3); if (needCompilerDiagnostic) { if ("messageText" in message) { programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message)); } else { - programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2)); + programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3)); } } } @@ -118606,13 +118611,13 @@ ${lanes.join("\n")} } return _compilerOptionsObjectLiteralSyntax || void 0; } - function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2) { + function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2, arg3) { const props = getPropertyAssignment(objectLiteral, key1, key2); for (const prop of props) { if ("messageText" in message) { programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message)); } else { - programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2)); + programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2, arg3)); } } return !!props.length; @@ -139778,32 +139783,96 @@ ${lanes.join("\n")} }); // src/services/codefixes/convertToTypeOnlyImport.ts - function getImportDeclarationForDiagnosticSpan(span, sourceFile) { - return tryCast(getTokenAtPosition(sourceFile, span.start).parent, isImportDeclaration); + function getDeclaration2(sourceFile, pos) { + const { parent: parent2 } = getTokenAtPosition(sourceFile, pos); + return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0; } - function fixSingleImportDeclaration(changes, importDeclaration, context) { - if (!(importDeclaration == null ? void 0 : importDeclaration.importClause)) { - return; - } - const { importClause } = importDeclaration; - changes.insertText(context.sourceFile, importDeclaration.getStart() + "import".length, " type"); - if (importClause.name && importClause.namedBindings) { - changes.deleteNodeRangeExcludingEnd(context.sourceFile, importClause.name, importDeclaration.importClause.namedBindings); - changes.insertNodeBefore(context.sourceFile, importDeclaration, factory.updateImportDeclaration( - importDeclaration, - /*modifiers*/ - void 0, - factory.createImportClause( - /*isTypeOnly*/ - true, - importClause.name, - /*namedBindings*/ - void 0 - ), - importDeclaration.moduleSpecifier, - /*assertClause*/ - void 0 + function doChange4(changes, sourceFile, declaration) { + if (isImportSpecifier(declaration)) { + changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier( + declaration, + /*isTypeOnly*/ + true, + declaration.propertyName, + declaration.name )); + } else { + const importClause = declaration.importClause; + if (importClause.name && importClause.namedBindings) { + changes.replaceNodeWithNodes(sourceFile, declaration, [ + factory.createImportDeclaration( + getSynthesizedDeepClones( + declaration.modifiers, + /*includeTrivia*/ + true + ), + factory.createImportClause( + /*isTypeOnly*/ + true, + getSynthesizedDeepClone( + importClause.name, + /*includeTrivia*/ + true + ), + /*namedBindings*/ + void 0 + ), + getSynthesizedDeepClone( + declaration.moduleSpecifier, + /*includeTrivia*/ + true + ), + getSynthesizedDeepClone( + declaration.assertClause, + /*includeTrivia*/ + true + ) + ), + factory.createImportDeclaration( + getSynthesizedDeepClones( + declaration.modifiers, + /*includeTrivia*/ + true + ), + factory.createImportClause( + /*isTypeOnly*/ + true, + /*name*/ + void 0, + getSynthesizedDeepClone( + importClause.namedBindings, + /*includeTrivia*/ + true + ) + ), + getSynthesizedDeepClone( + declaration.moduleSpecifier, + /*includeTrivia*/ + true + ), + getSynthesizedDeepClone( + declaration.assertClause, + /*includeTrivia*/ + true + ) + ) + ]); + } else { + const importDeclaration = factory.updateImportDeclaration( + declaration, + declaration.modifiers, + factory.updateImportClause( + importClause, + /*isTypeOnly*/ + true, + importClause.name, + importClause.namedBindings + ), + declaration.moduleSpecifier, + declaration.assertClause + ); + changes.replaceNode(sourceFile, declaration, importDeclaration); + } } } var errorCodes14, fixId13; @@ -139812,24 +139881,28 @@ ${lanes.join("\n")} "use strict"; init_ts4(); init_ts_codefix(); - errorCodes14 = [Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code]; + errorCodes14 = [ + Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code, + Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code + ]; fixId13 = "convertToTypeOnlyImport"; registerCodeFix({ errorCodes: errorCodes14, getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => { - const importDeclaration = getImportDeclarationForDiagnosticSpan(context.span, context.sourceFile); - fixSingleImportDeclaration(t, importDeclaration, context); - }); - if (changes.length) { + const declaration = getDeclaration2(context.sourceFile, context.span.start); + if (declaration) { + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, context.sourceFile, declaration)); return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)]; } + return void 0; }, fixIds: [fixId13], getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) { return codeFixAll(context, errorCodes14, (changes, diag2) => { - const importDeclaration = getImportDeclarationForDiagnosticSpan(diag2, context.sourceFile); - fixSingleImportDeclaration(changes, importDeclaration, context); + const declaration = getDeclaration2(diag2.file, diag2.start); + if (declaration) { + doChange4(changes, diag2.file, declaration); + } }); } }); @@ -139851,7 +139924,7 @@ ${lanes.join("\n")} } return void 0; } - function doChange4(changes, sourceFile, { container, typeNode, constraint, name }) { + function doChange5(changes, sourceFile, { container, typeNode, constraint, name }) { changes.replaceNode(sourceFile, container, factory.createMappedTypeNode( /*readonlyToken*/ void 0, @@ -139887,14 +139960,14 @@ ${lanes.join("\n")} return void 0; } const { name, constraint } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, sourceFile, info)); return [createCodeFixAction(fixId14, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId14, Diagnostics.Convert_all_type_literals_to_mapped_type)]; }, fixIds: [fixId14], getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => { const info = getInfo2(diag2.file, diag2.start); if (info) { - doChange4(changes, diag2.file, info); + doChange5(changes, diag2.file, info); } }) }); @@ -141496,7 +141569,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts - function doChange5(changes, sourceFile, node, preferences) { + function doChange6(changes, sourceFile, node, preferences) { const quotePreference = getQuotePreference(sourceFile, preferences); const argumentsExpression = factory.createStringLiteral(node.name.text, quotePreference === 0 /* Single */); changes.replaceNode( @@ -141524,16 +141597,16 @@ ${lanes.join("\n")} getCodeActions(context) { const { sourceFile, span, preferences } = context; const property = getPropertyAccessExpression(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, context.sourceFile, property, preferences)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange6(t, context.sourceFile, property, preferences)); return [createCodeFixAction(fixId17, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId17, Diagnostics.Use_element_access_for_all_undeclared_properties)]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => doChange5(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences)) + getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => doChange6(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences)) }); } }); // src/services/codefixes/fixImplicitThis.ts - function doChange6(changes, sourceFile, pos, checker) { + function doChange7(changes, sourceFile, pos, checker) { const token = getTokenAtPosition(sourceFile, pos); if (!isThis(token)) return void 0; @@ -141588,13 +141661,13 @@ ${lanes.join("\n")} const { sourceFile, program, span } = context; let diagnostic; const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => { - diagnostic = doChange6(t, sourceFile, span.start, program.getTypeChecker()); + diagnostic = doChange7(t, sourceFile, span.start, program.getTypeChecker()); }); return diagnostic ? [createCodeFixAction(fixId18, changes, diagnostic, fixId18, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray; }, fixIds: [fixId18], getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => { - doChange6(changes, diag2.file, diag2.start, context.program.getTypeChecker()); + doChange7(changes, diag2.file, diag2.start, context.program.getTypeChecker()); }) }); } @@ -141637,7 +141710,7 @@ ${lanes.join("\n")} } return void 0; } - function doChange7(changes, program, { exportName, node, moduleSourceFile }) { + function doChange8(changes, program, { exportName, node, moduleSourceFile }) { const exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly); if (exportDeclaration) { updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]); @@ -141737,7 +141810,7 @@ ${lanes.join("\n")} const info = getInfo4(sourceFile, span.start, program); if (info === void 0) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange7(t, program, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, program, info)); return [createCodeFixAction(fixId19, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId19, Diagnostics.Export_all_referenced_locals)]; }, getAllCodeActions(context) { @@ -141789,7 +141862,7 @@ ${lanes.join("\n")} const token = getTokenAtPosition(sourceFile, pos); return findAncestor(token, (t) => t.kind === 199 /* NamedTupleMember */); } - function doChange8(changes, sourceFile, namedTupleMember) { + function doChange9(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { return; } @@ -141832,7 +141905,7 @@ ${lanes.join("\n")} getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) { const { sourceFile, span } = context; const namedTupleMember = getNamedTupleMember(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, sourceFile, namedTupleMember)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, sourceFile, namedTupleMember)); return [createCodeFixAction(fixId20, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId20, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)]; }, fixIds: [fixId20] @@ -141890,7 +141963,7 @@ ${lanes.join("\n")} } return suggestedSymbol === void 0 ? void 0 : { node, suggestedSymbol }; } - function doChange9(changes, sourceFile, node, suggestedSymbol, target) { + function doChange10(changes, sourceFile, node, suggestedSymbol, target) { const suggestion = symbolName(suggestedSymbol); if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) { const valDecl = suggestedSymbol.valueDeclaration; @@ -141956,7 +142029,7 @@ ${lanes.join("\n")} return void 0; const { node, suggestedSymbol } = info; const target = getEmitScriptTarget(context.host.getCompilationSettings()); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, sourceFile, node, suggestedSymbol, target)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, node, suggestedSymbol, target)); return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId21, Diagnostics.Fix_all_detected_spelling_errors)]; }, fixIds: [fixId21], @@ -141964,7 +142037,7 @@ ${lanes.join("\n")} const info = getInfo5(diag2.file, diag2.start, context, diag2.code); const target = getEmitScriptTarget(context.host.getCompilationSettings()); if (info) - doChange9(changes, context.sourceFile, info.node, info.suggestedSymbol, target); + doChange10(changes, context.sourceFile, info.node, info.suggestedSymbol, target); }) }); } @@ -143023,7 +143096,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts - function doChange10(changes, sourceFile, constructor, superCall) { + function doChange11(changes, sourceFile, constructor, superCall) { changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall); changes.delete(sourceFile, superCall); } @@ -143054,7 +143127,7 @@ ${lanes.join("\n")} if (!nodes) return void 0; const { constructor, superCall } = nodes; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, constructor, superCall)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, constructor, superCall)); return [createCodeFixAction(fixId25, changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId25, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)]; }, fixIds: [fixId25], @@ -143067,7 +143140,7 @@ ${lanes.join("\n")} return; const { constructor, superCall } = nodes; if (addToSeen(seenClasses, getNodeId(constructor.parent))) { - doChange10(changes, sourceFile, constructor, superCall); + doChange11(changes, sourceFile, constructor, superCall); } }); } @@ -143081,7 +143154,7 @@ ${lanes.join("\n")} Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration"); return token.parent; } - function doChange11(changes, sourceFile, ctr) { + function doChange12(changes, sourceFile, ctr) { const superCall = factory.createExpressionStatement(factory.createCallExpression( factory.createSuper(), /*typeArguments*/ @@ -143104,17 +143177,17 @@ ${lanes.join("\n")} getCodeActions(context) { const { sourceFile, span } = context; const ctr = getNode(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, ctr)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, sourceFile, ctr)); return [createCodeFixAction(fixId26, changes, Diagnostics.Add_missing_super_call, fixId26, Diagnostics.Add_all_missing_super_calls)]; }, fixIds: [fixId26], - getAllCodeActions: (context) => codeFixAll(context, errorCodes31, (changes, diag2) => doChange11(changes, context.sourceFile, getNode(diag2.file, diag2.start))) + getAllCodeActions: (context) => codeFixAll(context, errorCodes31, (changes, diag2) => doChange12(changes, context.sourceFile, getNode(diag2.file, diag2.start))) }); } }); // src/services/codefixes/fixEnableJsxFlag.ts - function doChange12(changeTracker, configFile) { + function doChange13(changeTracker, configFile) { setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react")); } var fixID, errorCodes32; @@ -143134,7 +143207,7 @@ ${lanes.join("\n")} } const changes = ts_textChanges_exports.ChangeTracker.with( context, - (changeTracker) => doChange12(changeTracker, configFile) + (changeTracker) => doChange13(changeTracker, configFile) ); return [ createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file) @@ -143146,7 +143219,7 @@ ${lanes.join("\n")} if (configFile === void 0) { return void 0; } - doChange12(changes, configFile); + doChange13(changes, configFile); }) }); } @@ -143168,7 +143241,7 @@ ${lanes.join("\n")} } return void 0; } - function doChange13(changes, sourceFile, arg, expression) { + function doChange14(changes, sourceFile, arg, expression) { const callExpression = factory.createCallExpression( factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")), /*typeArguments*/ @@ -143204,7 +143277,7 @@ ${lanes.join("\n")} if (info === void 0) return; const { suggestion, expression, arg } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange13(t, sourceFile, arg, expression)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, sourceFile, arg, expression)); return [createCodeFixAction(fixId27, changes, [Diagnostics.Use_0, suggestion], fixId27, Diagnostics.Use_Number_isNaN_in_all_conditions)]; }, fixIds: [fixId27], @@ -143212,7 +143285,7 @@ ${lanes.join("\n")} return codeFixAll(context, errorCodes33, (changes, diag2) => { const info = getInfo8(context.program, diag2.file, createTextSpan(diag2.start, diag2.length)); if (info) { - doChange13(changes, diag2.file, info.arg, info.expression); + doChange14(changes, diag2.file, info.arg, info.expression); } }); } @@ -143268,7 +143341,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixPropertyAssignment.ts - function doChange14(changes, sourceFile, node) { + function doChange15(changes, sourceFile, node) { changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer)); } function getProperty2(sourceFile, pos) { @@ -143290,10 +143363,10 @@ ${lanes.join("\n")} getCodeActions(context) { const { sourceFile, span } = context; const property = getProperty2(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, context.sourceFile, property)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, context.sourceFile, property)); return [createCodeFixAction(fixId28, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId28, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) => doChange14(changes, diag2.file, getProperty2(diag2.file, diag2.start))) + getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) => doChange15(changes, diag2.file, getProperty2(diag2.file, diag2.start))) }); } }); @@ -143355,7 +143428,7 @@ ${lanes.join("\n")} return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 }; } } - function doChange15(changes, sourceFile, { node, className }) { + function doChange16(changes, sourceFile, { node, className }) { suppressLeadingAndTrailingTrivia(node); changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node)); } @@ -143380,14 +143453,14 @@ ${lanes.join("\n")} if (!info) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, sourceFile, info)); return [createCodeFixAction(fixId30, changes, [Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId30, Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)]; }, fixIds: [fixId30], getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => { const info = getInfo9(diag2.file, diag2.start, diag2.code); if (info) - doChange15(changes, context.sourceFile, info); + doChange16(changes, context.sourceFile, info); }) }); } @@ -143397,7 +143470,7 @@ ${lanes.join("\n")} function isValidCharacter(character) { return hasProperty(htmlEntity, character); } - function doChange16(changes, preferences, sourceFile, start, useHtmlEntity) { + function doChange17(changes, preferences, sourceFile, start, useHtmlEntity) { const character = sourceFile.getText()[start]; if (!isValidCharacter(character)) { return; @@ -143422,7 +143495,7 @@ ${lanes.join("\n")} fixIds: [fixIdExpression, fixIdHtmlEntity], getCodeActions(context) { const { sourceFile, preferences, span } = context; - const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16( + const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17( t, preferences, sourceFile, @@ -143430,7 +143503,7 @@ ${lanes.join("\n")} /* useHtmlEntity */ false )); - const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16( + const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17( t, preferences, sourceFile, @@ -143444,7 +143517,7 @@ ${lanes.join("\n")} ]; }, getAllCodeActions(context) { - return codeFixAll(context, errorCodes37, (changes, diagnostic) => doChange16(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity)); + return codeFixAll(context, errorCodes37, (changes, diagnostic) => doChange17(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity)); } }); htmlEntity = { @@ -143937,7 +144010,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixUnreachableCode.ts - function doChange17(changes, sourceFile, start, length2, errorCode) { + function doChange18(changes, sourceFile, start, length2, errorCode) { const token = getTokenAtPosition(sourceFile, start); const statement = findAncestor(token, isStatement); if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) { @@ -143999,17 +144072,17 @@ ${lanes.join("\n")} const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken); if (syntacticDiagnostics.length) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(t, context.sourceFile, context.span.start, context.span.length, context.errorCode)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, context.sourceFile, context.span.start, context.span.length, context.errorCode)); return [createCodeFixAction(fixId32, changes, Diagnostics.Remove_unreachable_code, fixId32, Diagnostics.Remove_all_unreachable_code)]; }, fixIds: [fixId32], - getAllCodeActions: (context) => codeFixAll(context, errorCodes41, (changes, diag2) => doChange17(changes, diag2.file, diag2.start, diag2.length, diag2.code)) + getAllCodeActions: (context) => codeFixAll(context, errorCodes41, (changes, diag2) => doChange18(changes, diag2.file, diag2.start, diag2.length, diag2.code)) }); } }); // src/services/codefixes/fixUnusedLabel.ts - function doChange18(changes, sourceFile, start) { + function doChange19(changes, sourceFile, start) { const token = getTokenAtPosition(sourceFile, start); const labeledStatement = cast(token.parent, isLabeledStatement); const pos = token.getStart(sourceFile); @@ -144033,17 +144106,17 @@ ${lanes.join("\n")} registerCodeFix({ errorCodes: errorCodes42, getCodeActions(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, context.sourceFile, context.span.start)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, context.span.start)); return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unused_label, fixId33, Diagnostics.Remove_all_unused_labels)]; }, fixIds: [fixId33], - getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange18(changes, diag2.file, diag2.start)) + getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange19(changes, diag2.file, diag2.start)) }); } }); // src/services/codefixes/fixJSDocTypes.ts - function doChange19(changes, sourceFile, oldTypeNode, newType, checker) { + function doChange20(changes, sourceFile, oldTypeNode, newType, checker) { changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode( newType, /*enclosingDeclaration*/ @@ -144121,7 +144194,7 @@ ${lanes.join("\n")} } return actions2; function fix(type2, fixId51, fixAllDescription) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, sourceFile, typeNode, type2, checker)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, sourceFile, typeNode, type2, checker)); return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId51, fixAllDescription); } }, @@ -144135,7 +144208,7 @@ ${lanes.join("\n")} return; const { typeNode, type } = info; const fixedType = typeNode.kind === 317 /* JSDocNullableType */ && fixId51 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type; - doChange19(changes, sourceFile, typeNode, fixedType, checker); + doChange20(changes, sourceFile, typeNode, fixedType, checker); }); } }); @@ -144143,7 +144216,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixMissingCallParentheses.ts - function doChange20(changes, sourceFile, name) { + function doChange21(changes, sourceFile, name) { changes.replaceNodeWithText(sourceFile, name, `${name.text}()`); } function getCallName(sourceFile, start) { @@ -144178,13 +144251,13 @@ ${lanes.join("\n")} const callName = getCallName(sourceFile, span.start); if (!callName) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, context.sourceFile, callName)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, context.sourceFile, callName)); return [createCodeFixAction(fixId34, changes, Diagnostics.Add_missing_call_parentheses, fixId34, Diagnostics.Add_all_missing_call_parentheses)]; }, getAllCodeActions: (context) => codeFixAll(context, errorCodes44, (changes, diag2) => { const callName = getCallName(diag2.file, diag2.start); if (callName) - doChange20(changes, diag2.file, callName); + doChange21(changes, diag2.file, callName); }) }); } @@ -144226,7 +144299,7 @@ ${lanes.join("\n")} returnType: getReturnType(containingFunction) }; } - function doChange21(changes, sourceFile, { insertBefore, returnType }) { + function doChange22(changes, sourceFile, { insertBefore, returnType }) { if (returnType) { const entityName = getEntityNameFromTypeNode(returnType); if (!entityName || entityName.kind !== 79 /* Identifier */ || entityName.text !== "Promise") { @@ -144254,7 +144327,7 @@ ${lanes.join("\n")} const nodes = getNodes3(sourceFile, span.start); if (!nodes) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, nodes)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange22(t, sourceFile, nodes)); return [createCodeFixAction(fixId35, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId35, Diagnostics.Add_all_missing_async_modifiers)]; }, fixIds: [fixId35], @@ -144264,7 +144337,7 @@ ${lanes.join("\n")} const nodes = getNodes3(diag2.file, diag2.start); if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore))) return; - doChange21(changes, context.sourceFile, nodes); + doChange22(changes, context.sourceFile, nodes); }); } }); @@ -144272,7 +144345,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixPropertyOverrideAccessor.ts - function doChange22(file, start, length2, code, context) { + function doChange23(file, start, length2, code, context) { let startPosition; let endPosition; if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) { @@ -144313,14 +144386,14 @@ ${lanes.join("\n")} registerCodeFix({ errorCodes: errorCodes46, getCodeActions(context) { - const edits = doChange22(context.sourceFile, context.span.start, context.span.length, context.errorCode, context); + const edits = doChange23(context.sourceFile, context.span.start, context.span.length, context.errorCode, context); if (edits) { return [createCodeFixAction(fixId36, edits, Diagnostics.Generate_get_and_set_accessors, fixId36, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)]; } }, fixIds: [fixId36], getAllCodeActions: (context) => codeFixAll(context, errorCodes46, (changes, diag2) => { - const edits = doChange22(diag2.file, diag2.start, diag2.length, diag2.code, context); + const edits = doChange23(diag2.file, diag2.start, diag2.length, diag2.code, context); if (edits) { for (const edit of edits) { changes.pushRaw(context.sourceFile, edit); @@ -144367,7 +144440,7 @@ ${lanes.join("\n")} } return errorCode; } - function doChange23(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) { + function doChange24(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) { if (!isParameterPropertyModifier(token.kind) && token.kind !== 79 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 108 /* ThisKeyword */) { return void 0; } @@ -145308,7 +145381,7 @@ ${lanes.join("\n")} const token = getTokenAtPosition(sourceFile, start); let declaration; const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => { - declaration = doChange23( + declaration = doChange24( changes2, sourceFile, token, @@ -145329,7 +145402,7 @@ ${lanes.join("\n")} const { sourceFile, program, cancellationToken, host, preferences } = context; const markSeen = nodeSeenTracker(); return codeFixAll(context, errorCodes47, (changes, err) => { - doChange23(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences); + doChange24(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences); }); } }); @@ -145360,7 +145433,7 @@ ${lanes.join("\n")} return { returnTypeNode, returnType, promisedTypeNode, promisedType }; } } - function doChange24(changes, sourceFile, returnTypeNode, promisedTypeNode) { + function doChange25(changes, sourceFile, returnTypeNode, promisedTypeNode) { changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode])); } var fixId38, errorCodes48; @@ -145384,7 +145457,7 @@ ${lanes.join("\n")} return void 0; } const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange24(t, sourceFile, returnTypeNode, promisedTypeNode)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, sourceFile, returnTypeNode, promisedTypeNode)); return [createCodeFixAction( fixId38, changes, @@ -145400,7 +145473,7 @@ ${lanes.join("\n")} getAllCodeActions: (context) => codeFixAll(context, errorCodes48, (changes, diag2) => { const info = getInfo12(diag2.file, context.program.getTypeChecker(), diag2.start); if (info) { - doChange24(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode); + doChange25(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode); } }) }); @@ -146602,7 +146675,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/requireInTs.ts - function doChange25(changes, sourceFile, info) { + function doChange26(changes, sourceFile, info) { const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info; changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration( /*modifiers*/ @@ -146679,14 +146752,14 @@ ${lanes.join("\n")} if (!info) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, context.sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, context.sourceFile, info)); return [createCodeFixAction(fixId40, changes, Diagnostics.Convert_require_to_import, fixId40, Diagnostics.Convert_all_require_to_import)]; }, fixIds: [fixId40], getAllCodeActions: (context) => codeFixAll(context, errorCodes51, (changes, diag2) => { const info = getInfo14(diag2.file, context.program, diag2.start); if (info) { - doChange25(changes, context.sourceFile, info); + doChange26(changes, context.sourceFile, info); } }) }); @@ -146706,7 +146779,7 @@ ${lanes.join("\n")} return { importNode, name, moduleSpecifier: importNode.moduleSpecifier }; } } - function doChange26(changes, sourceFile, info, preferences) { + function doChange27(changes, sourceFile, info, preferences) { changes.replaceNode(sourceFile, info.importNode, makeImport( info.name, /*namedImports*/ @@ -146730,14 +146803,14 @@ ${lanes.join("\n")} const info = getInfo15(sourceFile, start); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, sourceFile, info, context.preferences)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, sourceFile, info, context.preferences)); return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_to_default_import, fixId41, Diagnostics.Convert_all_to_default_imports)]; }, fixIds: [fixId41], getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => { const info = getInfo15(diag2.file, diag2.start); if (info) - doChange26(changes, diag2.file, info, context.preferences); + doChange27(changes, diag2.file, info, context.preferences); }) }); } @@ -146785,7 +146858,7 @@ ${lanes.join("\n")} Debug.assert(token.parent.kind === 202 /* ImportType */, "Token parent should be an ImportType"); return token.parent; } - function doChange27(changes, sourceFile, importType) { + function doChange28(changes, sourceFile, importType) { const newTypeNode = factory.updateImportTypeNode( importType, importType.argument, @@ -146811,11 +146884,11 @@ ${lanes.join("\n")} getCodeActions: function getCodeActionsToAddMissingTypeof(context) { const { sourceFile, span } = context; const importType = getImportTypeNode(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, sourceFile, importType)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, importType)); return [createCodeFixAction(fixId43, changes, Diagnostics.Add_missing_typeof, fixId43, Diagnostics.Add_missing_typeof)]; }, fixIds: [fixId43], - getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => doChange27(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start))) + getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => doChange28(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start))) }); } }); @@ -146834,7 +146907,7 @@ ${lanes.join("\n")} return void 0; return binaryExpr; } - function doChange28(changeTracker, sf, node) { + function doChange29(changeTracker, sf, node) { const jsx = flattenInvalidBinaryExpr(node); if (jsx) changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment())); @@ -146872,7 +146945,7 @@ ${lanes.join("\n")} const node = findNodeToFix(sourceFile, span.start); if (!node) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, node)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, node)); return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)]; }, fixIds: [fixID2], @@ -146880,7 +146953,7 @@ ${lanes.join("\n")} const node = findNodeToFix(context.sourceFile, diag2.start); if (!node) return void 0; - doChange28(changes, context.sourceFile, node); + doChange29(changes, context.sourceFile, node); }) }); } @@ -146900,7 +146973,7 @@ ${lanes.join("\n")} function createTypeAliasFromInterface(declaration, type) { return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type); } - function doChange29(changes, sourceFile, { indexSignature, container }) { + function doChange30(changes, sourceFile, { indexSignature, container }) { const members = isInterfaceDeclaration(container) ? container.members : container.type.members; const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member)); const parameter = first(indexSignature.parameters); @@ -146942,7 +147015,7 @@ ${lanes.join("\n")} const info = getInfo16(sourceFile, span.start); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, info)); const name = idText(info.container.name); return [createCodeFixAction(fixId44, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId44, [Diagnostics.Convert_0_to_mapped_object_type, name])]; }, @@ -146950,7 +147023,7 @@ ${lanes.join("\n")} getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => { const info = getInfo16(diag2.file, diag2.start); if (info) - doChange29(changes, diag2.file, info); + doChange30(changes, diag2.file, info); }) }); } @@ -147111,7 +147184,7 @@ ${lanes.join("\n")} return; return { symbol, token: constToken }; } - function doChange30(changes, sourceFile, token) { + function doChange31(changes, sourceFile, token) { changes.replaceNode(sourceFile, token, factory.createToken(119 /* LetKeyword */)); } var fixId48, errorCodes60; @@ -147129,7 +147202,7 @@ ${lanes.join("\n")} const info = getInfo17(sourceFile, span.start, program); if (info === void 0) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, info.token)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info.token)); return [createCodeFixActionMaybeFixAll(fixId48, changes, Diagnostics.Convert_const_to_let, fixId48, Diagnostics.Convert_all_const_to_let)]; }, getAllCodeActions: (context) => { @@ -147140,7 +147213,7 @@ ${lanes.join("\n")} const info = getInfo17(diag2.file, diag2.start, program); if (info) { if (addToSeen(seen, getSymbolId(info.symbol))) { - return doChange30(changes, diag2.file, info.token); + return doChange31(changes, diag2.file, info.token); } } return void 0; @@ -147157,7 +147230,7 @@ ${lanes.join("\n")} const node = getTokenAtPosition(sourceFile, pos); return node.kind === 26 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0; } - function doChange31(changes, sourceFile, { node }) { + function doChange32(changes, sourceFile, { node }) { const newNode = factory.createToken(27 /* CommaToken */); changes.replaceNode(sourceFile, node, newNode); } @@ -147177,7 +147250,7 @@ ${lanes.join("\n")} const info = getInfo18(sourceFile, context.span.start, context.errorCode); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(t, sourceFile, info)); return [createCodeFixAction( fixId49, changes, @@ -147190,7 +147263,7 @@ ${lanes.join("\n")} getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, diag2) => { const info = getInfo18(diag2.file, diag2.start, diag2.code); if (info) - doChange31(changes, context.sourceFile, info); + doChange32(changes, context.sourceFile, info); }) }); } @@ -156486,7 +156559,7 @@ ${lanes.join("\n")} return void 0; } } - function doChange32(exportingSourceFile, program, info, changes, cancellationToken) { + function doChange33(exportingSourceFile, program, info, changes, cancellationToken) { changeExport(exportingSourceFile, info, changes, program.getTypeChecker()); changeImports(program, info, changes, cancellationToken); } @@ -156682,7 +156755,7 @@ ${lanes.join("\n")} Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name"); const info = getInfo19(context); Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(context.file, context.program, info, t, context.cancellationToken)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(context.file, context.program, info, t, context.cancellationToken)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } }); @@ -156717,7 +156790,7 @@ ${lanes.join("\n")} function getShouldUseDefault(program, importClause) { return getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker()); } - function doChange33(sourceFile, program, changes, info) { + function doChange34(sourceFile, program, changes, info) { const checker = program.getTypeChecker(); if (info.convertTo === 0 /* Named */) { doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, getAllowSyntheticDefaultImports(program.getCompilerOptions())); @@ -156909,7 +156982,7 @@ ${lanes.join("\n")} Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name"); const info = getImportConversionInfo(context); Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(context.file, context.program, t, info)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, t, info)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } }); @@ -157251,7 +157324,7 @@ ${lanes.join("\n")} afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex] }; } - function doChange34(oldFile, program, toMove, changes, host, preferences) { + function doChange35(oldFile, program, toMove, changes, host, preferences) { const checker = program.getTypeChecker(); const usage = getUsageInfo(oldFile, toMove.all, checker); const currentDirectory = getDirectoryPath(oldFile.fileName); @@ -158021,7 +158094,7 @@ ${lanes.join("\n")} getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) { Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked"); const statements = Debug.checkDefined(getStatementsToMove(context)); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, statements, t, context.host, context.preferences)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(context.file, context.program, statements, t, context.host, context.preferences)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } }); @@ -158683,12 +158756,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken); if (groupedReferences.valid) { - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(file, program, host, t, functionDeclaration, groupedReferences)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(file, program, host, t, functionDeclaration, groupedReferences)); return { renameFilename: void 0, renameLocation: void 0, edits }; } return { edits: [] }; } - function doChange35(sourceFile, program, host, changes, functionDeclaration, groupedReferences) { + function doChange36(sourceFile, program, host, changes, functionDeclaration, groupedReferences) { const signature = groupedReferences.signature; const newFunctionDeclarationParams = map(createNewParameters(functionDeclaration, program, host), (param) => getSynthesizedDeepClone(param)); if (signature) { @@ -159481,7 +159554,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); const edits = ts_textChanges_exports.ChangeTracker.with( context, - (t) => doChange36(context.file, context.program.getTypeChecker(), t, info, actionName2) + (t) => doChange37(context.file, context.program.getTypeChecker(), t, info, actionName2) ); return { edits, renameFilename: void 0, renameLocation: void 0 }; } @@ -159637,7 +159710,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return toConvert; } - function doChange36(sourceFile, checker, changes, info, _actionName) { + function doChange37(sourceFile, checker, changes, info, _actionName) { const { finalExpression, occurrences, expression } = info; const firstOccurrence = occurrences[occurrences.length - 1]; const convertedChain = convertOccurrences(checker, finalExpression, occurrences); @@ -161373,7 +161446,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getRefactorEditsToInferReturnType(context) { const info = getInfo21(context); if (info && !isRefactorErrorInfo(info)) { - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(context.file, t, info.declaration, info.returnTypeNode)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange38(context.file, t, info.declaration, info.returnTypeNode)); return { renameFilename: void 0, renameLocation: void 0, edits }; } return void 0; @@ -161398,7 +161471,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return emptyArray; } - function doChange37(sourceFile, changes, declaration, typeNode) { + function doChange38(sourceFile, changes, declaration, typeNode) { const closeParen = findChildOfKind(declaration, 21 /* CloseParenToken */, sourceFile); const needParens = isArrowFunction(declaration) && closeParen === void 0; const endNode2 = needParens ? first(declaration.parameters) : closeParen; @@ -178278,7 +178351,6 @@ ${e.message}`; ContextFlags: () => ContextFlags, CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter, Debug: () => Debug, - DeprecationVersion: () => DeprecationVersion, DiagnosticCategory: () => DiagnosticCategory, Diagnostics: () => Diagnostics, DocumentHighlights: () => DocumentHighlights, @@ -180638,7 +180710,6 @@ ${e.message}`; ContextFlags: () => ContextFlags, CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter, Debug: () => Debug, - DeprecationVersion: () => DeprecationVersion, DiagnosticCategory: () => DiagnosticCategory, Diagnostics: () => Diagnostics, DocumentHighlights: () => DocumentHighlights, diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 2201712f7c4eb..4b06d971712f5 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -3016,6 +3016,12 @@ declare namespace ts { } enum ModuleResolutionKind { Classic = 1, + /** + * @deprecated + * `NodeJs` was renamed to `Node10` to better reflect the version of Node that it targets. + * Use the new name or consider switching to a modern module resolution target. + */ + NodeJs = 2, Node10 = 2, Node16 = 3, NodeNext = 99, diff --git a/lib/typescript.js b/lib/typescript.js index 4b53c156ee249..8eecfac202aaf 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -35,7 +35,7 @@ var ts = (() => { "src/compiler/corePublic.ts"() { "use strict"; versionMajorMinor = "5.0"; - version = `${versionMajorMinor}.1-rc`; + version = "5.0.2"; Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -3585,7 +3585,7 @@ ${lanes.join("\n")} const name = DiagnosticCategory[d.category]; return lowerCase ? name.toLowerCase() : name; } - var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas, DeprecationVersion; + var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas; var init_types = __esm({ "src/compiler/types.ts"() { "use strict"; @@ -4686,6 +4686,7 @@ ${lanes.join("\n")} })(DiagnosticCategory || {}); ModuleResolutionKind = /* @__PURE__ */ ((ModuleResolutionKind2) => { ModuleResolutionKind2[ModuleResolutionKind2["Classic"] = 1] = "Classic"; + ModuleResolutionKind2[ModuleResolutionKind2["NodeJs"] = 2] = "NodeJs"; ModuleResolutionKind2[ModuleResolutionKind2["Node10"] = 2] = "Node10"; ModuleResolutionKind2[ModuleResolutionKind2["Node16"] = 3] = "Node16"; ModuleResolutionKind2[ModuleResolutionKind2["NodeNext"] = 99] = "NodeNext"; @@ -5250,12 +5251,6 @@ ${lanes.join("\n")} kind: 4 /* MultiLine */ } }; - DeprecationVersion = /* @__PURE__ */ ((DeprecationVersion2) => { - DeprecationVersion2["v5_0"] = "5.0"; - DeprecationVersion2["v5_5"] = "5.5"; - DeprecationVersion2["v6_0"] = "6.0"; - return DeprecationVersion2; - })(DeprecationVersion || {}); } }); @@ -8180,12 +8175,14 @@ ${lanes.join("\n")} Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."), An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."), Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."), - Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecat_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`), - Flag_0_is_deprecated_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Flag_0_is_deprecated_Please_remove_it_from_your_configuration_5102", "Flag '{0}' is deprecated. Please remove it from your configuration."), + Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprec_5101", `Option '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`), + Option_0_has_been_removed_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Option_0_has_been_removed_Please_remove_it_from_your_configuration_5102", "Option '{0}' has been removed. Please remove it from your configuration."), Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."), Option_0_is_redundant_and_cannot_be_specified_with_option_1: diag(5104, 1 /* Error */, "Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104", "Option '{0}' is redundant and cannot be specified with option '{1}'."), Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System: diag(5105, 1 /* Error */, "Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System_5105", "Option 'verbatimModuleSyntax' cannot be used when 'module' is set to 'UMD', 'AMD', or 'System'."), Use_0_instead: diag(5106, 3 /* Message */, "Use_0_instead_5106", "Use '{0}' instead."), + Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error: diag(5107, 1 /* Error */, "Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDepr_5107", `Option '{0}={1}' is deprecated and will stop functioning in TypeScript {2}. Specify compilerOption '"ignoreDeprecations": "{3}"' to silence this error.`), + Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."), Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."), Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), @@ -60582,6 +60579,9 @@ ${lanes.join("\n")} function isTypeSubtypeOf(source, target) { return isTypeRelatedTo(source, target, subtypeRelation); } + function isTypeStrictSubtypeOf(source, target) { + return isTypeRelatedTo(source, target, strictSubtypeRelation); + } function isTypeAssignableTo(source, target) { return isTypeRelatedTo(source, target, assignableRelation); } @@ -62490,7 +62490,7 @@ ${lanes.join("\n")} 0 /* None */ ); } - } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) { + } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => t === target2 || !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) { result2 &= propertiesRelatedTo( source2, target2, @@ -67677,7 +67677,7 @@ ${lanes.join("\n")} const narrowedType = mapType(candidate, (c) => { const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName); const matching = discriminant && getConstituentTypeForKeyType(type, discriminant); - const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType); + const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType); return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated; }); return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); @@ -115770,6 +115770,7 @@ ${lanes.join("\n")} const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions; let { oldProgram } = createProgramOptions; + const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations)); let processingDefaultLibFiles; let processingOtherFiles; let files; @@ -118196,127 +118197,131 @@ ${lanes.join("\n")} } } } - function getVersionForDeprecationDiagnostics(reportInvalidIgnoreDeprecations) { - const version2 = typeScriptVersion3 || versionMajorMinor; + function getIgnoreDeprecationsVersion() { const ignoreDeprecations = options.ignoreDeprecations; if (ignoreDeprecations) { - if (ignoreDeprecations === "5.0" /* v5_0 */ && (version2 === "5.0" /* v5_0 */ || version2 === "5.5" /* v5_5 */)) { - return; - } else if (reportInvalidIgnoreDeprecations) { - createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations); - } + if (ignoreDeprecations === "5.0") { + return new Version(ignoreDeprecations); + } + reportInvalidIgnoreDeprecations(); + } + return Version.zero; + } + function checkDeprecations(deprecatedIn, removedIn, createDiagnostic, fn) { + const deprecatedInVersion = new Version(deprecatedIn); + const removedInVersion = new Version(removedIn); + const typescriptVersion = new Version(typeScriptVersion3 || versionMajorMinor); + const ignoreDeprecationsVersion = getIgnoreDeprecationsVersion(); + const mustBeRemoved = !(removedInVersion.compareTo(typescriptVersion) === 1 /* GreaterThan */); + const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === -1 /* LessThan */; + if (mustBeRemoved || canBeSilenced) { + fn((name, value, useInstead) => { + if (mustBeRemoved) { + if (value === void 0) { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name); + } else { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value); + } + } else { + if (value === void 0) { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn); + } else { + createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn); + } + } + }); } - return version2; } function verifyDeprecatedCompilerOptions() { - const version2 = getVersionForDeprecationDiagnostics( - /*reportInvalidIgnoreDeprecations*/ - true - ); - if (!version2) - return; - if (options.target === 0 /* ES3 */) { - createDeprecatedDiagnosticForOption(version2, "target", "ES3"); - } - if (options.noImplicitUseStrict) { - createDeprecatedDiagnosticForOption(version2, "noImplicitUseStrict"); - } - if (options.keyofStringsOnly) { - createDeprecatedDiagnosticForOption(version2, "keyofStringsOnly"); - } - if (options.suppressExcessPropertyErrors) { - createDeprecatedDiagnosticForOption(version2, "suppressExcessPropertyErrors"); - } - if (options.suppressImplicitAnyIndexErrors) { - createDeprecatedDiagnosticForOption(version2, "suppressImplicitAnyIndexErrors"); - } - if (options.noStrictGenericChecks) { - createDeprecatedDiagnosticForOption(version2, "noStrictGenericChecks"); - } - if (options.charset) { - createDeprecatedDiagnosticForOption(version2, "charset"); - } - if (options.out) { - createDeprecatedDiagnosticForOption(version2, "out"); - } - if (options.importsNotUsedAsValues) { - createDeprecatedDiagnosticForOption( - version2, - "importsNotUsedAsValues", - /*value*/ - void 0, - "verbatimModuleSyntax" - ); - } - if (options.preserveValueImports) { - createDeprecatedDiagnosticForOption( - version2, - "preserveValueImports", - /*value*/ - void 0, - "verbatimModuleSyntax" - ); - } - } - function verifyDeprecatedProjectReference(ref, parentFile, index) { - if (ref.prepend) { - const version2 = getVersionForDeprecationDiagnostics( - /*reportInvalidIgnoreDeprecations*/ - false - ); - if (version2) { - createDeprecatedOptionForVersionDiagnostic( - version2, - (message, arg0, arg1, arg2) => createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2), - "prepend" + function createDiagnostic(name, value, useInstead, message, arg0, arg1, arg2, arg3) { + if (useInstead) { + const details = chainDiagnosticMessages( + /*details*/ + void 0, + Diagnostics.Use_0_instead, + useInstead + ); + const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2, arg3); + createDiagnosticForOption( + /*onKey*/ + !value, + name, + /*option2*/ + void 0, + chain + ); + } else { + createDiagnosticForOption( + /*onKey*/ + !value, + name, + /*option2*/ + void 0, + message, + arg0, + arg1, + arg2, + arg3 ); } } + checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => { + if (options.target === 0 /* ES3 */) { + createDeprecatedDiagnostic("target", "ES3"); + } + if (options.noImplicitUseStrict) { + createDeprecatedDiagnostic("noImplicitUseStrict"); + } + if (options.keyofStringsOnly) { + createDeprecatedDiagnostic("keyofStringsOnly"); + } + if (options.suppressExcessPropertyErrors) { + createDeprecatedDiagnostic("suppressExcessPropertyErrors"); + } + if (options.suppressImplicitAnyIndexErrors) { + createDeprecatedDiagnostic("suppressImplicitAnyIndexErrors"); + } + if (options.noStrictGenericChecks) { + createDeprecatedDiagnostic("noStrictGenericChecks"); + } + if (options.charset) { + createDeprecatedDiagnostic("charset"); + } + if (options.out) { + createDeprecatedDiagnostic( + "out", + /*value*/ + void 0, + "outFile" + ); + } + if (options.importsNotUsedAsValues) { + createDeprecatedDiagnostic( + "importsNotUsedAsValues", + /*value*/ + void 0, + "verbatimModuleSyntax" + ); + } + if (options.preserveValueImports) { + createDeprecatedDiagnostic( + "preserveValueImports", + /*value*/ + void 0, + "verbatimModuleSyntax" + ); + } + }); } - function createDeprecatedDiagnosticForOption(version2, name, value, useInstead) { - return createDeprecatedOptionForVersionDiagnostic( - version2, - (message, arg0, arg1, arg2) => { - if (useInstead) { - const details = chainDiagnosticMessages( - /*details*/ - void 0, - Diagnostics.Use_0_instead, - useInstead - ); - const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2); - createDiagnosticForOption( - /*onKey*/ - !value, - name, - /*option2*/ - void 0, - chain - ); - } else { - createDiagnosticForOption( - /*onKey*/ - !value, - name, - /*option2*/ - void 0, - message, - arg0, - arg1, - arg2 - ); - } - }, - name, - value - ); - } - function createDeprecatedOptionForVersionDiagnostic(version2, createDiagnostic, name, value) { - if (version2 === "6.0" /* v6_0 */) { - createDiagnostic(Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name); - } else { - createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */); + function verifyDeprecatedProjectReference(ref, parentFile, index) { + function createDiagnostic(_name, _value, _useInstead, message, arg0, arg1, arg2, arg3) { + createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2, arg3); } + checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => { + if (ref.prepend) { + createDeprecatedDiagnostic("prepend"); + } + }); } function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) { var _a3; @@ -118569,25 +118574,25 @@ ${lanes.join("\n")} arg1 ); } - function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2) { + function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2, arg3) { const referencesSyntax = firstDefined( getTsConfigPropArray(sourceFile || options.configFile, "references"), (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0 ); if (referencesSyntax && referencesSyntax.elements.length > index) { - programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2)); + programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2, arg3)); } else { - programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2)); + programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3)); } } - function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2) { + function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2, arg3) { const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); - const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2); + const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2, arg3); if (needCompilerDiagnostic) { if ("messageText" in message) { programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message)); } else { - programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2)); + programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3)); } } } @@ -118606,13 +118611,13 @@ ${lanes.join("\n")} } return _compilerOptionsObjectLiteralSyntax || void 0; } - function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2) { + function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2, arg3) { const props = getPropertyAssignment(objectLiteral, key1, key2); for (const prop of props) { if ("messageText" in message) { programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message)); } else { - programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2)); + programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2, arg3)); } } return !!props.length; @@ -139792,32 +139797,96 @@ ${lanes.join("\n")} }); // src/services/codefixes/convertToTypeOnlyImport.ts - function getImportDeclarationForDiagnosticSpan(span, sourceFile) { - return tryCast(getTokenAtPosition(sourceFile, span.start).parent, isImportDeclaration); + function getDeclaration2(sourceFile, pos) { + const { parent: parent2 } = getTokenAtPosition(sourceFile, pos); + return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0; } - function fixSingleImportDeclaration(changes, importDeclaration, context) { - if (!(importDeclaration == null ? void 0 : importDeclaration.importClause)) { - return; - } - const { importClause } = importDeclaration; - changes.insertText(context.sourceFile, importDeclaration.getStart() + "import".length, " type"); - if (importClause.name && importClause.namedBindings) { - changes.deleteNodeRangeExcludingEnd(context.sourceFile, importClause.name, importDeclaration.importClause.namedBindings); - changes.insertNodeBefore(context.sourceFile, importDeclaration, factory.updateImportDeclaration( - importDeclaration, - /*modifiers*/ - void 0, - factory.createImportClause( - /*isTypeOnly*/ - true, - importClause.name, - /*namedBindings*/ - void 0 - ), - importDeclaration.moduleSpecifier, - /*assertClause*/ - void 0 + function doChange4(changes, sourceFile, declaration) { + if (isImportSpecifier(declaration)) { + changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier( + declaration, + /*isTypeOnly*/ + true, + declaration.propertyName, + declaration.name )); + } else { + const importClause = declaration.importClause; + if (importClause.name && importClause.namedBindings) { + changes.replaceNodeWithNodes(sourceFile, declaration, [ + factory.createImportDeclaration( + getSynthesizedDeepClones( + declaration.modifiers, + /*includeTrivia*/ + true + ), + factory.createImportClause( + /*isTypeOnly*/ + true, + getSynthesizedDeepClone( + importClause.name, + /*includeTrivia*/ + true + ), + /*namedBindings*/ + void 0 + ), + getSynthesizedDeepClone( + declaration.moduleSpecifier, + /*includeTrivia*/ + true + ), + getSynthesizedDeepClone( + declaration.assertClause, + /*includeTrivia*/ + true + ) + ), + factory.createImportDeclaration( + getSynthesizedDeepClones( + declaration.modifiers, + /*includeTrivia*/ + true + ), + factory.createImportClause( + /*isTypeOnly*/ + true, + /*name*/ + void 0, + getSynthesizedDeepClone( + importClause.namedBindings, + /*includeTrivia*/ + true + ) + ), + getSynthesizedDeepClone( + declaration.moduleSpecifier, + /*includeTrivia*/ + true + ), + getSynthesizedDeepClone( + declaration.assertClause, + /*includeTrivia*/ + true + ) + ) + ]); + } else { + const importDeclaration = factory.updateImportDeclaration( + declaration, + declaration.modifiers, + factory.updateImportClause( + importClause, + /*isTypeOnly*/ + true, + importClause.name, + importClause.namedBindings + ), + declaration.moduleSpecifier, + declaration.assertClause + ); + changes.replaceNode(sourceFile, declaration, importDeclaration); + } } } var errorCodes14, fixId13; @@ -139826,24 +139895,28 @@ ${lanes.join("\n")} "use strict"; init_ts4(); init_ts_codefix(); - errorCodes14 = [Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code]; + errorCodes14 = [ + Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code, + Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code + ]; fixId13 = "convertToTypeOnlyImport"; registerCodeFix({ errorCodes: errorCodes14, getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => { - const importDeclaration = getImportDeclarationForDiagnosticSpan(context.span, context.sourceFile); - fixSingleImportDeclaration(t, importDeclaration, context); - }); - if (changes.length) { + const declaration = getDeclaration2(context.sourceFile, context.span.start); + if (declaration) { + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, context.sourceFile, declaration)); return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)]; } + return void 0; }, fixIds: [fixId13], getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) { return codeFixAll(context, errorCodes14, (changes, diag2) => { - const importDeclaration = getImportDeclarationForDiagnosticSpan(diag2, context.sourceFile); - fixSingleImportDeclaration(changes, importDeclaration, context); + const declaration = getDeclaration2(diag2.file, diag2.start); + if (declaration) { + doChange4(changes, diag2.file, declaration); + } }); } }); @@ -139865,7 +139938,7 @@ ${lanes.join("\n")} } return void 0; } - function doChange4(changes, sourceFile, { container, typeNode, constraint, name }) { + function doChange5(changes, sourceFile, { container, typeNode, constraint, name }) { changes.replaceNode(sourceFile, container, factory.createMappedTypeNode( /*readonlyToken*/ void 0, @@ -139901,14 +139974,14 @@ ${lanes.join("\n")} return void 0; } const { name, constraint } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, sourceFile, info)); return [createCodeFixAction(fixId14, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId14, Diagnostics.Convert_all_type_literals_to_mapped_type)]; }, fixIds: [fixId14], getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => { const info = getInfo2(diag2.file, diag2.start); if (info) { - doChange4(changes, diag2.file, info); + doChange5(changes, diag2.file, info); } }) }); @@ -141510,7 +141583,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts - function doChange5(changes, sourceFile, node, preferences) { + function doChange6(changes, sourceFile, node, preferences) { const quotePreference = getQuotePreference(sourceFile, preferences); const argumentsExpression = factory.createStringLiteral(node.name.text, quotePreference === 0 /* Single */); changes.replaceNode( @@ -141538,16 +141611,16 @@ ${lanes.join("\n")} getCodeActions(context) { const { sourceFile, span, preferences } = context; const property = getPropertyAccessExpression(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, context.sourceFile, property, preferences)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange6(t, context.sourceFile, property, preferences)); return [createCodeFixAction(fixId17, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId17, Diagnostics.Use_element_access_for_all_undeclared_properties)]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => doChange5(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences)) + getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => doChange6(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences)) }); } }); // src/services/codefixes/fixImplicitThis.ts - function doChange6(changes, sourceFile, pos, checker) { + function doChange7(changes, sourceFile, pos, checker) { const token = getTokenAtPosition(sourceFile, pos); if (!isThis(token)) return void 0; @@ -141602,13 +141675,13 @@ ${lanes.join("\n")} const { sourceFile, program, span } = context; let diagnostic; const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => { - diagnostic = doChange6(t, sourceFile, span.start, program.getTypeChecker()); + diagnostic = doChange7(t, sourceFile, span.start, program.getTypeChecker()); }); return diagnostic ? [createCodeFixAction(fixId18, changes, diagnostic, fixId18, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray; }, fixIds: [fixId18], getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => { - doChange6(changes, diag2.file, diag2.start, context.program.getTypeChecker()); + doChange7(changes, diag2.file, diag2.start, context.program.getTypeChecker()); }) }); } @@ -141651,7 +141724,7 @@ ${lanes.join("\n")} } return void 0; } - function doChange7(changes, program, { exportName, node, moduleSourceFile }) { + function doChange8(changes, program, { exportName, node, moduleSourceFile }) { const exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly); if (exportDeclaration) { updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]); @@ -141751,7 +141824,7 @@ ${lanes.join("\n")} const info = getInfo4(sourceFile, span.start, program); if (info === void 0) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange7(t, program, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, program, info)); return [createCodeFixAction(fixId19, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId19, Diagnostics.Export_all_referenced_locals)]; }, getAllCodeActions(context) { @@ -141803,7 +141876,7 @@ ${lanes.join("\n")} const token = getTokenAtPosition(sourceFile, pos); return findAncestor(token, (t) => t.kind === 199 /* NamedTupleMember */); } - function doChange8(changes, sourceFile, namedTupleMember) { + function doChange9(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { return; } @@ -141846,7 +141919,7 @@ ${lanes.join("\n")} getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) { const { sourceFile, span } = context; const namedTupleMember = getNamedTupleMember(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, sourceFile, namedTupleMember)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, sourceFile, namedTupleMember)); return [createCodeFixAction(fixId20, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId20, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)]; }, fixIds: [fixId20] @@ -141904,7 +141977,7 @@ ${lanes.join("\n")} } return suggestedSymbol === void 0 ? void 0 : { node, suggestedSymbol }; } - function doChange9(changes, sourceFile, node, suggestedSymbol, target) { + function doChange10(changes, sourceFile, node, suggestedSymbol, target) { const suggestion = symbolName(suggestedSymbol); if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) { const valDecl = suggestedSymbol.valueDeclaration; @@ -141970,7 +142043,7 @@ ${lanes.join("\n")} return void 0; const { node, suggestedSymbol } = info; const target = getEmitScriptTarget(context.host.getCompilationSettings()); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, sourceFile, node, suggestedSymbol, target)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, node, suggestedSymbol, target)); return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId21, Diagnostics.Fix_all_detected_spelling_errors)]; }, fixIds: [fixId21], @@ -141978,7 +142051,7 @@ ${lanes.join("\n")} const info = getInfo5(diag2.file, diag2.start, context, diag2.code); const target = getEmitScriptTarget(context.host.getCompilationSettings()); if (info) - doChange9(changes, context.sourceFile, info.node, info.suggestedSymbol, target); + doChange10(changes, context.sourceFile, info.node, info.suggestedSymbol, target); }) }); } @@ -143037,7 +143110,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts - function doChange10(changes, sourceFile, constructor, superCall) { + function doChange11(changes, sourceFile, constructor, superCall) { changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall); changes.delete(sourceFile, superCall); } @@ -143068,7 +143141,7 @@ ${lanes.join("\n")} if (!nodes) return void 0; const { constructor, superCall } = nodes; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, constructor, superCall)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, constructor, superCall)); return [createCodeFixAction(fixId25, changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId25, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)]; }, fixIds: [fixId25], @@ -143081,7 +143154,7 @@ ${lanes.join("\n")} return; const { constructor, superCall } = nodes; if (addToSeen(seenClasses, getNodeId(constructor.parent))) { - doChange10(changes, sourceFile, constructor, superCall); + doChange11(changes, sourceFile, constructor, superCall); } }); } @@ -143095,7 +143168,7 @@ ${lanes.join("\n")} Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration"); return token.parent; } - function doChange11(changes, sourceFile, ctr) { + function doChange12(changes, sourceFile, ctr) { const superCall = factory.createExpressionStatement(factory.createCallExpression( factory.createSuper(), /*typeArguments*/ @@ -143118,17 +143191,17 @@ ${lanes.join("\n")} getCodeActions(context) { const { sourceFile, span } = context; const ctr = getNode(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, ctr)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, sourceFile, ctr)); return [createCodeFixAction(fixId26, changes, Diagnostics.Add_missing_super_call, fixId26, Diagnostics.Add_all_missing_super_calls)]; }, fixIds: [fixId26], - getAllCodeActions: (context) => codeFixAll(context, errorCodes31, (changes, diag2) => doChange11(changes, context.sourceFile, getNode(diag2.file, diag2.start))) + getAllCodeActions: (context) => codeFixAll(context, errorCodes31, (changes, diag2) => doChange12(changes, context.sourceFile, getNode(diag2.file, diag2.start))) }); } }); // src/services/codefixes/fixEnableJsxFlag.ts - function doChange12(changeTracker, configFile) { + function doChange13(changeTracker, configFile) { setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react")); } var fixID, errorCodes32; @@ -143148,7 +143221,7 @@ ${lanes.join("\n")} } const changes = ts_textChanges_exports.ChangeTracker.with( context, - (changeTracker) => doChange12(changeTracker, configFile) + (changeTracker) => doChange13(changeTracker, configFile) ); return [ createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file) @@ -143160,7 +143233,7 @@ ${lanes.join("\n")} if (configFile === void 0) { return void 0; } - doChange12(changes, configFile); + doChange13(changes, configFile); }) }); } @@ -143182,7 +143255,7 @@ ${lanes.join("\n")} } return void 0; } - function doChange13(changes, sourceFile, arg, expression) { + function doChange14(changes, sourceFile, arg, expression) { const callExpression = factory.createCallExpression( factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")), /*typeArguments*/ @@ -143218,7 +143291,7 @@ ${lanes.join("\n")} if (info === void 0) return; const { suggestion, expression, arg } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange13(t, sourceFile, arg, expression)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, sourceFile, arg, expression)); return [createCodeFixAction(fixId27, changes, [Diagnostics.Use_0, suggestion], fixId27, Diagnostics.Use_Number_isNaN_in_all_conditions)]; }, fixIds: [fixId27], @@ -143226,7 +143299,7 @@ ${lanes.join("\n")} return codeFixAll(context, errorCodes33, (changes, diag2) => { const info = getInfo8(context.program, diag2.file, createTextSpan(diag2.start, diag2.length)); if (info) { - doChange13(changes, diag2.file, info.arg, info.expression); + doChange14(changes, diag2.file, info.arg, info.expression); } }); } @@ -143282,7 +143355,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixPropertyAssignment.ts - function doChange14(changes, sourceFile, node) { + function doChange15(changes, sourceFile, node) { changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer)); } function getProperty2(sourceFile, pos) { @@ -143304,10 +143377,10 @@ ${lanes.join("\n")} getCodeActions(context) { const { sourceFile, span } = context; const property = getProperty2(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, context.sourceFile, property)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, context.sourceFile, property)); return [createCodeFixAction(fixId28, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId28, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) => doChange14(changes, diag2.file, getProperty2(diag2.file, diag2.start))) + getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) => doChange15(changes, diag2.file, getProperty2(diag2.file, diag2.start))) }); } }); @@ -143369,7 +143442,7 @@ ${lanes.join("\n")} return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 }; } } - function doChange15(changes, sourceFile, { node, className }) { + function doChange16(changes, sourceFile, { node, className }) { suppressLeadingAndTrailingTrivia(node); changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node)); } @@ -143394,14 +143467,14 @@ ${lanes.join("\n")} if (!info) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, sourceFile, info)); return [createCodeFixAction(fixId30, changes, [Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId30, Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)]; }, fixIds: [fixId30], getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => { const info = getInfo9(diag2.file, diag2.start, diag2.code); if (info) - doChange15(changes, context.sourceFile, info); + doChange16(changes, context.sourceFile, info); }) }); } @@ -143411,7 +143484,7 @@ ${lanes.join("\n")} function isValidCharacter(character) { return hasProperty(htmlEntity, character); } - function doChange16(changes, preferences, sourceFile, start, useHtmlEntity) { + function doChange17(changes, preferences, sourceFile, start, useHtmlEntity) { const character = sourceFile.getText()[start]; if (!isValidCharacter(character)) { return; @@ -143436,7 +143509,7 @@ ${lanes.join("\n")} fixIds: [fixIdExpression, fixIdHtmlEntity], getCodeActions(context) { const { sourceFile, preferences, span } = context; - const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16( + const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17( t, preferences, sourceFile, @@ -143444,7 +143517,7 @@ ${lanes.join("\n")} /* useHtmlEntity */ false )); - const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16( + const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17( t, preferences, sourceFile, @@ -143458,7 +143531,7 @@ ${lanes.join("\n")} ]; }, getAllCodeActions(context) { - return codeFixAll(context, errorCodes37, (changes, diagnostic) => doChange16(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity)); + return codeFixAll(context, errorCodes37, (changes, diagnostic) => doChange17(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity)); } }); htmlEntity = { @@ -143951,7 +144024,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixUnreachableCode.ts - function doChange17(changes, sourceFile, start, length2, errorCode) { + function doChange18(changes, sourceFile, start, length2, errorCode) { const token = getTokenAtPosition(sourceFile, start); const statement = findAncestor(token, isStatement); if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) { @@ -144013,17 +144086,17 @@ ${lanes.join("\n")} const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken); if (syntacticDiagnostics.length) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(t, context.sourceFile, context.span.start, context.span.length, context.errorCode)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, context.sourceFile, context.span.start, context.span.length, context.errorCode)); return [createCodeFixAction(fixId32, changes, Diagnostics.Remove_unreachable_code, fixId32, Diagnostics.Remove_all_unreachable_code)]; }, fixIds: [fixId32], - getAllCodeActions: (context) => codeFixAll(context, errorCodes41, (changes, diag2) => doChange17(changes, diag2.file, diag2.start, diag2.length, diag2.code)) + getAllCodeActions: (context) => codeFixAll(context, errorCodes41, (changes, diag2) => doChange18(changes, diag2.file, diag2.start, diag2.length, diag2.code)) }); } }); // src/services/codefixes/fixUnusedLabel.ts - function doChange18(changes, sourceFile, start) { + function doChange19(changes, sourceFile, start) { const token = getTokenAtPosition(sourceFile, start); const labeledStatement = cast(token.parent, isLabeledStatement); const pos = token.getStart(sourceFile); @@ -144047,17 +144120,17 @@ ${lanes.join("\n")} registerCodeFix({ errorCodes: errorCodes42, getCodeActions(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, context.sourceFile, context.span.start)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, context.span.start)); return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unused_label, fixId33, Diagnostics.Remove_all_unused_labels)]; }, fixIds: [fixId33], - getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange18(changes, diag2.file, diag2.start)) + getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange19(changes, diag2.file, diag2.start)) }); } }); // src/services/codefixes/fixJSDocTypes.ts - function doChange19(changes, sourceFile, oldTypeNode, newType, checker) { + function doChange20(changes, sourceFile, oldTypeNode, newType, checker) { changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode( newType, /*enclosingDeclaration*/ @@ -144135,7 +144208,7 @@ ${lanes.join("\n")} } return actions2; function fix(type2, fixId51, fixAllDescription) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, sourceFile, typeNode, type2, checker)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, sourceFile, typeNode, type2, checker)); return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId51, fixAllDescription); } }, @@ -144149,7 +144222,7 @@ ${lanes.join("\n")} return; const { typeNode, type } = info; const fixedType = typeNode.kind === 317 /* JSDocNullableType */ && fixId51 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type; - doChange19(changes, sourceFile, typeNode, fixedType, checker); + doChange20(changes, sourceFile, typeNode, fixedType, checker); }); } }); @@ -144157,7 +144230,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixMissingCallParentheses.ts - function doChange20(changes, sourceFile, name) { + function doChange21(changes, sourceFile, name) { changes.replaceNodeWithText(sourceFile, name, `${name.text}()`); } function getCallName(sourceFile, start) { @@ -144192,13 +144265,13 @@ ${lanes.join("\n")} const callName = getCallName(sourceFile, span.start); if (!callName) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, context.sourceFile, callName)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, context.sourceFile, callName)); return [createCodeFixAction(fixId34, changes, Diagnostics.Add_missing_call_parentheses, fixId34, Diagnostics.Add_all_missing_call_parentheses)]; }, getAllCodeActions: (context) => codeFixAll(context, errorCodes44, (changes, diag2) => { const callName = getCallName(diag2.file, diag2.start); if (callName) - doChange20(changes, diag2.file, callName); + doChange21(changes, diag2.file, callName); }) }); } @@ -144240,7 +144313,7 @@ ${lanes.join("\n")} returnType: getReturnType(containingFunction) }; } - function doChange21(changes, sourceFile, { insertBefore, returnType }) { + function doChange22(changes, sourceFile, { insertBefore, returnType }) { if (returnType) { const entityName = getEntityNameFromTypeNode(returnType); if (!entityName || entityName.kind !== 79 /* Identifier */ || entityName.text !== "Promise") { @@ -144268,7 +144341,7 @@ ${lanes.join("\n")} const nodes = getNodes3(sourceFile, span.start); if (!nodes) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, nodes)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange22(t, sourceFile, nodes)); return [createCodeFixAction(fixId35, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId35, Diagnostics.Add_all_missing_async_modifiers)]; }, fixIds: [fixId35], @@ -144278,7 +144351,7 @@ ${lanes.join("\n")} const nodes = getNodes3(diag2.file, diag2.start); if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore))) return; - doChange21(changes, context.sourceFile, nodes); + doChange22(changes, context.sourceFile, nodes); }); } }); @@ -144286,7 +144359,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixPropertyOverrideAccessor.ts - function doChange22(file, start, length2, code, context) { + function doChange23(file, start, length2, code, context) { let startPosition; let endPosition; if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) { @@ -144327,14 +144400,14 @@ ${lanes.join("\n")} registerCodeFix({ errorCodes: errorCodes46, getCodeActions(context) { - const edits = doChange22(context.sourceFile, context.span.start, context.span.length, context.errorCode, context); + const edits = doChange23(context.sourceFile, context.span.start, context.span.length, context.errorCode, context); if (edits) { return [createCodeFixAction(fixId36, edits, Diagnostics.Generate_get_and_set_accessors, fixId36, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)]; } }, fixIds: [fixId36], getAllCodeActions: (context) => codeFixAll(context, errorCodes46, (changes, diag2) => { - const edits = doChange22(diag2.file, diag2.start, diag2.length, diag2.code, context); + const edits = doChange23(diag2.file, diag2.start, diag2.length, diag2.code, context); if (edits) { for (const edit of edits) { changes.pushRaw(context.sourceFile, edit); @@ -144381,7 +144454,7 @@ ${lanes.join("\n")} } return errorCode; } - function doChange23(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) { + function doChange24(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) { if (!isParameterPropertyModifier(token.kind) && token.kind !== 79 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 108 /* ThisKeyword */) { return void 0; } @@ -145322,7 +145395,7 @@ ${lanes.join("\n")} const token = getTokenAtPosition(sourceFile, start); let declaration; const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => { - declaration = doChange23( + declaration = doChange24( changes2, sourceFile, token, @@ -145343,7 +145416,7 @@ ${lanes.join("\n")} const { sourceFile, program, cancellationToken, host, preferences } = context; const markSeen = nodeSeenTracker(); return codeFixAll(context, errorCodes47, (changes, err) => { - doChange23(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences); + doChange24(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences); }); } }); @@ -145374,7 +145447,7 @@ ${lanes.join("\n")} return { returnTypeNode, returnType, promisedTypeNode, promisedType }; } } - function doChange24(changes, sourceFile, returnTypeNode, promisedTypeNode) { + function doChange25(changes, sourceFile, returnTypeNode, promisedTypeNode) { changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode])); } var fixId38, errorCodes48; @@ -145398,7 +145471,7 @@ ${lanes.join("\n")} return void 0; } const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange24(t, sourceFile, returnTypeNode, promisedTypeNode)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, sourceFile, returnTypeNode, promisedTypeNode)); return [createCodeFixAction( fixId38, changes, @@ -145414,7 +145487,7 @@ ${lanes.join("\n")} getAllCodeActions: (context) => codeFixAll(context, errorCodes48, (changes, diag2) => { const info = getInfo12(diag2.file, context.program.getTypeChecker(), diag2.start); if (info) { - doChange24(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode); + doChange25(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode); } }) }); @@ -146616,7 +146689,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/requireInTs.ts - function doChange25(changes, sourceFile, info) { + function doChange26(changes, sourceFile, info) { const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info; changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration( /*modifiers*/ @@ -146693,14 +146766,14 @@ ${lanes.join("\n")} if (!info) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, context.sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, context.sourceFile, info)); return [createCodeFixAction(fixId40, changes, Diagnostics.Convert_require_to_import, fixId40, Diagnostics.Convert_all_require_to_import)]; }, fixIds: [fixId40], getAllCodeActions: (context) => codeFixAll(context, errorCodes51, (changes, diag2) => { const info = getInfo14(diag2.file, context.program, diag2.start); if (info) { - doChange25(changes, context.sourceFile, info); + doChange26(changes, context.sourceFile, info); } }) }); @@ -146720,7 +146793,7 @@ ${lanes.join("\n")} return { importNode, name, moduleSpecifier: importNode.moduleSpecifier }; } } - function doChange26(changes, sourceFile, info, preferences) { + function doChange27(changes, sourceFile, info, preferences) { changes.replaceNode(sourceFile, info.importNode, makeImport( info.name, /*namedImports*/ @@ -146744,14 +146817,14 @@ ${lanes.join("\n")} const info = getInfo15(sourceFile, start); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, sourceFile, info, context.preferences)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, sourceFile, info, context.preferences)); return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_to_default_import, fixId41, Diagnostics.Convert_all_to_default_imports)]; }, fixIds: [fixId41], getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => { const info = getInfo15(diag2.file, diag2.start); if (info) - doChange26(changes, diag2.file, info, context.preferences); + doChange27(changes, diag2.file, info, context.preferences); }) }); } @@ -146799,7 +146872,7 @@ ${lanes.join("\n")} Debug.assert(token.parent.kind === 202 /* ImportType */, "Token parent should be an ImportType"); return token.parent; } - function doChange27(changes, sourceFile, importType) { + function doChange28(changes, sourceFile, importType) { const newTypeNode = factory.updateImportTypeNode( importType, importType.argument, @@ -146825,11 +146898,11 @@ ${lanes.join("\n")} getCodeActions: function getCodeActionsToAddMissingTypeof(context) { const { sourceFile, span } = context; const importType = getImportTypeNode(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, sourceFile, importType)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, importType)); return [createCodeFixAction(fixId43, changes, Diagnostics.Add_missing_typeof, fixId43, Diagnostics.Add_missing_typeof)]; }, fixIds: [fixId43], - getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => doChange27(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start))) + getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => doChange28(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start))) }); } }); @@ -146848,7 +146921,7 @@ ${lanes.join("\n")} return void 0; return binaryExpr; } - function doChange28(changeTracker, sf, node) { + function doChange29(changeTracker, sf, node) { const jsx = flattenInvalidBinaryExpr(node); if (jsx) changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment())); @@ -146886,7 +146959,7 @@ ${lanes.join("\n")} const node = findNodeToFix(sourceFile, span.start); if (!node) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, node)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, node)); return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)]; }, fixIds: [fixID2], @@ -146894,7 +146967,7 @@ ${lanes.join("\n")} const node = findNodeToFix(context.sourceFile, diag2.start); if (!node) return void 0; - doChange28(changes, context.sourceFile, node); + doChange29(changes, context.sourceFile, node); }) }); } @@ -146914,7 +146987,7 @@ ${lanes.join("\n")} function createTypeAliasFromInterface(declaration, type) { return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type); } - function doChange29(changes, sourceFile, { indexSignature, container }) { + function doChange30(changes, sourceFile, { indexSignature, container }) { const members = isInterfaceDeclaration(container) ? container.members : container.type.members; const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member)); const parameter = first(indexSignature.parameters); @@ -146956,7 +147029,7 @@ ${lanes.join("\n")} const info = getInfo16(sourceFile, span.start); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, info)); const name = idText(info.container.name); return [createCodeFixAction(fixId44, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId44, [Diagnostics.Convert_0_to_mapped_object_type, name])]; }, @@ -146964,7 +147037,7 @@ ${lanes.join("\n")} getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => { const info = getInfo16(diag2.file, diag2.start); if (info) - doChange29(changes, diag2.file, info); + doChange30(changes, diag2.file, info); }) }); } @@ -147125,7 +147198,7 @@ ${lanes.join("\n")} return; return { symbol, token: constToken }; } - function doChange30(changes, sourceFile, token) { + function doChange31(changes, sourceFile, token) { changes.replaceNode(sourceFile, token, factory.createToken(119 /* LetKeyword */)); } var fixId48, errorCodes60; @@ -147143,7 +147216,7 @@ ${lanes.join("\n")} const info = getInfo17(sourceFile, span.start, program); if (info === void 0) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, info.token)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info.token)); return [createCodeFixActionMaybeFixAll(fixId48, changes, Diagnostics.Convert_const_to_let, fixId48, Diagnostics.Convert_all_const_to_let)]; }, getAllCodeActions: (context) => { @@ -147154,7 +147227,7 @@ ${lanes.join("\n")} const info = getInfo17(diag2.file, diag2.start, program); if (info) { if (addToSeen(seen, getSymbolId(info.symbol))) { - return doChange30(changes, diag2.file, info.token); + return doChange31(changes, diag2.file, info.token); } } return void 0; @@ -147171,7 +147244,7 @@ ${lanes.join("\n")} const node = getTokenAtPosition(sourceFile, pos); return node.kind === 26 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0; } - function doChange31(changes, sourceFile, { node }) { + function doChange32(changes, sourceFile, { node }) { const newNode = factory.createToken(27 /* CommaToken */); changes.replaceNode(sourceFile, node, newNode); } @@ -147191,7 +147264,7 @@ ${lanes.join("\n")} const info = getInfo18(sourceFile, context.span.start, context.errorCode); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(t, sourceFile, info)); return [createCodeFixAction( fixId49, changes, @@ -147204,7 +147277,7 @@ ${lanes.join("\n")} getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, diag2) => { const info = getInfo18(diag2.file, diag2.start, diag2.code); if (info) - doChange31(changes, context.sourceFile, info); + doChange32(changes, context.sourceFile, info); }) }); } @@ -156500,7 +156573,7 @@ ${lanes.join("\n")} return void 0; } } - function doChange32(exportingSourceFile, program, info, changes, cancellationToken) { + function doChange33(exportingSourceFile, program, info, changes, cancellationToken) { changeExport(exportingSourceFile, info, changes, program.getTypeChecker()); changeImports(program, info, changes, cancellationToken); } @@ -156696,7 +156769,7 @@ ${lanes.join("\n")} Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name"); const info = getInfo19(context); Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(context.file, context.program, info, t, context.cancellationToken)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(context.file, context.program, info, t, context.cancellationToken)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } }); @@ -156731,7 +156804,7 @@ ${lanes.join("\n")} function getShouldUseDefault(program, importClause) { return getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker()); } - function doChange33(sourceFile, program, changes, info) { + function doChange34(sourceFile, program, changes, info) { const checker = program.getTypeChecker(); if (info.convertTo === 0 /* Named */) { doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, getAllowSyntheticDefaultImports(program.getCompilerOptions())); @@ -156923,7 +156996,7 @@ ${lanes.join("\n")} Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name"); const info = getImportConversionInfo(context); Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(context.file, context.program, t, info)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, t, info)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } }); @@ -157265,7 +157338,7 @@ ${lanes.join("\n")} afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex] }; } - function doChange34(oldFile, program, toMove, changes, host, preferences) { + function doChange35(oldFile, program, toMove, changes, host, preferences) { const checker = program.getTypeChecker(); const usage = getUsageInfo(oldFile, toMove.all, checker); const currentDirectory = getDirectoryPath(oldFile.fileName); @@ -158035,7 +158108,7 @@ ${lanes.join("\n")} getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) { Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked"); const statements = Debug.checkDefined(getStatementsToMove(context)); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, statements, t, context.host, context.preferences)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(context.file, context.program, statements, t, context.host, context.preferences)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } }); @@ -158697,12 +158770,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken); if (groupedReferences.valid) { - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(file, program, host, t, functionDeclaration, groupedReferences)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(file, program, host, t, functionDeclaration, groupedReferences)); return { renameFilename: void 0, renameLocation: void 0, edits }; } return { edits: [] }; } - function doChange35(sourceFile, program, host, changes, functionDeclaration, groupedReferences) { + function doChange36(sourceFile, program, host, changes, functionDeclaration, groupedReferences) { const signature = groupedReferences.signature; const newFunctionDeclarationParams = map(createNewParameters(functionDeclaration, program, host), (param) => getSynthesizedDeepClone(param)); if (signature) { @@ -159495,7 +159568,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); const edits = ts_textChanges_exports.ChangeTracker.with( context, - (t) => doChange36(context.file, context.program.getTypeChecker(), t, info, actionName2) + (t) => doChange37(context.file, context.program.getTypeChecker(), t, info, actionName2) ); return { edits, renameFilename: void 0, renameLocation: void 0 }; } @@ -159651,7 +159724,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return toConvert; } - function doChange36(sourceFile, checker, changes, info, _actionName) { + function doChange37(sourceFile, checker, changes, info, _actionName) { const { finalExpression, occurrences, expression } = info; const firstOccurrence = occurrences[occurrences.length - 1]; const convertedChain = convertOccurrences(checker, finalExpression, occurrences); @@ -161387,7 +161460,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getRefactorEditsToInferReturnType(context) { const info = getInfo21(context); if (info && !isRefactorErrorInfo(info)) { - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(context.file, t, info.declaration, info.returnTypeNode)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange38(context.file, t, info.declaration, info.returnTypeNode)); return { renameFilename: void 0, renameLocation: void 0, edits }; } return void 0; @@ -161412,7 +161485,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return emptyArray; } - function doChange37(sourceFile, changes, declaration, typeNode) { + function doChange38(sourceFile, changes, declaration, typeNode) { const closeParen = findChildOfKind(declaration, 21 /* CloseParenToken */, sourceFile); const needParens = isArrowFunction(declaration) && closeParen === void 0; const endNode2 = needParens ? first(declaration.parameters) : closeParen; @@ -167459,7 +167532,6 @@ ${options.prefix}` : "\n" : options.prefix ContextFlags: () => ContextFlags, CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter, Debug: () => Debug, - DeprecationVersion: () => DeprecationVersion, DiagnosticCategory: () => DiagnosticCategory, Diagnostics: () => Diagnostics, DocumentHighlights: () => DocumentHighlights, diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 00afe537dc038..c2e6ea1276b7c 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -54,7 +54,7 @@ var path = __toESM(require("path")); // src/compiler/corePublic.ts var versionMajorMinor = "5.0"; -var version = `${versionMajorMinor}.1-rc`; +var version = "5.0.2"; // src/compiler/core.ts var emptyArray = []; @@ -3302,6 +3302,7 @@ var DiagnosticCategory = /* @__PURE__ */ ((DiagnosticCategory2) => { })(DiagnosticCategory || {}); var ModuleResolutionKind = /* @__PURE__ */ ((ModuleResolutionKind2) => { ModuleResolutionKind2[ModuleResolutionKind2["Classic"] = 1] = "Classic"; + ModuleResolutionKind2[ModuleResolutionKind2["NodeJs"] = 2] = "NodeJs"; ModuleResolutionKind2[ModuleResolutionKind2["Node10"] = 2] = "Node10"; ModuleResolutionKind2[ModuleResolutionKind2["Node16"] = 3] = "Node16"; ModuleResolutionKind2[ModuleResolutionKind2["NodeNext"] = 99] = "NodeNext"; @@ -6296,12 +6297,14 @@ var Diagnostics = { Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."), An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."), Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."), - Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecat_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`), - Flag_0_is_deprecated_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Flag_0_is_deprecated_Please_remove_it_from_your_configuration_5102", "Flag '{0}' is deprecated. Please remove it from your configuration."), + Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprec_5101", `Option '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`), + Option_0_has_been_removed_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Option_0_has_been_removed_Please_remove_it_from_your_configuration_5102", "Option '{0}' has been removed. Please remove it from your configuration."), Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."), Option_0_is_redundant_and_cannot_be_specified_with_option_1: diag(5104, 1 /* Error */, "Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104", "Option '{0}' is redundant and cannot be specified with option '{1}'."), Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System: diag(5105, 1 /* Error */, "Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System_5105", "Option 'verbatimModuleSyntax' cannot be used when 'module' is set to 'UMD', 'AMD', or 'System'."), Use_0_instead: diag(5106, 3 /* Message */, "Use_0_instead_5106", "Use '{0}' instead."), + Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error: diag(5107, 1 /* Error */, "Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDepr_5107", `Option '{0}={1}' is deprecated and will stop functioning in TypeScript {2}. Specify compilerOption '"ignoreDeprecations": "{3}"' to silence this error.`), + Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."), Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."), Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), diff --git a/package.json b/package.json index 63600f1316936..69ab01a5a616e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "5.0.1-rc", + "version": "5.0.2", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/corePublic.ts b/src/compiler/corePublic.ts index 3468e21af6272..139cfa95efb9e 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -4,7 +4,7 @@ export const versionMajorMinor = "5.0"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types -export const version: string = `${versionMajorMinor}.1-rc`; +export const version = "5.0.2" as string; /** * Type of objects whose values are all of the same type.