typescript 5.0.1-rc → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.decorators.legacy.d.ts +1 -1
- package/lib/tsc.js +166 -155
- package/lib/tsserver.js +372 -298
- package/lib/tsserverlibrary.d.ts +6 -1
- package/lib/tsserverlibrary.js +372 -295
- package/lib/typescript.d.ts +6 -1
- package/lib/typescript.js +372 -293
- package/lib/typingsInstaller.js +7 -20
- package/package.json +15 -15
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.0";
|
|
38
|
-
version =
|
|
38
|
+
version = "5.0.3";
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -3585,7 +3585,7 @@ ${lanes.join("\n")}
|
|
|
3585
3585
|
const name = DiagnosticCategory[d.category];
|
|
3586
3586
|
return lowerCase ? name.toLowerCase() : name;
|
|
3587
3587
|
}
|
|
3588
|
-
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
|
|
3588
|
+
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;
|
|
3589
3589
|
var init_types = __esm({
|
|
3590
3590
|
"src/compiler/types.ts"() {
|
|
3591
3591
|
"use strict";
|
|
@@ -4686,6 +4686,7 @@ ${lanes.join("\n")}
|
|
|
4686
4686
|
})(DiagnosticCategory || {});
|
|
4687
4687
|
ModuleResolutionKind = /* @__PURE__ */ ((ModuleResolutionKind2) => {
|
|
4688
4688
|
ModuleResolutionKind2[ModuleResolutionKind2["Classic"] = 1] = "Classic";
|
|
4689
|
+
ModuleResolutionKind2[ModuleResolutionKind2["NodeJs"] = 2] = "NodeJs";
|
|
4689
4690
|
ModuleResolutionKind2[ModuleResolutionKind2["Node10"] = 2] = "Node10";
|
|
4690
4691
|
ModuleResolutionKind2[ModuleResolutionKind2["Node16"] = 3] = "Node16";
|
|
4691
4692
|
ModuleResolutionKind2[ModuleResolutionKind2["NodeNext"] = 99] = "NodeNext";
|
|
@@ -5250,12 +5251,6 @@ ${lanes.join("\n")}
|
|
|
5250
5251
|
kind: 4 /* MultiLine */
|
|
5251
5252
|
}
|
|
5252
5253
|
};
|
|
5253
|
-
DeprecationVersion = /* @__PURE__ */ ((DeprecationVersion2) => {
|
|
5254
|
-
DeprecationVersion2["v5_0"] = "5.0";
|
|
5255
|
-
DeprecationVersion2["v5_5"] = "5.5";
|
|
5256
|
-
DeprecationVersion2["v6_0"] = "6.0";
|
|
5257
|
-
return DeprecationVersion2;
|
|
5258
|
-
})(DeprecationVersion || {});
|
|
5259
5254
|
}
|
|
5260
5255
|
});
|
|
5261
5256
|
|
|
@@ -6142,20 +6137,6 @@ ${lanes.join("\n")}
|
|
|
6142
6137
|
(path2) => sys2.directoryExists(path2)
|
|
6143
6138
|
);
|
|
6144
6139
|
}
|
|
6145
|
-
function getNodeMajorVersion() {
|
|
6146
|
-
if (typeof process === "undefined") {
|
|
6147
|
-
return void 0;
|
|
6148
|
-
}
|
|
6149
|
-
const version2 = process.version;
|
|
6150
|
-
if (!version2) {
|
|
6151
|
-
return void 0;
|
|
6152
|
-
}
|
|
6153
|
-
const dot = version2.indexOf(".");
|
|
6154
|
-
if (dot === -1) {
|
|
6155
|
-
return void 0;
|
|
6156
|
-
}
|
|
6157
|
-
return parseInt(version2.substring(1, dot));
|
|
6158
|
-
}
|
|
6159
6140
|
function setSys(s) {
|
|
6160
6141
|
sys = s;
|
|
6161
6142
|
}
|
|
@@ -6203,14 +6184,12 @@ ${lanes.join("\n")}
|
|
|
6203
6184
|
let activeSession;
|
|
6204
6185
|
let profilePath = "./profile.cpuprofile";
|
|
6205
6186
|
const Buffer2 = require("buffer").Buffer;
|
|
6206
|
-
const nodeVersion = getNodeMajorVersion();
|
|
6207
|
-
const isNode4OrLater = nodeVersion >= 4;
|
|
6208
6187
|
const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
6209
6188
|
const platform = _os.platform();
|
|
6210
6189
|
const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
|
6211
6190
|
const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
6212
6191
|
const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
|
|
6213
|
-
const fsSupportsRecursiveFsWatch =
|
|
6192
|
+
const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
|
|
6214
6193
|
const getCurrentDirectory = memoize(() => process.cwd());
|
|
6215
6194
|
const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
|
|
6216
6195
|
pollingWatchFileWorker: fsWatchFileWorker,
|
|
@@ -8180,12 +8159,14 @@ ${lanes.join("\n")}
|
|
|
8180
8159
|
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."),
|
|
8181
8160
|
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."),
|
|
8182
8161
|
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'."),
|
|
8183
|
-
|
|
8184
|
-
|
|
8162
|
+
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.`),
|
|
8163
|
+
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."),
|
|
8185
8164
|
Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."),
|
|
8186
8165
|
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}'."),
|
|
8187
8166
|
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'."),
|
|
8188
8167
|
Use_0_instead: diag(5106, 3 /* Message */, "Use_0_instead_5106", "Use '{0}' instead."),
|
|
8168
|
+
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.`),
|
|
8169
|
+
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."),
|
|
8189
8170
|
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."),
|
|
8190
8171
|
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."),
|
|
8191
8172
|
Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
|
|
@@ -39775,7 +39756,7 @@ ${lanes.join("\n")}
|
|
|
39775
39756
|
}
|
|
39776
39757
|
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
39777
39758
|
return nodeModuleNameResolverWorker(
|
|
39778
|
-
|
|
39759
|
+
30 /* NodeNextDefault */,
|
|
39779
39760
|
moduleName,
|
|
39780
39761
|
getDirectoryPath(containingFile),
|
|
39781
39762
|
{ moduleResolution: 99 /* NodeNext */ },
|
|
@@ -55557,9 +55538,10 @@ ${lanes.join("\n")}
|
|
|
55557
55538
|
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, emptyArray);
|
|
55558
55539
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
55559
55540
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
55560
|
-
const
|
|
55561
|
-
const
|
|
55562
|
-
const
|
|
55541
|
+
const mappedType = type.target || type;
|
|
55542
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
55543
|
+
const shouldLinkPropDeclarations = !nameType || isFilteringMappedType(mappedType);
|
|
55544
|
+
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
55563
55545
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
55564
55546
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
55565
55547
|
const include = keyofStringsOnly ? 128 /* StringLiteral */ : 8576 /* StringOrNumberLiteralOrUnique */;
|
|
@@ -55596,7 +55578,7 @@ ${lanes.join("\n")}
|
|
|
55596
55578
|
prop.links.keyType = keyType;
|
|
55597
55579
|
if (modifiersProp) {
|
|
55598
55580
|
prop.links.syntheticOrigin = modifiersProp;
|
|
55599
|
-
prop.declarations =
|
|
55581
|
+
prop.declarations = shouldLinkPropDeclarations ? modifiersProp.declarations : void 0;
|
|
55600
55582
|
}
|
|
55601
55583
|
members.set(propName, prop);
|
|
55602
55584
|
}
|
|
@@ -55702,6 +55684,10 @@ ${lanes.join("\n")}
|
|
|
55702
55684
|
}
|
|
55703
55685
|
return false;
|
|
55704
55686
|
}
|
|
55687
|
+
function isFilteringMappedType(type) {
|
|
55688
|
+
const nameType = getNameTypeFromMappedType(type);
|
|
55689
|
+
return !!nameType && isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type));
|
|
55690
|
+
}
|
|
55705
55691
|
function resolveStructuredTypeMembers(type) {
|
|
55706
55692
|
if (!type.members) {
|
|
55707
55693
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -58206,6 +58192,12 @@ ${lanes.join("\n")}
|
|
|
58206
58192
|
i--;
|
|
58207
58193
|
const source = types[i];
|
|
58208
58194
|
if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
58195
|
+
if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
|
|
58196
|
+
if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
|
|
58197
|
+
orderedRemoveItemAt(types, i);
|
|
58198
|
+
}
|
|
58199
|
+
continue;
|
|
58200
|
+
}
|
|
58209
58201
|
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
|
|
58210
58202
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
58211
58203
|
for (const target of types) {
|
|
@@ -59243,8 +59235,7 @@ ${lanes.join("\n")}
|
|
|
59243
59235
|
}
|
|
59244
59236
|
}
|
|
59245
59237
|
if (isGenericMappedType(objectType)) {
|
|
59246
|
-
|
|
59247
|
-
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
59238
|
+
if (!getNameTypeFromMappedType(objectType) || isFilteringMappedType(objectType)) {
|
|
59248
59239
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
59249
59240
|
}
|
|
59250
59241
|
}
|
|
@@ -60582,6 +60573,9 @@ ${lanes.join("\n")}
|
|
|
60582
60573
|
function isTypeSubtypeOf(source, target) {
|
|
60583
60574
|
return isTypeRelatedTo(source, target, subtypeRelation);
|
|
60584
60575
|
}
|
|
60576
|
+
function isTypeStrictSubtypeOf(source, target) {
|
|
60577
|
+
return isTypeRelatedTo(source, target, strictSubtypeRelation);
|
|
60578
|
+
}
|
|
60585
60579
|
function isTypeAssignableTo(source, target) {
|
|
60586
60580
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
60587
60581
|
}
|
|
@@ -62490,7 +62484,7 @@ ${lanes.join("\n")}
|
|
|
62490
62484
|
0 /* None */
|
|
62491
62485
|
);
|
|
62492
62486
|
}
|
|
62493
|
-
} else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
|
|
62487
|
+
} 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 */))) {
|
|
62494
62488
|
result2 &= propertiesRelatedTo(
|
|
62495
62489
|
source2,
|
|
62496
62490
|
target2,
|
|
@@ -63740,7 +63734,7 @@ ${lanes.join("\n")}
|
|
|
63740
63734
|
const targetHasStringIndex = some(indexInfos, (info) => info.keyType === stringType);
|
|
63741
63735
|
let result2 = -1 /* True */;
|
|
63742
63736
|
for (const targetInfo of indexInfos) {
|
|
63743
|
-
const related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
63737
|
+
const related = relation !== strictSubtypeRelation && !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
63744
63738
|
if (!related) {
|
|
63745
63739
|
return 0 /* False */;
|
|
63746
63740
|
}
|
|
@@ -67677,7 +67671,7 @@ ${lanes.join("\n")}
|
|
|
67677
67671
|
const narrowedType = mapType(candidate, (c) => {
|
|
67678
67672
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
67679
67673
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
67680
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) =>
|
|
67674
|
+
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);
|
|
67681
67675
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
67682
67676
|
});
|
|
67683
67677
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -81408,14 +81402,14 @@ ${lanes.join("\n")}
|
|
|
81408
81402
|
markAliasReferenced(sym, id);
|
|
81409
81403
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
81410
81404
|
checkExpressionCached(id);
|
|
81411
|
-
if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81405
|
+
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81412
81406
|
error(
|
|
81413
81407
|
id,
|
|
81414
81408
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration : Diagnostics.An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration,
|
|
81415
81409
|
idText(id)
|
|
81416
81410
|
);
|
|
81417
81411
|
}
|
|
81418
|
-
} else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
|
|
81412
|
+
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
81419
81413
|
error(
|
|
81420
81414
|
id,
|
|
81421
81415
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type : Diagnostics.An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type,
|
|
@@ -93818,8 +93812,15 @@ ${lanes.join("\n")}
|
|
|
93818
93812
|
false,
|
|
93819
93813
|
visitor
|
|
93820
93814
|
);
|
|
93821
|
-
|
|
93822
|
-
|
|
93815
|
+
const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
|
|
93816
|
+
if (superStatementIndex >= 0) {
|
|
93817
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, superStatementIndex + 1 - nonPrologueStart));
|
|
93818
|
+
addRange(statements, initializerStatements);
|
|
93819
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, superStatementIndex + 1));
|
|
93820
|
+
} else {
|
|
93821
|
+
addRange(statements, initializerStatements);
|
|
93822
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement));
|
|
93823
|
+
}
|
|
93823
93824
|
body = factory2.createBlock(
|
|
93824
93825
|
statements,
|
|
93825
93826
|
/*multiLine*/
|
|
@@ -115770,6 +115771,7 @@ ${lanes.join("\n")}
|
|
|
115770
115771
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
115771
115772
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions;
|
|
115772
115773
|
let { oldProgram } = createProgramOptions;
|
|
115774
|
+
const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations));
|
|
115773
115775
|
let processingDefaultLibFiles;
|
|
115774
115776
|
let processingOtherFiles;
|
|
115775
115777
|
let files;
|
|
@@ -118196,127 +118198,131 @@ ${lanes.join("\n")}
|
|
|
118196
118198
|
}
|
|
118197
118199
|
}
|
|
118198
118200
|
}
|
|
118199
|
-
function
|
|
118200
|
-
const version2 = typeScriptVersion3 || versionMajorMinor;
|
|
118201
|
+
function getIgnoreDeprecationsVersion() {
|
|
118201
118202
|
const ignoreDeprecations = options.ignoreDeprecations;
|
|
118202
118203
|
if (ignoreDeprecations) {
|
|
118203
|
-
if (ignoreDeprecations === "5.0"
|
|
118204
|
-
return;
|
|
118205
|
-
}
|
|
118206
|
-
|
|
118207
|
-
|
|
118204
|
+
if (ignoreDeprecations === "5.0") {
|
|
118205
|
+
return new Version(ignoreDeprecations);
|
|
118206
|
+
}
|
|
118207
|
+
reportInvalidIgnoreDeprecations();
|
|
118208
|
+
}
|
|
118209
|
+
return Version.zero;
|
|
118210
|
+
}
|
|
118211
|
+
function checkDeprecations(deprecatedIn, removedIn, createDiagnostic, fn) {
|
|
118212
|
+
const deprecatedInVersion = new Version(deprecatedIn);
|
|
118213
|
+
const removedInVersion = new Version(removedIn);
|
|
118214
|
+
const typescriptVersion = new Version(typeScriptVersion3 || versionMajorMinor);
|
|
118215
|
+
const ignoreDeprecationsVersion = getIgnoreDeprecationsVersion();
|
|
118216
|
+
const mustBeRemoved = !(removedInVersion.compareTo(typescriptVersion) === 1 /* GreaterThan */);
|
|
118217
|
+
const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === -1 /* LessThan */;
|
|
118218
|
+
if (mustBeRemoved || canBeSilenced) {
|
|
118219
|
+
fn((name, value, useInstead) => {
|
|
118220
|
+
if (mustBeRemoved) {
|
|
118221
|
+
if (value === void 0) {
|
|
118222
|
+
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name);
|
|
118223
|
+
} else {
|
|
118224
|
+
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value);
|
|
118225
|
+
}
|
|
118226
|
+
} else {
|
|
118227
|
+
if (value === void 0) {
|
|
118228
|
+
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);
|
|
118229
|
+
} else {
|
|
118230
|
+
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);
|
|
118231
|
+
}
|
|
118232
|
+
}
|
|
118233
|
+
});
|
|
118208
118234
|
}
|
|
118209
|
-
return version2;
|
|
118210
118235
|
}
|
|
118211
118236
|
function verifyDeprecatedCompilerOptions() {
|
|
118212
|
-
|
|
118213
|
-
|
|
118214
|
-
|
|
118215
|
-
|
|
118216
|
-
|
|
118217
|
-
|
|
118218
|
-
|
|
118219
|
-
|
|
118220
|
-
|
|
118221
|
-
|
|
118222
|
-
|
|
118223
|
-
|
|
118224
|
-
|
|
118225
|
-
|
|
118226
|
-
|
|
118227
|
-
|
|
118228
|
-
|
|
118229
|
-
|
|
118230
|
-
|
|
118231
|
-
|
|
118232
|
-
|
|
118233
|
-
|
|
118234
|
-
|
|
118235
|
-
|
|
118236
|
-
|
|
118237
|
-
|
|
118238
|
-
|
|
118239
|
-
|
|
118240
|
-
|
|
118241
|
-
}
|
|
118242
|
-
if (options.importsNotUsedAsValues) {
|
|
118243
|
-
createDeprecatedDiagnosticForOption(
|
|
118244
|
-
version2,
|
|
118245
|
-
"importsNotUsedAsValues",
|
|
118246
|
-
/*value*/
|
|
118247
|
-
void 0,
|
|
118248
|
-
"verbatimModuleSyntax"
|
|
118249
|
-
);
|
|
118250
|
-
}
|
|
118251
|
-
if (options.preserveValueImports) {
|
|
118252
|
-
createDeprecatedDiagnosticForOption(
|
|
118253
|
-
version2,
|
|
118254
|
-
"preserveValueImports",
|
|
118255
|
-
/*value*/
|
|
118256
|
-
void 0,
|
|
118257
|
-
"verbatimModuleSyntax"
|
|
118258
|
-
);
|
|
118259
|
-
}
|
|
118260
|
-
}
|
|
118261
|
-
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
|
118262
|
-
if (ref.prepend) {
|
|
118263
|
-
const version2 = getVersionForDeprecationDiagnostics(
|
|
118264
|
-
/*reportInvalidIgnoreDeprecations*/
|
|
118265
|
-
false
|
|
118266
|
-
);
|
|
118267
|
-
if (version2) {
|
|
118268
|
-
createDeprecatedOptionForVersionDiagnostic(
|
|
118269
|
-
version2,
|
|
118270
|
-
(message, arg0, arg1, arg2) => createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2),
|
|
118271
|
-
"prepend"
|
|
118237
|
+
function createDiagnostic(name, value, useInstead, message, arg0, arg1, arg2, arg3) {
|
|
118238
|
+
if (useInstead) {
|
|
118239
|
+
const details = chainDiagnosticMessages(
|
|
118240
|
+
/*details*/
|
|
118241
|
+
void 0,
|
|
118242
|
+
Diagnostics.Use_0_instead,
|
|
118243
|
+
useInstead
|
|
118244
|
+
);
|
|
118245
|
+
const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2, arg3);
|
|
118246
|
+
createDiagnosticForOption(
|
|
118247
|
+
/*onKey*/
|
|
118248
|
+
!value,
|
|
118249
|
+
name,
|
|
118250
|
+
/*option2*/
|
|
118251
|
+
void 0,
|
|
118252
|
+
chain
|
|
118253
|
+
);
|
|
118254
|
+
} else {
|
|
118255
|
+
createDiagnosticForOption(
|
|
118256
|
+
/*onKey*/
|
|
118257
|
+
!value,
|
|
118258
|
+
name,
|
|
118259
|
+
/*option2*/
|
|
118260
|
+
void 0,
|
|
118261
|
+
message,
|
|
118262
|
+
arg0,
|
|
118263
|
+
arg1,
|
|
118264
|
+
arg2,
|
|
118265
|
+
arg3
|
|
118272
118266
|
);
|
|
118273
118267
|
}
|
|
118274
118268
|
}
|
|
118269
|
+
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
|
118270
|
+
if (options.target === 0 /* ES3 */) {
|
|
118271
|
+
createDeprecatedDiagnostic("target", "ES3");
|
|
118272
|
+
}
|
|
118273
|
+
if (options.noImplicitUseStrict) {
|
|
118274
|
+
createDeprecatedDiagnostic("noImplicitUseStrict");
|
|
118275
|
+
}
|
|
118276
|
+
if (options.keyofStringsOnly) {
|
|
118277
|
+
createDeprecatedDiagnostic("keyofStringsOnly");
|
|
118278
|
+
}
|
|
118279
|
+
if (options.suppressExcessPropertyErrors) {
|
|
118280
|
+
createDeprecatedDiagnostic("suppressExcessPropertyErrors");
|
|
118281
|
+
}
|
|
118282
|
+
if (options.suppressImplicitAnyIndexErrors) {
|
|
118283
|
+
createDeprecatedDiagnostic("suppressImplicitAnyIndexErrors");
|
|
118284
|
+
}
|
|
118285
|
+
if (options.noStrictGenericChecks) {
|
|
118286
|
+
createDeprecatedDiagnostic("noStrictGenericChecks");
|
|
118287
|
+
}
|
|
118288
|
+
if (options.charset) {
|
|
118289
|
+
createDeprecatedDiagnostic("charset");
|
|
118290
|
+
}
|
|
118291
|
+
if (options.out) {
|
|
118292
|
+
createDeprecatedDiagnostic(
|
|
118293
|
+
"out",
|
|
118294
|
+
/*value*/
|
|
118295
|
+
void 0,
|
|
118296
|
+
"outFile"
|
|
118297
|
+
);
|
|
118298
|
+
}
|
|
118299
|
+
if (options.importsNotUsedAsValues) {
|
|
118300
|
+
createDeprecatedDiagnostic(
|
|
118301
|
+
"importsNotUsedAsValues",
|
|
118302
|
+
/*value*/
|
|
118303
|
+
void 0,
|
|
118304
|
+
"verbatimModuleSyntax"
|
|
118305
|
+
);
|
|
118306
|
+
}
|
|
118307
|
+
if (options.preserveValueImports) {
|
|
118308
|
+
createDeprecatedDiagnostic(
|
|
118309
|
+
"preserveValueImports",
|
|
118310
|
+
/*value*/
|
|
118311
|
+
void 0,
|
|
118312
|
+
"verbatimModuleSyntax"
|
|
118313
|
+
);
|
|
118314
|
+
}
|
|
118315
|
+
});
|
|
118275
118316
|
}
|
|
118276
|
-
function
|
|
118277
|
-
|
|
118278
|
-
|
|
118279
|
-
(message, arg0, arg1, arg2) => {
|
|
118280
|
-
if (useInstead) {
|
|
118281
|
-
const details = chainDiagnosticMessages(
|
|
118282
|
-
/*details*/
|
|
118283
|
-
void 0,
|
|
118284
|
-
Diagnostics.Use_0_instead,
|
|
118285
|
-
useInstead
|
|
118286
|
-
);
|
|
118287
|
-
const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2);
|
|
118288
|
-
createDiagnosticForOption(
|
|
118289
|
-
/*onKey*/
|
|
118290
|
-
!value,
|
|
118291
|
-
name,
|
|
118292
|
-
/*option2*/
|
|
118293
|
-
void 0,
|
|
118294
|
-
chain
|
|
118295
|
-
);
|
|
118296
|
-
} else {
|
|
118297
|
-
createDiagnosticForOption(
|
|
118298
|
-
/*onKey*/
|
|
118299
|
-
!value,
|
|
118300
|
-
name,
|
|
118301
|
-
/*option2*/
|
|
118302
|
-
void 0,
|
|
118303
|
-
message,
|
|
118304
|
-
arg0,
|
|
118305
|
-
arg1,
|
|
118306
|
-
arg2
|
|
118307
|
-
);
|
|
118308
|
-
}
|
|
118309
|
-
},
|
|
118310
|
-
name,
|
|
118311
|
-
value
|
|
118312
|
-
);
|
|
118313
|
-
}
|
|
118314
|
-
function createDeprecatedOptionForVersionDiagnostic(version2, createDiagnostic, name, value) {
|
|
118315
|
-
if (version2 === "6.0" /* v6_0 */) {
|
|
118316
|
-
createDiagnostic(Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name);
|
|
118317
|
-
} else {
|
|
118318
|
-
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 */);
|
|
118317
|
+
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
|
118318
|
+
function createDiagnostic(_name, _value, _useInstead, message, arg0, arg1, arg2, arg3) {
|
|
118319
|
+
createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2, arg3);
|
|
118319
118320
|
}
|
|
118321
|
+
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
|
118322
|
+
if (ref.prepend) {
|
|
118323
|
+
createDeprecatedDiagnostic("prepend");
|
|
118324
|
+
}
|
|
118325
|
+
});
|
|
118320
118326
|
}
|
|
118321
118327
|
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
|
|
118322
118328
|
var _a3;
|
|
@@ -118569,25 +118575,25 @@ ${lanes.join("\n")}
|
|
|
118569
118575
|
arg1
|
|
118570
118576
|
);
|
|
118571
118577
|
}
|
|
118572
|
-
function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2) {
|
|
118578
|
+
function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2, arg3) {
|
|
118573
118579
|
const referencesSyntax = firstDefined(
|
|
118574
118580
|
getTsConfigPropArray(sourceFile || options.configFile, "references"),
|
|
118575
118581
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
118576
118582
|
);
|
|
118577
118583
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
118578
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2));
|
|
118584
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2, arg3));
|
|
118579
118585
|
} else {
|
|
118580
|
-
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2));
|
|
118586
|
+
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3));
|
|
118581
118587
|
}
|
|
118582
118588
|
}
|
|
118583
|
-
function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2) {
|
|
118589
|
+
function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2, arg3) {
|
|
118584
118590
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
118585
|
-
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2);
|
|
118591
|
+
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2, arg3);
|
|
118586
118592
|
if (needCompilerDiagnostic) {
|
|
118587
118593
|
if ("messageText" in message) {
|
|
118588
118594
|
programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
|
|
118589
118595
|
} else {
|
|
118590
|
-
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2));
|
|
118596
|
+
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3));
|
|
118591
118597
|
}
|
|
118592
118598
|
}
|
|
118593
118599
|
}
|
|
@@ -118606,13 +118612,13 @@ ${lanes.join("\n")}
|
|
|
118606
118612
|
}
|
|
118607
118613
|
return _compilerOptionsObjectLiteralSyntax || void 0;
|
|
118608
118614
|
}
|
|
118609
|
-
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2) {
|
|
118615
|
+
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2, arg3) {
|
|
118610
118616
|
const props = getPropertyAssignment(objectLiteral, key1, key2);
|
|
118611
118617
|
for (const prop of props) {
|
|
118612
118618
|
if ("messageText" in message) {
|
|
118613
118619
|
programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
|
118614
118620
|
} else {
|
|
118615
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2));
|
|
118621
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2, arg3));
|
|
118616
118622
|
}
|
|
118617
118623
|
}
|
|
118618
118624
|
return !!props.length;
|
|
@@ -122905,7 +122911,6 @@ ${lanes.join("\n")}
|
|
|
122905
122911
|
);
|
|
122906
122912
|
}
|
|
122907
122913
|
function updateExtendedConfigFilesWatches(forProjectPath, options, watchOptions2, watchType) {
|
|
122908
|
-
Debug.assert(configFileName);
|
|
122909
122914
|
updateSharedExtendedConfigFileWatcher(
|
|
122910
122915
|
forProjectPath,
|
|
122911
122916
|
options,
|
|
@@ -122921,7 +122926,7 @@ ${lanes.join("\n")}
|
|
|
122921
122926
|
if (!(projects == null ? void 0 : projects.size))
|
|
122922
122927
|
return;
|
|
122923
122928
|
projects.forEach((projectPath) => {
|
|
122924
|
-
if (toPath3(configFileName) === projectPath) {
|
|
122929
|
+
if (configFileName && toPath3(configFileName) === projectPath) {
|
|
122925
122930
|
reloadLevel = 2 /* Full */;
|
|
122926
122931
|
} else {
|
|
122927
122932
|
const config = parsedConfigs == null ? void 0 : parsedConfigs.get(projectPath);
|
|
@@ -131828,6 +131833,9 @@ ${lanes.join("\n")}
|
|
|
131828
131833
|
}
|
|
131829
131834
|
}
|
|
131830
131835
|
for (const option of transpileOptionValueCompilerOptions) {
|
|
131836
|
+
if (options.verbatimModuleSyntax && optionsRedundantWithVerbatimModuleSyntax.has(option.name)) {
|
|
131837
|
+
continue;
|
|
131838
|
+
}
|
|
131831
131839
|
options[option.name] = option.transpileOptionValue;
|
|
131832
131840
|
}
|
|
131833
131841
|
options.suppressOutputPathCheck = true;
|
|
@@ -131931,11 +131939,16 @@ ${lanes.join("\n")}
|
|
|
131931
131939
|
}
|
|
131932
131940
|
return options;
|
|
131933
131941
|
}
|
|
131934
|
-
var commandLineOptionsStringToEnum;
|
|
131942
|
+
var optionsRedundantWithVerbatimModuleSyntax, commandLineOptionsStringToEnum;
|
|
131935
131943
|
var init_transpile = __esm({
|
|
131936
131944
|
"src/services/transpile.ts"() {
|
|
131937
131945
|
"use strict";
|
|
131938
131946
|
init_ts4();
|
|
131947
|
+
optionsRedundantWithVerbatimModuleSyntax = /* @__PURE__ */ new Set([
|
|
131948
|
+
"isolatedModules",
|
|
131949
|
+
"preserveValueImports",
|
|
131950
|
+
"importsNotUsedAsValues"
|
|
131951
|
+
]);
|
|
131939
131952
|
}
|
|
131940
131953
|
});
|
|
131941
131954
|
|
|
@@ -139792,32 +139805,96 @@ ${lanes.join("\n")}
|
|
|
139792
139805
|
});
|
|
139793
139806
|
|
|
139794
139807
|
// src/services/codefixes/convertToTypeOnlyImport.ts
|
|
139795
|
-
function
|
|
139796
|
-
|
|
139808
|
+
function getDeclaration2(sourceFile, pos) {
|
|
139809
|
+
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
139810
|
+
return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
|
|
139797
139811
|
}
|
|
139798
|
-
function
|
|
139799
|
-
if (
|
|
139800
|
-
|
|
139801
|
-
|
|
139802
|
-
|
|
139803
|
-
|
|
139804
|
-
|
|
139805
|
-
|
|
139806
|
-
changes.insertNodeBefore(context.sourceFile, importDeclaration, factory.updateImportDeclaration(
|
|
139807
|
-
importDeclaration,
|
|
139808
|
-
/*modifiers*/
|
|
139809
|
-
void 0,
|
|
139810
|
-
factory.createImportClause(
|
|
139811
|
-
/*isTypeOnly*/
|
|
139812
|
-
true,
|
|
139813
|
-
importClause.name,
|
|
139814
|
-
/*namedBindings*/
|
|
139815
|
-
void 0
|
|
139816
|
-
),
|
|
139817
|
-
importDeclaration.moduleSpecifier,
|
|
139818
|
-
/*assertClause*/
|
|
139819
|
-
void 0
|
|
139812
|
+
function doChange4(changes, sourceFile, declaration) {
|
|
139813
|
+
if (isImportSpecifier(declaration)) {
|
|
139814
|
+
changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
|
|
139815
|
+
declaration,
|
|
139816
|
+
/*isTypeOnly*/
|
|
139817
|
+
true,
|
|
139818
|
+
declaration.propertyName,
|
|
139819
|
+
declaration.name
|
|
139820
139820
|
));
|
|
139821
|
+
} else {
|
|
139822
|
+
const importClause = declaration.importClause;
|
|
139823
|
+
if (importClause.name && importClause.namedBindings) {
|
|
139824
|
+
changes.replaceNodeWithNodes(sourceFile, declaration, [
|
|
139825
|
+
factory.createImportDeclaration(
|
|
139826
|
+
getSynthesizedDeepClones(
|
|
139827
|
+
declaration.modifiers,
|
|
139828
|
+
/*includeTrivia*/
|
|
139829
|
+
true
|
|
139830
|
+
),
|
|
139831
|
+
factory.createImportClause(
|
|
139832
|
+
/*isTypeOnly*/
|
|
139833
|
+
true,
|
|
139834
|
+
getSynthesizedDeepClone(
|
|
139835
|
+
importClause.name,
|
|
139836
|
+
/*includeTrivia*/
|
|
139837
|
+
true
|
|
139838
|
+
),
|
|
139839
|
+
/*namedBindings*/
|
|
139840
|
+
void 0
|
|
139841
|
+
),
|
|
139842
|
+
getSynthesizedDeepClone(
|
|
139843
|
+
declaration.moduleSpecifier,
|
|
139844
|
+
/*includeTrivia*/
|
|
139845
|
+
true
|
|
139846
|
+
),
|
|
139847
|
+
getSynthesizedDeepClone(
|
|
139848
|
+
declaration.assertClause,
|
|
139849
|
+
/*includeTrivia*/
|
|
139850
|
+
true
|
|
139851
|
+
)
|
|
139852
|
+
),
|
|
139853
|
+
factory.createImportDeclaration(
|
|
139854
|
+
getSynthesizedDeepClones(
|
|
139855
|
+
declaration.modifiers,
|
|
139856
|
+
/*includeTrivia*/
|
|
139857
|
+
true
|
|
139858
|
+
),
|
|
139859
|
+
factory.createImportClause(
|
|
139860
|
+
/*isTypeOnly*/
|
|
139861
|
+
true,
|
|
139862
|
+
/*name*/
|
|
139863
|
+
void 0,
|
|
139864
|
+
getSynthesizedDeepClone(
|
|
139865
|
+
importClause.namedBindings,
|
|
139866
|
+
/*includeTrivia*/
|
|
139867
|
+
true
|
|
139868
|
+
)
|
|
139869
|
+
),
|
|
139870
|
+
getSynthesizedDeepClone(
|
|
139871
|
+
declaration.moduleSpecifier,
|
|
139872
|
+
/*includeTrivia*/
|
|
139873
|
+
true
|
|
139874
|
+
),
|
|
139875
|
+
getSynthesizedDeepClone(
|
|
139876
|
+
declaration.assertClause,
|
|
139877
|
+
/*includeTrivia*/
|
|
139878
|
+
true
|
|
139879
|
+
)
|
|
139880
|
+
)
|
|
139881
|
+
]);
|
|
139882
|
+
} else {
|
|
139883
|
+
const importDeclaration = factory.updateImportDeclaration(
|
|
139884
|
+
declaration,
|
|
139885
|
+
declaration.modifiers,
|
|
139886
|
+
factory.updateImportClause(
|
|
139887
|
+
importClause,
|
|
139888
|
+
/*isTypeOnly*/
|
|
139889
|
+
true,
|
|
139890
|
+
importClause.name,
|
|
139891
|
+
importClause.namedBindings
|
|
139892
|
+
),
|
|
139893
|
+
declaration.moduleSpecifier,
|
|
139894
|
+
declaration.assertClause
|
|
139895
|
+
);
|
|
139896
|
+
changes.replaceNode(sourceFile, declaration, importDeclaration);
|
|
139897
|
+
}
|
|
139821
139898
|
}
|
|
139822
139899
|
}
|
|
139823
139900
|
var errorCodes14, fixId13;
|
|
@@ -139826,24 +139903,28 @@ ${lanes.join("\n")}
|
|
|
139826
139903
|
"use strict";
|
|
139827
139904
|
init_ts4();
|
|
139828
139905
|
init_ts_codefix();
|
|
139829
|
-
errorCodes14 = [
|
|
139906
|
+
errorCodes14 = [
|
|
139907
|
+
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code,
|
|
139908
|
+
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
139909
|
+
];
|
|
139830
139910
|
fixId13 = "convertToTypeOnlyImport";
|
|
139831
139911
|
registerCodeFix({
|
|
139832
139912
|
errorCodes: errorCodes14,
|
|
139833
139913
|
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
139834
|
-
const
|
|
139835
|
-
|
|
139836
|
-
|
|
139837
|
-
});
|
|
139838
|
-
if (changes.length) {
|
|
139914
|
+
const declaration = getDeclaration2(context.sourceFile, context.span.start);
|
|
139915
|
+
if (declaration) {
|
|
139916
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, context.sourceFile, declaration));
|
|
139839
139917
|
return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)];
|
|
139840
139918
|
}
|
|
139919
|
+
return void 0;
|
|
139841
139920
|
},
|
|
139842
139921
|
fixIds: [fixId13],
|
|
139843
139922
|
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
139844
139923
|
return codeFixAll(context, errorCodes14, (changes, diag2) => {
|
|
139845
|
-
const
|
|
139846
|
-
|
|
139924
|
+
const declaration = getDeclaration2(diag2.file, diag2.start);
|
|
139925
|
+
if (declaration) {
|
|
139926
|
+
doChange4(changes, diag2.file, declaration);
|
|
139927
|
+
}
|
|
139847
139928
|
});
|
|
139848
139929
|
}
|
|
139849
139930
|
});
|
|
@@ -139865,7 +139946,7 @@ ${lanes.join("\n")}
|
|
|
139865
139946
|
}
|
|
139866
139947
|
return void 0;
|
|
139867
139948
|
}
|
|
139868
|
-
function
|
|
139949
|
+
function doChange5(changes, sourceFile, { container, typeNode, constraint, name }) {
|
|
139869
139950
|
changes.replaceNode(sourceFile, container, factory.createMappedTypeNode(
|
|
139870
139951
|
/*readonlyToken*/
|
|
139871
139952
|
void 0,
|
|
@@ -139901,14 +139982,14 @@ ${lanes.join("\n")}
|
|
|
139901
139982
|
return void 0;
|
|
139902
139983
|
}
|
|
139903
139984
|
const { name, constraint } = info;
|
|
139904
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
139985
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, sourceFile, info));
|
|
139905
139986
|
return [createCodeFixAction(fixId14, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId14, Diagnostics.Convert_all_type_literals_to_mapped_type)];
|
|
139906
139987
|
},
|
|
139907
139988
|
fixIds: [fixId14],
|
|
139908
139989
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => {
|
|
139909
139990
|
const info = getInfo2(diag2.file, diag2.start);
|
|
139910
139991
|
if (info) {
|
|
139911
|
-
|
|
139992
|
+
doChange5(changes, diag2.file, info);
|
|
139912
139993
|
}
|
|
139913
139994
|
})
|
|
139914
139995
|
});
|
|
@@ -141510,7 +141591,7 @@ ${lanes.join("\n")}
|
|
|
141510
141591
|
});
|
|
141511
141592
|
|
|
141512
141593
|
// src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts
|
|
141513
|
-
function
|
|
141594
|
+
function doChange6(changes, sourceFile, node, preferences) {
|
|
141514
141595
|
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
141515
141596
|
const argumentsExpression = factory.createStringLiteral(node.name.text, quotePreference === 0 /* Single */);
|
|
141516
141597
|
changes.replaceNode(
|
|
@@ -141538,16 +141619,16 @@ ${lanes.join("\n")}
|
|
|
141538
141619
|
getCodeActions(context) {
|
|
141539
141620
|
const { sourceFile, span, preferences } = context;
|
|
141540
141621
|
const property = getPropertyAccessExpression(sourceFile, span.start);
|
|
141541
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141622
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange6(t, context.sourceFile, property, preferences));
|
|
141542
141623
|
return [createCodeFixAction(fixId17, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId17, Diagnostics.Use_element_access_for_all_undeclared_properties)];
|
|
141543
141624
|
},
|
|
141544
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) =>
|
|
141625
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => doChange6(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences))
|
|
141545
141626
|
});
|
|
141546
141627
|
}
|
|
141547
141628
|
});
|
|
141548
141629
|
|
|
141549
141630
|
// src/services/codefixes/fixImplicitThis.ts
|
|
141550
|
-
function
|
|
141631
|
+
function doChange7(changes, sourceFile, pos, checker) {
|
|
141551
141632
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
141552
141633
|
if (!isThis(token))
|
|
141553
141634
|
return void 0;
|
|
@@ -141602,13 +141683,13 @@ ${lanes.join("\n")}
|
|
|
141602
141683
|
const { sourceFile, program, span } = context;
|
|
141603
141684
|
let diagnostic;
|
|
141604
141685
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
141605
|
-
diagnostic =
|
|
141686
|
+
diagnostic = doChange7(t, sourceFile, span.start, program.getTypeChecker());
|
|
141606
141687
|
});
|
|
141607
141688
|
return diagnostic ? [createCodeFixAction(fixId18, changes, diagnostic, fixId18, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray;
|
|
141608
141689
|
},
|
|
141609
141690
|
fixIds: [fixId18],
|
|
141610
141691
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => {
|
|
141611
|
-
|
|
141692
|
+
doChange7(changes, diag2.file, diag2.start, context.program.getTypeChecker());
|
|
141612
141693
|
})
|
|
141613
141694
|
});
|
|
141614
141695
|
}
|
|
@@ -141651,7 +141732,7 @@ ${lanes.join("\n")}
|
|
|
141651
141732
|
}
|
|
141652
141733
|
return void 0;
|
|
141653
141734
|
}
|
|
141654
|
-
function
|
|
141735
|
+
function doChange8(changes, program, { exportName, node, moduleSourceFile }) {
|
|
141655
141736
|
const exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly);
|
|
141656
141737
|
if (exportDeclaration) {
|
|
141657
141738
|
updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]);
|
|
@@ -141751,7 +141832,7 @@ ${lanes.join("\n")}
|
|
|
141751
141832
|
const info = getInfo4(sourceFile, span.start, program);
|
|
141752
141833
|
if (info === void 0)
|
|
141753
141834
|
return void 0;
|
|
141754
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141835
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, program, info));
|
|
141755
141836
|
return [createCodeFixAction(fixId19, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId19, Diagnostics.Export_all_referenced_locals)];
|
|
141756
141837
|
},
|
|
141757
141838
|
getAllCodeActions(context) {
|
|
@@ -141803,7 +141884,7 @@ ${lanes.join("\n")}
|
|
|
141803
141884
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
141804
141885
|
return findAncestor(token, (t) => t.kind === 199 /* NamedTupleMember */);
|
|
141805
141886
|
}
|
|
141806
|
-
function
|
|
141887
|
+
function doChange9(changes, sourceFile, namedTupleMember) {
|
|
141807
141888
|
if (!namedTupleMember) {
|
|
141808
141889
|
return;
|
|
141809
141890
|
}
|
|
@@ -141846,7 +141927,7 @@ ${lanes.join("\n")}
|
|
|
141846
141927
|
getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
|
|
141847
141928
|
const { sourceFile, span } = context;
|
|
141848
141929
|
const namedTupleMember = getNamedTupleMember(sourceFile, span.start);
|
|
141849
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141930
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, sourceFile, namedTupleMember));
|
|
141850
141931
|
return [createCodeFixAction(fixId20, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId20, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)];
|
|
141851
141932
|
},
|
|
141852
141933
|
fixIds: [fixId20]
|
|
@@ -141904,7 +141985,7 @@ ${lanes.join("\n")}
|
|
|
141904
141985
|
}
|
|
141905
141986
|
return suggestedSymbol === void 0 ? void 0 : { node, suggestedSymbol };
|
|
141906
141987
|
}
|
|
141907
|
-
function
|
|
141988
|
+
function doChange10(changes, sourceFile, node, suggestedSymbol, target) {
|
|
141908
141989
|
const suggestion = symbolName(suggestedSymbol);
|
|
141909
141990
|
if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) {
|
|
141910
141991
|
const valDecl = suggestedSymbol.valueDeclaration;
|
|
@@ -141970,7 +142051,7 @@ ${lanes.join("\n")}
|
|
|
141970
142051
|
return void 0;
|
|
141971
142052
|
const { node, suggestedSymbol } = info;
|
|
141972
142053
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
141973
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
142054
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, node, suggestedSymbol, target));
|
|
141974
142055
|
return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId21, Diagnostics.Fix_all_detected_spelling_errors)];
|
|
141975
142056
|
},
|
|
141976
142057
|
fixIds: [fixId21],
|
|
@@ -141978,7 +142059,7 @@ ${lanes.join("\n")}
|
|
|
141978
142059
|
const info = getInfo5(diag2.file, diag2.start, context, diag2.code);
|
|
141979
142060
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
141980
142061
|
if (info)
|
|
141981
|
-
|
|
142062
|
+
doChange10(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
|
|
141982
142063
|
})
|
|
141983
142064
|
});
|
|
141984
142065
|
}
|
|
@@ -143037,7 +143118,7 @@ ${lanes.join("\n")}
|
|
|
143037
143118
|
});
|
|
143038
143119
|
|
|
143039
143120
|
// src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
|
|
143040
|
-
function
|
|
143121
|
+
function doChange11(changes, sourceFile, constructor, superCall) {
|
|
143041
143122
|
changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall);
|
|
143042
143123
|
changes.delete(sourceFile, superCall);
|
|
143043
143124
|
}
|
|
@@ -143068,7 +143149,7 @@ ${lanes.join("\n")}
|
|
|
143068
143149
|
if (!nodes)
|
|
143069
143150
|
return void 0;
|
|
143070
143151
|
const { constructor, superCall } = nodes;
|
|
143071
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143152
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, constructor, superCall));
|
|
143072
143153
|
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)];
|
|
143073
143154
|
},
|
|
143074
143155
|
fixIds: [fixId25],
|
|
@@ -143081,7 +143162,7 @@ ${lanes.join("\n")}
|
|
|
143081
143162
|
return;
|
|
143082
143163
|
const { constructor, superCall } = nodes;
|
|
143083
143164
|
if (addToSeen(seenClasses, getNodeId(constructor.parent))) {
|
|
143084
|
-
|
|
143165
|
+
doChange11(changes, sourceFile, constructor, superCall);
|
|
143085
143166
|
}
|
|
143086
143167
|
});
|
|
143087
143168
|
}
|
|
@@ -143095,7 +143176,7 @@ ${lanes.join("\n")}
|
|
|
143095
143176
|
Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration");
|
|
143096
143177
|
return token.parent;
|
|
143097
143178
|
}
|
|
143098
|
-
function
|
|
143179
|
+
function doChange12(changes, sourceFile, ctr) {
|
|
143099
143180
|
const superCall = factory.createExpressionStatement(factory.createCallExpression(
|
|
143100
143181
|
factory.createSuper(),
|
|
143101
143182
|
/*typeArguments*/
|
|
@@ -143118,17 +143199,17 @@ ${lanes.join("\n")}
|
|
|
143118
143199
|
getCodeActions(context) {
|
|
143119
143200
|
const { sourceFile, span } = context;
|
|
143120
143201
|
const ctr = getNode(sourceFile, span.start);
|
|
143121
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143202
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, sourceFile, ctr));
|
|
143122
143203
|
return [createCodeFixAction(fixId26, changes, Diagnostics.Add_missing_super_call, fixId26, Diagnostics.Add_all_missing_super_calls)];
|
|
143123
143204
|
},
|
|
143124
143205
|
fixIds: [fixId26],
|
|
143125
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes31, (changes, diag2) =>
|
|
143206
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes31, (changes, diag2) => doChange12(changes, context.sourceFile, getNode(diag2.file, diag2.start)))
|
|
143126
143207
|
});
|
|
143127
143208
|
}
|
|
143128
143209
|
});
|
|
143129
143210
|
|
|
143130
143211
|
// src/services/codefixes/fixEnableJsxFlag.ts
|
|
143131
|
-
function
|
|
143212
|
+
function doChange13(changeTracker, configFile) {
|
|
143132
143213
|
setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react"));
|
|
143133
143214
|
}
|
|
143134
143215
|
var fixID, errorCodes32;
|
|
@@ -143148,7 +143229,7 @@ ${lanes.join("\n")}
|
|
|
143148
143229
|
}
|
|
143149
143230
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
143150
143231
|
context,
|
|
143151
|
-
(changeTracker) =>
|
|
143232
|
+
(changeTracker) => doChange13(changeTracker, configFile)
|
|
143152
143233
|
);
|
|
143153
143234
|
return [
|
|
143154
143235
|
createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file)
|
|
@@ -143160,7 +143241,7 @@ ${lanes.join("\n")}
|
|
|
143160
143241
|
if (configFile === void 0) {
|
|
143161
143242
|
return void 0;
|
|
143162
143243
|
}
|
|
143163
|
-
|
|
143244
|
+
doChange13(changes, configFile);
|
|
143164
143245
|
})
|
|
143165
143246
|
});
|
|
143166
143247
|
}
|
|
@@ -143182,7 +143263,7 @@ ${lanes.join("\n")}
|
|
|
143182
143263
|
}
|
|
143183
143264
|
return void 0;
|
|
143184
143265
|
}
|
|
143185
|
-
function
|
|
143266
|
+
function doChange14(changes, sourceFile, arg, expression) {
|
|
143186
143267
|
const callExpression = factory.createCallExpression(
|
|
143187
143268
|
factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")),
|
|
143188
143269
|
/*typeArguments*/
|
|
@@ -143218,7 +143299,7 @@ ${lanes.join("\n")}
|
|
|
143218
143299
|
if (info === void 0)
|
|
143219
143300
|
return;
|
|
143220
143301
|
const { suggestion, expression, arg } = info;
|
|
143221
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143302
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, sourceFile, arg, expression));
|
|
143222
143303
|
return [createCodeFixAction(fixId27, changes, [Diagnostics.Use_0, suggestion], fixId27, Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
143223
143304
|
},
|
|
143224
143305
|
fixIds: [fixId27],
|
|
@@ -143226,7 +143307,7 @@ ${lanes.join("\n")}
|
|
|
143226
143307
|
return codeFixAll(context, errorCodes33, (changes, diag2) => {
|
|
143227
143308
|
const info = getInfo8(context.program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
143228
143309
|
if (info) {
|
|
143229
|
-
|
|
143310
|
+
doChange14(changes, diag2.file, info.arg, info.expression);
|
|
143230
143311
|
}
|
|
143231
143312
|
});
|
|
143232
143313
|
}
|
|
@@ -143282,7 +143363,7 @@ ${lanes.join("\n")}
|
|
|
143282
143363
|
});
|
|
143283
143364
|
|
|
143284
143365
|
// src/services/codefixes/fixPropertyAssignment.ts
|
|
143285
|
-
function
|
|
143366
|
+
function doChange15(changes, sourceFile, node) {
|
|
143286
143367
|
changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer));
|
|
143287
143368
|
}
|
|
143288
143369
|
function getProperty2(sourceFile, pos) {
|
|
@@ -143304,10 +143385,10 @@ ${lanes.join("\n")}
|
|
|
143304
143385
|
getCodeActions(context) {
|
|
143305
143386
|
const { sourceFile, span } = context;
|
|
143306
143387
|
const property = getProperty2(sourceFile, span.start);
|
|
143307
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143388
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, context.sourceFile, property));
|
|
143308
143389
|
return [createCodeFixAction(fixId28, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId28, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
|
|
143309
143390
|
},
|
|
143310
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) =>
|
|
143391
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) => doChange15(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
|
|
143311
143392
|
});
|
|
143312
143393
|
}
|
|
143313
143394
|
});
|
|
@@ -143369,7 +143450,7 @@ ${lanes.join("\n")}
|
|
|
143369
143450
|
return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 };
|
|
143370
143451
|
}
|
|
143371
143452
|
}
|
|
143372
|
-
function
|
|
143453
|
+
function doChange16(changes, sourceFile, { node, className }) {
|
|
143373
143454
|
suppressLeadingAndTrailingTrivia(node);
|
|
143374
143455
|
changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node));
|
|
143375
143456
|
}
|
|
@@ -143394,14 +143475,14 @@ ${lanes.join("\n")}
|
|
|
143394
143475
|
if (!info) {
|
|
143395
143476
|
return void 0;
|
|
143396
143477
|
}
|
|
143397
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143478
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, sourceFile, info));
|
|
143398
143479
|
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)];
|
|
143399
143480
|
},
|
|
143400
143481
|
fixIds: [fixId30],
|
|
143401
143482
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => {
|
|
143402
143483
|
const info = getInfo9(diag2.file, diag2.start, diag2.code);
|
|
143403
143484
|
if (info)
|
|
143404
|
-
|
|
143485
|
+
doChange16(changes, context.sourceFile, info);
|
|
143405
143486
|
})
|
|
143406
143487
|
});
|
|
143407
143488
|
}
|
|
@@ -143411,7 +143492,7 @@ ${lanes.join("\n")}
|
|
|
143411
143492
|
function isValidCharacter(character) {
|
|
143412
143493
|
return hasProperty(htmlEntity, character);
|
|
143413
143494
|
}
|
|
143414
|
-
function
|
|
143495
|
+
function doChange17(changes, preferences, sourceFile, start, useHtmlEntity) {
|
|
143415
143496
|
const character = sourceFile.getText()[start];
|
|
143416
143497
|
if (!isValidCharacter(character)) {
|
|
143417
143498
|
return;
|
|
@@ -143436,7 +143517,7 @@ ${lanes.join("\n")}
|
|
|
143436
143517
|
fixIds: [fixIdExpression, fixIdHtmlEntity],
|
|
143437
143518
|
getCodeActions(context) {
|
|
143438
143519
|
const { sourceFile, preferences, span } = context;
|
|
143439
|
-
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143520
|
+
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(
|
|
143440
143521
|
t,
|
|
143441
143522
|
preferences,
|
|
143442
143523
|
sourceFile,
|
|
@@ -143444,7 +143525,7 @@ ${lanes.join("\n")}
|
|
|
143444
143525
|
/* useHtmlEntity */
|
|
143445
143526
|
false
|
|
143446
143527
|
));
|
|
143447
|
-
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143528
|
+
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(
|
|
143448
143529
|
t,
|
|
143449
143530
|
preferences,
|
|
143450
143531
|
sourceFile,
|
|
@@ -143458,7 +143539,7 @@ ${lanes.join("\n")}
|
|
|
143458
143539
|
];
|
|
143459
143540
|
},
|
|
143460
143541
|
getAllCodeActions(context) {
|
|
143461
|
-
return codeFixAll(context, errorCodes37, (changes, diagnostic) =>
|
|
143542
|
+
return codeFixAll(context, errorCodes37, (changes, diagnostic) => doChange17(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity));
|
|
143462
143543
|
}
|
|
143463
143544
|
});
|
|
143464
143545
|
htmlEntity = {
|
|
@@ -143951,7 +144032,7 @@ ${lanes.join("\n")}
|
|
|
143951
144032
|
});
|
|
143952
144033
|
|
|
143953
144034
|
// src/services/codefixes/fixUnreachableCode.ts
|
|
143954
|
-
function
|
|
144035
|
+
function doChange18(changes, sourceFile, start, length2, errorCode) {
|
|
143955
144036
|
const token = getTokenAtPosition(sourceFile, start);
|
|
143956
144037
|
const statement = findAncestor(token, isStatement);
|
|
143957
144038
|
if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) {
|
|
@@ -144013,17 +144094,17 @@ ${lanes.join("\n")}
|
|
|
144013
144094
|
const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
144014
144095
|
if (syntacticDiagnostics.length)
|
|
144015
144096
|
return;
|
|
144016
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144097
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, context.sourceFile, context.span.start, context.span.length, context.errorCode));
|
|
144017
144098
|
return [createCodeFixAction(fixId32, changes, Diagnostics.Remove_unreachable_code, fixId32, Diagnostics.Remove_all_unreachable_code)];
|
|
144018
144099
|
},
|
|
144019
144100
|
fixIds: [fixId32],
|
|
144020
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes41, (changes, diag2) =>
|
|
144101
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes41, (changes, diag2) => doChange18(changes, diag2.file, diag2.start, diag2.length, diag2.code))
|
|
144021
144102
|
});
|
|
144022
144103
|
}
|
|
144023
144104
|
});
|
|
144024
144105
|
|
|
144025
144106
|
// src/services/codefixes/fixUnusedLabel.ts
|
|
144026
|
-
function
|
|
144107
|
+
function doChange19(changes, sourceFile, start) {
|
|
144027
144108
|
const token = getTokenAtPosition(sourceFile, start);
|
|
144028
144109
|
const labeledStatement = cast(token.parent, isLabeledStatement);
|
|
144029
144110
|
const pos = token.getStart(sourceFile);
|
|
@@ -144047,17 +144128,17 @@ ${lanes.join("\n")}
|
|
|
144047
144128
|
registerCodeFix({
|
|
144048
144129
|
errorCodes: errorCodes42,
|
|
144049
144130
|
getCodeActions(context) {
|
|
144050
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144131
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, context.span.start));
|
|
144051
144132
|
return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unused_label, fixId33, Diagnostics.Remove_all_unused_labels)];
|
|
144052
144133
|
},
|
|
144053
144134
|
fixIds: [fixId33],
|
|
144054
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) =>
|
|
144135
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange19(changes, diag2.file, diag2.start))
|
|
144055
144136
|
});
|
|
144056
144137
|
}
|
|
144057
144138
|
});
|
|
144058
144139
|
|
|
144059
144140
|
// src/services/codefixes/fixJSDocTypes.ts
|
|
144060
|
-
function
|
|
144141
|
+
function doChange20(changes, sourceFile, oldTypeNode, newType, checker) {
|
|
144061
144142
|
changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(
|
|
144062
144143
|
newType,
|
|
144063
144144
|
/*enclosingDeclaration*/
|
|
@@ -144135,7 +144216,7 @@ ${lanes.join("\n")}
|
|
|
144135
144216
|
}
|
|
144136
144217
|
return actions2;
|
|
144137
144218
|
function fix(type2, fixId51, fixAllDescription) {
|
|
144138
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144219
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, sourceFile, typeNode, type2, checker));
|
|
144139
144220
|
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId51, fixAllDescription);
|
|
144140
144221
|
}
|
|
144141
144222
|
},
|
|
@@ -144149,7 +144230,7 @@ ${lanes.join("\n")}
|
|
|
144149
144230
|
return;
|
|
144150
144231
|
const { typeNode, type } = info;
|
|
144151
144232
|
const fixedType = typeNode.kind === 317 /* JSDocNullableType */ && fixId51 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
|
|
144152
|
-
|
|
144233
|
+
doChange20(changes, sourceFile, typeNode, fixedType, checker);
|
|
144153
144234
|
});
|
|
144154
144235
|
}
|
|
144155
144236
|
});
|
|
@@ -144157,7 +144238,7 @@ ${lanes.join("\n")}
|
|
|
144157
144238
|
});
|
|
144158
144239
|
|
|
144159
144240
|
// src/services/codefixes/fixMissingCallParentheses.ts
|
|
144160
|
-
function
|
|
144241
|
+
function doChange21(changes, sourceFile, name) {
|
|
144161
144242
|
changes.replaceNodeWithText(sourceFile, name, `${name.text}()`);
|
|
144162
144243
|
}
|
|
144163
144244
|
function getCallName(sourceFile, start) {
|
|
@@ -144192,13 +144273,13 @@ ${lanes.join("\n")}
|
|
|
144192
144273
|
const callName = getCallName(sourceFile, span.start);
|
|
144193
144274
|
if (!callName)
|
|
144194
144275
|
return;
|
|
144195
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144276
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, context.sourceFile, callName));
|
|
144196
144277
|
return [createCodeFixAction(fixId34, changes, Diagnostics.Add_missing_call_parentheses, fixId34, Diagnostics.Add_all_missing_call_parentheses)];
|
|
144197
144278
|
},
|
|
144198
144279
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes44, (changes, diag2) => {
|
|
144199
144280
|
const callName = getCallName(diag2.file, diag2.start);
|
|
144200
144281
|
if (callName)
|
|
144201
|
-
|
|
144282
|
+
doChange21(changes, diag2.file, callName);
|
|
144202
144283
|
})
|
|
144203
144284
|
});
|
|
144204
144285
|
}
|
|
@@ -144240,7 +144321,7 @@ ${lanes.join("\n")}
|
|
|
144240
144321
|
returnType: getReturnType(containingFunction)
|
|
144241
144322
|
};
|
|
144242
144323
|
}
|
|
144243
|
-
function
|
|
144324
|
+
function doChange22(changes, sourceFile, { insertBefore, returnType }) {
|
|
144244
144325
|
if (returnType) {
|
|
144245
144326
|
const entityName = getEntityNameFromTypeNode(returnType);
|
|
144246
144327
|
if (!entityName || entityName.kind !== 79 /* Identifier */ || entityName.text !== "Promise") {
|
|
@@ -144268,7 +144349,7 @@ ${lanes.join("\n")}
|
|
|
144268
144349
|
const nodes = getNodes3(sourceFile, span.start);
|
|
144269
144350
|
if (!nodes)
|
|
144270
144351
|
return void 0;
|
|
144271
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144352
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange22(t, sourceFile, nodes));
|
|
144272
144353
|
return [createCodeFixAction(fixId35, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId35, Diagnostics.Add_all_missing_async_modifiers)];
|
|
144273
144354
|
},
|
|
144274
144355
|
fixIds: [fixId35],
|
|
@@ -144278,7 +144359,7 @@ ${lanes.join("\n")}
|
|
|
144278
144359
|
const nodes = getNodes3(diag2.file, diag2.start);
|
|
144279
144360
|
if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore)))
|
|
144280
144361
|
return;
|
|
144281
|
-
|
|
144362
|
+
doChange22(changes, context.sourceFile, nodes);
|
|
144282
144363
|
});
|
|
144283
144364
|
}
|
|
144284
144365
|
});
|
|
@@ -144286,7 +144367,7 @@ ${lanes.join("\n")}
|
|
|
144286
144367
|
});
|
|
144287
144368
|
|
|
144288
144369
|
// src/services/codefixes/fixPropertyOverrideAccessor.ts
|
|
144289
|
-
function
|
|
144370
|
+
function doChange23(file, start, length2, code, context) {
|
|
144290
144371
|
let startPosition;
|
|
144291
144372
|
let endPosition;
|
|
144292
144373
|
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 +144408,14 @@ ${lanes.join("\n")}
|
|
|
144327
144408
|
registerCodeFix({
|
|
144328
144409
|
errorCodes: errorCodes46,
|
|
144329
144410
|
getCodeActions(context) {
|
|
144330
|
-
const edits =
|
|
144411
|
+
const edits = doChange23(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
|
|
144331
144412
|
if (edits) {
|
|
144332
144413
|
return [createCodeFixAction(fixId36, edits, Diagnostics.Generate_get_and_set_accessors, fixId36, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
|
|
144333
144414
|
}
|
|
144334
144415
|
},
|
|
144335
144416
|
fixIds: [fixId36],
|
|
144336
144417
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes46, (changes, diag2) => {
|
|
144337
|
-
const edits =
|
|
144418
|
+
const edits = doChange23(diag2.file, diag2.start, diag2.length, diag2.code, context);
|
|
144338
144419
|
if (edits) {
|
|
144339
144420
|
for (const edit of edits) {
|
|
144340
144421
|
changes.pushRaw(context.sourceFile, edit);
|
|
@@ -144381,7 +144462,7 @@ ${lanes.join("\n")}
|
|
|
144381
144462
|
}
|
|
144382
144463
|
return errorCode;
|
|
144383
144464
|
}
|
|
144384
|
-
function
|
|
144465
|
+
function doChange24(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) {
|
|
144385
144466
|
if (!isParameterPropertyModifier(token.kind) && token.kind !== 79 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 108 /* ThisKeyword */) {
|
|
144386
144467
|
return void 0;
|
|
144387
144468
|
}
|
|
@@ -145322,7 +145403,7 @@ ${lanes.join("\n")}
|
|
|
145322
145403
|
const token = getTokenAtPosition(sourceFile, start);
|
|
145323
145404
|
let declaration;
|
|
145324
145405
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => {
|
|
145325
|
-
declaration =
|
|
145406
|
+
declaration = doChange24(
|
|
145326
145407
|
changes2,
|
|
145327
145408
|
sourceFile,
|
|
145328
145409
|
token,
|
|
@@ -145343,7 +145424,7 @@ ${lanes.join("\n")}
|
|
|
145343
145424
|
const { sourceFile, program, cancellationToken, host, preferences } = context;
|
|
145344
145425
|
const markSeen = nodeSeenTracker();
|
|
145345
145426
|
return codeFixAll(context, errorCodes47, (changes, err) => {
|
|
145346
|
-
|
|
145427
|
+
doChange24(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
|
|
145347
145428
|
});
|
|
145348
145429
|
}
|
|
145349
145430
|
});
|
|
@@ -145374,7 +145455,7 @@ ${lanes.join("\n")}
|
|
|
145374
145455
|
return { returnTypeNode, returnType, promisedTypeNode, promisedType };
|
|
145375
145456
|
}
|
|
145376
145457
|
}
|
|
145377
|
-
function
|
|
145458
|
+
function doChange25(changes, sourceFile, returnTypeNode, promisedTypeNode) {
|
|
145378
145459
|
changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode]));
|
|
145379
145460
|
}
|
|
145380
145461
|
var fixId38, errorCodes48;
|
|
@@ -145398,7 +145479,7 @@ ${lanes.join("\n")}
|
|
|
145398
145479
|
return void 0;
|
|
145399
145480
|
}
|
|
145400
145481
|
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
|
|
145401
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
145482
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, sourceFile, returnTypeNode, promisedTypeNode));
|
|
145402
145483
|
return [createCodeFixAction(
|
|
145403
145484
|
fixId38,
|
|
145404
145485
|
changes,
|
|
@@ -145414,7 +145495,7 @@ ${lanes.join("\n")}
|
|
|
145414
145495
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes48, (changes, diag2) => {
|
|
145415
145496
|
const info = getInfo12(diag2.file, context.program.getTypeChecker(), diag2.start);
|
|
145416
145497
|
if (info) {
|
|
145417
|
-
|
|
145498
|
+
doChange25(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
|
|
145418
145499
|
}
|
|
145419
145500
|
})
|
|
145420
145501
|
});
|
|
@@ -146616,7 +146697,7 @@ ${lanes.join("\n")}
|
|
|
146616
146697
|
});
|
|
146617
146698
|
|
|
146618
146699
|
// src/services/codefixes/requireInTs.ts
|
|
146619
|
-
function
|
|
146700
|
+
function doChange26(changes, sourceFile, info) {
|
|
146620
146701
|
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
|
|
146621
146702
|
changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration(
|
|
146622
146703
|
/*modifiers*/
|
|
@@ -146693,14 +146774,14 @@ ${lanes.join("\n")}
|
|
|
146693
146774
|
if (!info) {
|
|
146694
146775
|
return void 0;
|
|
146695
146776
|
}
|
|
146696
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146777
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, context.sourceFile, info));
|
|
146697
146778
|
return [createCodeFixAction(fixId40, changes, Diagnostics.Convert_require_to_import, fixId40, Diagnostics.Convert_all_require_to_import)];
|
|
146698
146779
|
},
|
|
146699
146780
|
fixIds: [fixId40],
|
|
146700
146781
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes51, (changes, diag2) => {
|
|
146701
146782
|
const info = getInfo14(diag2.file, context.program, diag2.start);
|
|
146702
146783
|
if (info) {
|
|
146703
|
-
|
|
146784
|
+
doChange26(changes, context.sourceFile, info);
|
|
146704
146785
|
}
|
|
146705
146786
|
})
|
|
146706
146787
|
});
|
|
@@ -146720,7 +146801,7 @@ ${lanes.join("\n")}
|
|
|
146720
146801
|
return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
|
|
146721
146802
|
}
|
|
146722
146803
|
}
|
|
146723
|
-
function
|
|
146804
|
+
function doChange27(changes, sourceFile, info, preferences) {
|
|
146724
146805
|
changes.replaceNode(sourceFile, info.importNode, makeImport(
|
|
146725
146806
|
info.name,
|
|
146726
146807
|
/*namedImports*/
|
|
@@ -146744,14 +146825,14 @@ ${lanes.join("\n")}
|
|
|
146744
146825
|
const info = getInfo15(sourceFile, start);
|
|
146745
146826
|
if (!info)
|
|
146746
146827
|
return void 0;
|
|
146747
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146828
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, sourceFile, info, context.preferences));
|
|
146748
146829
|
return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_to_default_import, fixId41, Diagnostics.Convert_all_to_default_imports)];
|
|
146749
146830
|
},
|
|
146750
146831
|
fixIds: [fixId41],
|
|
146751
146832
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => {
|
|
146752
146833
|
const info = getInfo15(diag2.file, diag2.start);
|
|
146753
146834
|
if (info)
|
|
146754
|
-
|
|
146835
|
+
doChange27(changes, diag2.file, info, context.preferences);
|
|
146755
146836
|
})
|
|
146756
146837
|
});
|
|
146757
146838
|
}
|
|
@@ -146799,7 +146880,7 @@ ${lanes.join("\n")}
|
|
|
146799
146880
|
Debug.assert(token.parent.kind === 202 /* ImportType */, "Token parent should be an ImportType");
|
|
146800
146881
|
return token.parent;
|
|
146801
146882
|
}
|
|
146802
|
-
function
|
|
146883
|
+
function doChange28(changes, sourceFile, importType) {
|
|
146803
146884
|
const newTypeNode = factory.updateImportTypeNode(
|
|
146804
146885
|
importType,
|
|
146805
146886
|
importType.argument,
|
|
@@ -146825,11 +146906,11 @@ ${lanes.join("\n")}
|
|
|
146825
146906
|
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
146826
146907
|
const { sourceFile, span } = context;
|
|
146827
146908
|
const importType = getImportTypeNode(sourceFile, span.start);
|
|
146828
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146909
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, importType));
|
|
146829
146910
|
return [createCodeFixAction(fixId43, changes, Diagnostics.Add_missing_typeof, fixId43, Diagnostics.Add_missing_typeof)];
|
|
146830
146911
|
},
|
|
146831
146912
|
fixIds: [fixId43],
|
|
146832
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) =>
|
|
146913
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => doChange28(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
|
|
146833
146914
|
});
|
|
146834
146915
|
}
|
|
146835
146916
|
});
|
|
@@ -146848,7 +146929,7 @@ ${lanes.join("\n")}
|
|
|
146848
146929
|
return void 0;
|
|
146849
146930
|
return binaryExpr;
|
|
146850
146931
|
}
|
|
146851
|
-
function
|
|
146932
|
+
function doChange29(changeTracker, sf, node) {
|
|
146852
146933
|
const jsx = flattenInvalidBinaryExpr(node);
|
|
146853
146934
|
if (jsx)
|
|
146854
146935
|
changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment()));
|
|
@@ -146886,7 +146967,7 @@ ${lanes.join("\n")}
|
|
|
146886
146967
|
const node = findNodeToFix(sourceFile, span.start);
|
|
146887
146968
|
if (!node)
|
|
146888
146969
|
return void 0;
|
|
146889
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146970
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, node));
|
|
146890
146971
|
return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)];
|
|
146891
146972
|
},
|
|
146892
146973
|
fixIds: [fixID2],
|
|
@@ -146894,7 +146975,7 @@ ${lanes.join("\n")}
|
|
|
146894
146975
|
const node = findNodeToFix(context.sourceFile, diag2.start);
|
|
146895
146976
|
if (!node)
|
|
146896
146977
|
return void 0;
|
|
146897
|
-
|
|
146978
|
+
doChange29(changes, context.sourceFile, node);
|
|
146898
146979
|
})
|
|
146899
146980
|
});
|
|
146900
146981
|
}
|
|
@@ -146914,7 +146995,7 @@ ${lanes.join("\n")}
|
|
|
146914
146995
|
function createTypeAliasFromInterface(declaration, type) {
|
|
146915
146996
|
return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type);
|
|
146916
146997
|
}
|
|
146917
|
-
function
|
|
146998
|
+
function doChange30(changes, sourceFile, { indexSignature, container }) {
|
|
146918
146999
|
const members = isInterfaceDeclaration(container) ? container.members : container.type.members;
|
|
146919
147000
|
const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member));
|
|
146920
147001
|
const parameter = first(indexSignature.parameters);
|
|
@@ -146956,7 +147037,7 @@ ${lanes.join("\n")}
|
|
|
146956
147037
|
const info = getInfo16(sourceFile, span.start);
|
|
146957
147038
|
if (!info)
|
|
146958
147039
|
return void 0;
|
|
146959
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147040
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, info));
|
|
146960
147041
|
const name = idText(info.container.name);
|
|
146961
147042
|
return [createCodeFixAction(fixId44, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId44, [Diagnostics.Convert_0_to_mapped_object_type, name])];
|
|
146962
147043
|
},
|
|
@@ -146964,7 +147045,7 @@ ${lanes.join("\n")}
|
|
|
146964
147045
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => {
|
|
146965
147046
|
const info = getInfo16(diag2.file, diag2.start);
|
|
146966
147047
|
if (info)
|
|
146967
|
-
|
|
147048
|
+
doChange30(changes, diag2.file, info);
|
|
146968
147049
|
})
|
|
146969
147050
|
});
|
|
146970
147051
|
}
|
|
@@ -147125,7 +147206,7 @@ ${lanes.join("\n")}
|
|
|
147125
147206
|
return;
|
|
147126
147207
|
return { symbol, token: constToken };
|
|
147127
147208
|
}
|
|
147128
|
-
function
|
|
147209
|
+
function doChange31(changes, sourceFile, token) {
|
|
147129
147210
|
changes.replaceNode(sourceFile, token, factory.createToken(119 /* LetKeyword */));
|
|
147130
147211
|
}
|
|
147131
147212
|
var fixId48, errorCodes60;
|
|
@@ -147143,7 +147224,7 @@ ${lanes.join("\n")}
|
|
|
147143
147224
|
const info = getInfo17(sourceFile, span.start, program);
|
|
147144
147225
|
if (info === void 0)
|
|
147145
147226
|
return;
|
|
147146
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147227
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info.token));
|
|
147147
147228
|
return [createCodeFixActionMaybeFixAll(fixId48, changes, Diagnostics.Convert_const_to_let, fixId48, Diagnostics.Convert_all_const_to_let)];
|
|
147148
147229
|
},
|
|
147149
147230
|
getAllCodeActions: (context) => {
|
|
@@ -147154,7 +147235,7 @@ ${lanes.join("\n")}
|
|
|
147154
147235
|
const info = getInfo17(diag2.file, diag2.start, program);
|
|
147155
147236
|
if (info) {
|
|
147156
147237
|
if (addToSeen(seen, getSymbolId(info.symbol))) {
|
|
147157
|
-
return
|
|
147238
|
+
return doChange31(changes, diag2.file, info.token);
|
|
147158
147239
|
}
|
|
147159
147240
|
}
|
|
147160
147241
|
return void 0;
|
|
@@ -147171,7 +147252,7 @@ ${lanes.join("\n")}
|
|
|
147171
147252
|
const node = getTokenAtPosition(sourceFile, pos);
|
|
147172
147253
|
return node.kind === 26 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0;
|
|
147173
147254
|
}
|
|
147174
|
-
function
|
|
147255
|
+
function doChange32(changes, sourceFile, { node }) {
|
|
147175
147256
|
const newNode = factory.createToken(27 /* CommaToken */);
|
|
147176
147257
|
changes.replaceNode(sourceFile, node, newNode);
|
|
147177
147258
|
}
|
|
@@ -147191,7 +147272,7 @@ ${lanes.join("\n")}
|
|
|
147191
147272
|
const info = getInfo18(sourceFile, context.span.start, context.errorCode);
|
|
147192
147273
|
if (!info)
|
|
147193
147274
|
return void 0;
|
|
147194
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147275
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(t, sourceFile, info));
|
|
147195
147276
|
return [createCodeFixAction(
|
|
147196
147277
|
fixId49,
|
|
147197
147278
|
changes,
|
|
@@ -147204,7 +147285,7 @@ ${lanes.join("\n")}
|
|
|
147204
147285
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, diag2) => {
|
|
147205
147286
|
const info = getInfo18(diag2.file, diag2.start, diag2.code);
|
|
147206
147287
|
if (info)
|
|
147207
|
-
|
|
147288
|
+
doChange32(changes, context.sourceFile, info);
|
|
147208
147289
|
})
|
|
147209
147290
|
});
|
|
147210
147291
|
}
|
|
@@ -151070,7 +151151,7 @@ ${lanes.join("\n")}
|
|
|
151070
151151
|
const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
|
|
151071
151152
|
return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
|
|
151072
151153
|
default:
|
|
151073
|
-
return fromContextualType();
|
|
151154
|
+
return fromContextualType() || fromContextualType(0 /* None */);
|
|
151074
151155
|
}
|
|
151075
151156
|
function fromContextualType(contextFlags = 4 /* Completions */) {
|
|
151076
151157
|
const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
|
|
@@ -156500,7 +156581,7 @@ ${lanes.join("\n")}
|
|
|
156500
156581
|
return void 0;
|
|
156501
156582
|
}
|
|
156502
156583
|
}
|
|
156503
|
-
function
|
|
156584
|
+
function doChange33(exportingSourceFile, program, info, changes, cancellationToken) {
|
|
156504
156585
|
changeExport(exportingSourceFile, info, changes, program.getTypeChecker());
|
|
156505
156586
|
changeImports(program, info, changes, cancellationToken);
|
|
156506
156587
|
}
|
|
@@ -156696,7 +156777,7 @@ ${lanes.join("\n")}
|
|
|
156696
156777
|
Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name");
|
|
156697
156778
|
const info = getInfo19(context);
|
|
156698
156779
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
156699
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
156780
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(context.file, context.program, info, t, context.cancellationToken));
|
|
156700
156781
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
156701
156782
|
}
|
|
156702
156783
|
});
|
|
@@ -156731,7 +156812,7 @@ ${lanes.join("\n")}
|
|
|
156731
156812
|
function getShouldUseDefault(program, importClause) {
|
|
156732
156813
|
return getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker());
|
|
156733
156814
|
}
|
|
156734
|
-
function
|
|
156815
|
+
function doChange34(sourceFile, program, changes, info) {
|
|
156735
156816
|
const checker = program.getTypeChecker();
|
|
156736
156817
|
if (info.convertTo === 0 /* Named */) {
|
|
156737
156818
|
doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, getAllowSyntheticDefaultImports(program.getCompilerOptions()));
|
|
@@ -156923,7 +157004,7 @@ ${lanes.join("\n")}
|
|
|
156923
157004
|
Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name");
|
|
156924
157005
|
const info = getImportConversionInfo(context);
|
|
156925
157006
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
156926
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157007
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, t, info));
|
|
156927
157008
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
156928
157009
|
}
|
|
156929
157010
|
});
|
|
@@ -157265,7 +157346,7 @@ ${lanes.join("\n")}
|
|
|
157265
157346
|
afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex]
|
|
157266
157347
|
};
|
|
157267
157348
|
}
|
|
157268
|
-
function
|
|
157349
|
+
function doChange35(oldFile, program, toMove, changes, host, preferences) {
|
|
157269
157350
|
const checker = program.getTypeChecker();
|
|
157270
157351
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
157271
157352
|
const currentDirectory = getDirectoryPath(oldFile.fileName);
|
|
@@ -158035,7 +158116,7 @@ ${lanes.join("\n")}
|
|
|
158035
158116
|
getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
|
|
158036
158117
|
Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked");
|
|
158037
158118
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
158038
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158119
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(context.file, context.program, statements, t, context.host, context.preferences));
|
|
158039
158120
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
158040
158121
|
}
|
|
158041
158122
|
});
|
|
@@ -158697,12 +158778,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158697
158778
|
return void 0;
|
|
158698
158779
|
const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken);
|
|
158699
158780
|
if (groupedReferences.valid) {
|
|
158700
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158781
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(file, program, host, t, functionDeclaration, groupedReferences));
|
|
158701
158782
|
return { renameFilename: void 0, renameLocation: void 0, edits };
|
|
158702
158783
|
}
|
|
158703
158784
|
return { edits: [] };
|
|
158704
158785
|
}
|
|
158705
|
-
function
|
|
158786
|
+
function doChange36(sourceFile, program, host, changes, functionDeclaration, groupedReferences) {
|
|
158706
158787
|
const signature = groupedReferences.signature;
|
|
158707
158788
|
const newFunctionDeclarationParams = map(createNewParameters(functionDeclaration, program, host), (param) => getSynthesizedDeepClone(param));
|
|
158708
158789
|
if (signature) {
|
|
@@ -159495,7 +159576,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159495
159576
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
159496
159577
|
const edits = ts_textChanges_exports.ChangeTracker.with(
|
|
159497
159578
|
context,
|
|
159498
|
-
(t) =>
|
|
159579
|
+
(t) => doChange37(context.file, context.program.getTypeChecker(), t, info, actionName2)
|
|
159499
159580
|
);
|
|
159500
159581
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
159501
159582
|
}
|
|
@@ -159651,7 +159732,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159651
159732
|
}
|
|
159652
159733
|
return toConvert;
|
|
159653
159734
|
}
|
|
159654
|
-
function
|
|
159735
|
+
function doChange37(sourceFile, checker, changes, info, _actionName) {
|
|
159655
159736
|
const { finalExpression, occurrences, expression } = info;
|
|
159656
159737
|
const firstOccurrence = occurrences[occurrences.length - 1];
|
|
159657
159738
|
const convertedChain = convertOccurrences(checker, finalExpression, occurrences);
|
|
@@ -161387,7 +161468,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161387
161468
|
function getRefactorEditsToInferReturnType(context) {
|
|
161388
161469
|
const info = getInfo21(context);
|
|
161389
161470
|
if (info && !isRefactorErrorInfo(info)) {
|
|
161390
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
161471
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange38(context.file, t, info.declaration, info.returnTypeNode));
|
|
161391
161472
|
return { renameFilename: void 0, renameLocation: void 0, edits };
|
|
161392
161473
|
}
|
|
161393
161474
|
return void 0;
|
|
@@ -161412,7 +161493,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161412
161493
|
}
|
|
161413
161494
|
return emptyArray;
|
|
161414
161495
|
}
|
|
161415
|
-
function
|
|
161496
|
+
function doChange38(sourceFile, changes, declaration, typeNode) {
|
|
161416
161497
|
const closeParen = findChildOfKind(declaration, 21 /* CloseParenToken */, sourceFile);
|
|
161417
161498
|
const needParens = isArrowFunction(declaration) && closeParen === void 0;
|
|
161418
161499
|
const endNode2 = needParens ? first(declaration.parameters) : closeParen;
|
|
@@ -167459,7 +167540,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167459
167540
|
ContextFlags: () => ContextFlags,
|
|
167460
167541
|
CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter,
|
|
167461
167542
|
Debug: () => Debug,
|
|
167462
|
-
DeprecationVersion: () => DeprecationVersion,
|
|
167463
167543
|
DiagnosticCategory: () => DiagnosticCategory,
|
|
167464
167544
|
Diagnostics: () => Diagnostics,
|
|
167465
167545
|
DocumentHighlights: () => DocumentHighlights,
|
|
@@ -168282,7 +168362,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168282
168362
|
getNodeForGeneratedName: () => getNodeForGeneratedName,
|
|
168283
168363
|
getNodeId: () => getNodeId,
|
|
168284
168364
|
getNodeKind: () => getNodeKind,
|
|
168285
|
-
getNodeMajorVersion: () => getNodeMajorVersion,
|
|
168286
168365
|
getNodeModifiers: () => getNodeModifiers,
|
|
168287
168366
|
getNodeModulePathParts: () => getNodeModulePathParts,
|
|
168288
168367
|
getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
|