@typescript-deploys/pr-build 5.2.0-pr-54536-13 → 5.2.0-pr-54281-18
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.es2023.array.d.ts +36 -618
- package/lib/tsc.js +45 -51
- package/lib/tsserver.js +250 -200
- package/lib/tsserverlibrary.js +268 -209
- package/lib/typescript.js +268 -209
- package/lib/typingsInstaller.js +10 -13
- package/package.json +2 -3
package/lib/tsserver.js
CHANGED
|
@@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2304
2304
|
|
|
2305
2305
|
// src/compiler/corePublic.ts
|
|
2306
2306
|
var versionMajorMinor = "5.2";
|
|
2307
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2307
|
+
var version = `${versionMajorMinor}.0-insiders.20230607`;
|
|
2308
2308
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2309
2309
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2310
2310
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9494,6 +9494,8 @@ var Diagnostics = {
|
|
|
9494
9494
|
Class_constructor_may_not_be_a_generator: diag(1368, 1 /* Error */, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."),
|
|
9495
9495
|
Did_you_mean_0: diag(1369, 3 /* Message */, "Did_you_mean_0_1369", "Did you mean '{0}'?"),
|
|
9496
9496
|
This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, 1 /* Error */, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."),
|
|
9497
|
+
Convert_to_type_only_import: diag(1373, 3 /* Message */, "Convert_to_type_only_import_1373", "Convert to type-only import"),
|
|
9498
|
+
Convert_all_imports_not_used_as_a_value_to_type_only_imports: diag(1374, 3 /* Message */, "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374", "Convert all imports not used as a value to type-only imports"),
|
|
9497
9499
|
await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, 1 /* Error */, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
9498
9500
|
_0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
9499
9501
|
_0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
@@ -10699,8 +10701,6 @@ var Diagnostics = {
|
|
|
10699
10701
|
Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
|
|
10700
10702
|
Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
|
|
10701
10703
|
Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
|
|
10702
|
-
Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0: diag(6417, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0_6417", "Searching all ancestor node_modules directories for preferred extensions: {0}."),
|
|
10703
|
-
Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
|
|
10704
10704
|
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
|
|
10705
10705
|
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
|
|
10706
10706
|
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
|
|
@@ -11213,9 +11213,9 @@ var Diagnostics = {
|
|
|
11213
11213
|
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
11214
11214
|
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
|
|
11215
11215
|
Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11216
|
+
Inline_variable: diag(95180, 3 /* Message */, "Inline_variable_95180", "Inline variable"),
|
|
11217
|
+
Could_not_find_variable_to_inline: diag(95181, 3 /* Message */, "Could_not_find_variable_to_inline_95181", "Could not find variable to inline."),
|
|
11218
|
+
Variables_that_share_a_name_with_a_type_or_namespace_in_the_same_scope_cannot_be_inlined: diag(95182, 3 /* Message */, "Variables_that_share_a_name_with_a_type_or_namespace_in_the_same_scope_cannot_be_inlined_95182", "Variables that share a name with a type or namespace in the same scope cannot be inlined."),
|
|
11219
11219
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
11220
11220
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
11221
11221
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -43083,13 +43083,11 @@ function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName,
|
|
|
43083
43083
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
43084
43084
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
43085
43085
|
if (priorityExtensions) {
|
|
43086
|
-
traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0, formatExtensions(priorityExtensions));
|
|
43087
43086
|
const result = lookup(priorityExtensions);
|
|
43088
43087
|
if (result)
|
|
43089
43088
|
return result;
|
|
43090
43089
|
}
|
|
43091
43090
|
if (secondaryExtensions && !typesScopeOnly) {
|
|
43092
|
-
traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0, formatExtensions(secondaryExtensions));
|
|
43093
43091
|
return lookup(secondaryExtensions);
|
|
43094
43092
|
}
|
|
43095
43093
|
function lookup(extensions2) {
|
|
@@ -47309,11 +47307,10 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
47309
47307
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
47310
47308
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
47311
47309
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
47312
|
-
CheckMode3[CheckMode3["
|
|
47313
|
-
CheckMode3[CheckMode3["
|
|
47314
|
-
CheckMode3[CheckMode3["
|
|
47315
|
-
CheckMode3[CheckMode3["
|
|
47316
|
-
CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
|
|
47310
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
|
|
47311
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
|
|
47312
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
|
|
47313
|
+
CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
|
|
47317
47314
|
return CheckMode3;
|
|
47318
47315
|
})(CheckMode || {});
|
|
47319
47316
|
var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -47593,9 +47590,9 @@ function createTypeChecker(host) {
|
|
|
47593
47590
|
candidatesOutArray,
|
|
47594
47591
|
/*argumentCount*/
|
|
47595
47592
|
void 0,
|
|
47596
|
-
|
|
47593
|
+
32 /* IsForStringLiteralArgumentCompletions */
|
|
47597
47594
|
)),
|
|
47598
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount,
|
|
47595
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
47599
47596
|
getExpandedParameters,
|
|
47600
47597
|
hasEffectiveRestParameter,
|
|
47601
47598
|
containsArgumentsReference,
|
|
@@ -55550,7 +55547,7 @@ function createTypeChecker(host) {
|
|
|
55550
55547
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
55551
55548
|
}
|
|
55552
55549
|
function getTypeForBindingElement(declaration) {
|
|
55553
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
55550
|
+
const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
|
|
55554
55551
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
55555
55552
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
55556
55553
|
}
|
|
@@ -57307,13 +57304,19 @@ function createTypeChecker(host) {
|
|
|
57307
57304
|
if (getObjectFlags(type) & 4 /* Reference */) {
|
|
57308
57305
|
const target = type.target;
|
|
57309
57306
|
const typeArguments = getTypeArguments(type);
|
|
57310
|
-
|
|
57307
|
+
if (length(target.typeParameters) === length(typeArguments)) {
|
|
57308
|
+
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
|
|
57309
|
+
return needApparentType ? getApparentType(ref) : ref;
|
|
57310
|
+
}
|
|
57311
57311
|
} else if (type.flags & 2097152 /* Intersection */) {
|
|
57312
57312
|
const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
|
|
57313
57313
|
return types !== type.types ? getIntersectionType(types) : type;
|
|
57314
57314
|
}
|
|
57315
57315
|
return needApparentType ? getApparentType(type) : type;
|
|
57316
57316
|
}
|
|
57317
|
+
function getThisArgument(type) {
|
|
57318
|
+
return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
|
|
57319
|
+
}
|
|
57317
57320
|
function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
|
|
57318
57321
|
let mapper;
|
|
57319
57322
|
let members;
|
|
@@ -58379,7 +58382,7 @@ function createTypeChecker(host) {
|
|
|
58379
58382
|
return type.resolvedBaseConstraint;
|
|
58380
58383
|
}
|
|
58381
58384
|
const stack = [];
|
|
58382
|
-
return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
|
|
58385
|
+
return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), getThisArgument(type));
|
|
58383
58386
|
function getImmediateBaseConstraint(t) {
|
|
58384
58387
|
if (!t.immediateBaseConstraint) {
|
|
58385
58388
|
if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
|
|
@@ -58471,18 +58474,18 @@ function createTypeChecker(host) {
|
|
|
58471
58474
|
}
|
|
58472
58475
|
if (isGenericTupleType(t)) {
|
|
58473
58476
|
const newElements = map(getElementTypes(t), (v, i) => {
|
|
58474
|
-
const constraint =
|
|
58475
|
-
return constraint
|
|
58477
|
+
const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
58478
|
+
return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
58476
58479
|
});
|
|
58477
58480
|
return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
|
|
58478
58481
|
}
|
|
58479
58482
|
return t;
|
|
58480
58483
|
}
|
|
58481
58484
|
}
|
|
58482
|
-
function getApparentTypeOfIntersectionType(type
|
|
58485
|
+
function getApparentTypeOfIntersectionType(type) {
|
|
58483
58486
|
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
58484
58487
|
type,
|
|
58485
|
-
|
|
58488
|
+
type,
|
|
58486
58489
|
/*needApparentType*/
|
|
58487
58490
|
true
|
|
58488
58491
|
));
|
|
@@ -58533,9 +58536,8 @@ function createTypeChecker(host) {
|
|
|
58533
58536
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
58534
58537
|
}
|
|
58535
58538
|
function getApparentType(type) {
|
|
58536
|
-
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType
|
|
58537
|
-
|
|
58538
|
-
return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
58539
|
+
const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
|
|
58540
|
+
return getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
58539
58541
|
}
|
|
58540
58542
|
function getReducedApparentType(type) {
|
|
58541
58543
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
@@ -65356,7 +65358,7 @@ function createTypeChecker(host) {
|
|
|
65356
65358
|
return 3 /* Maybe */;
|
|
65357
65359
|
}
|
|
65358
65360
|
const c = target2;
|
|
65359
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)
|
|
65361
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
65360
65362
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
65361
65363
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
65362
65364
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -69366,8 +69368,6 @@ function createTypeChecker(host) {
|
|
|
69366
69368
|
}
|
|
69367
69369
|
function isConstantReference(node) {
|
|
69368
69370
|
switch (node.kind) {
|
|
69369
|
-
case 110 /* ThisKeyword */:
|
|
69370
|
-
return true;
|
|
69371
69371
|
case 80 /* Identifier */:
|
|
69372
69372
|
if (!isThisInTypeQuery(node)) {
|
|
69373
69373
|
const symbol = getResolvedSymbol(node);
|
|
@@ -70442,7 +70442,7 @@ function createTypeChecker(host) {
|
|
|
70442
70442
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
70443
70443
|
}
|
|
70444
70444
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
70445
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
70445
|
+
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 64 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
|
|
70446
70446
|
node,
|
|
70447
70447
|
/*contextFlags*/
|
|
70448
70448
|
void 0
|
|
@@ -71199,7 +71199,7 @@ function createTypeChecker(host) {
|
|
|
71199
71199
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
71200
71200
|
const parent2 = declaration.parent.parent;
|
|
71201
71201
|
const name = declaration.propertyName || declaration.name;
|
|
71202
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ?
|
|
71202
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
|
|
71203
71203
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
71204
71204
|
return void 0;
|
|
71205
71205
|
if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -72248,9 +72248,7 @@ function createTypeChecker(host) {
|
|
|
72248
72248
|
elementTypes.push(undefinedOrMissingType);
|
|
72249
72249
|
elementFlags.push(2 /* Optional */);
|
|
72250
72250
|
} else {
|
|
72251
|
-
const
|
|
72252
|
-
const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
72253
|
-
const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
|
|
72251
|
+
const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
|
|
72254
72252
|
elementTypes.push(addOptionality(
|
|
72255
72253
|
type,
|
|
72256
72254
|
/*isProperty*/
|
|
@@ -72258,7 +72256,7 @@ function createTypeChecker(host) {
|
|
|
72258
72256
|
hasOmittedExpression
|
|
72259
72257
|
));
|
|
72260
72258
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
72261
|
-
if (
|
|
72259
|
+
if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
|
|
72262
72260
|
const inferenceContext = getInferenceContext(node);
|
|
72263
72261
|
Debug.assert(inferenceContext);
|
|
72264
72262
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -72399,13 +72397,11 @@ function createTypeChecker(host) {
|
|
|
72399
72397
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
72400
72398
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
72401
72399
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
72402
|
-
|
|
72403
|
-
const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
72404
|
-
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
|
|
72400
|
+
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : (
|
|
72405
72401
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
72406
72402
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
72407
72403
|
// we don't want to say "could not find 'a'".
|
|
72408
|
-
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name,
|
|
72404
|
+
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode)
|
|
72409
72405
|
);
|
|
72410
72406
|
if (isInJavascript) {
|
|
72411
72407
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -72449,7 +72445,7 @@ function createTypeChecker(host) {
|
|
|
72449
72445
|
prop.links.target = member;
|
|
72450
72446
|
member = prop;
|
|
72451
72447
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
72452
|
-
if (
|
|
72448
|
+
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
|
|
72453
72449
|
const inferenceContext = getInferenceContext(node);
|
|
72454
72450
|
Debug.assert(inferenceContext);
|
|
72455
72451
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -72622,9 +72618,7 @@ function createTypeChecker(host) {
|
|
|
72622
72618
|
for (const attributeDecl of attributes.properties) {
|
|
72623
72619
|
const member = attributeDecl.symbol;
|
|
72624
72620
|
if (isJsxAttribute(attributeDecl)) {
|
|
72625
|
-
const
|
|
72626
|
-
const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
72627
|
-
const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
|
|
72621
|
+
const exprType = checkJsxAttribute(attributeDecl, checkMode);
|
|
72628
72622
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
72629
72623
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
72630
72624
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -72645,7 +72639,7 @@ function createTypeChecker(host) {
|
|
|
72645
72639
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
72646
72640
|
}
|
|
72647
72641
|
}
|
|
72648
|
-
if (
|
|
72642
|
+
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
|
|
72649
72643
|
const inferenceContext = getInferenceContext(attributes);
|
|
72650
72644
|
Debug.assert(inferenceContext);
|
|
72651
72645
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -74263,7 +74257,7 @@ function createTypeChecker(host) {
|
|
|
74263
74257
|
}
|
|
74264
74258
|
for (let i = 0; i < argCount; i++) {
|
|
74265
74259
|
const arg = args[i];
|
|
74266
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
74260
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
74267
74261
|
const paramType = getTypeAtPosition(signature, i);
|
|
74268
74262
|
if (couldContainTypeVariables(paramType)) {
|
|
74269
74263
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -74876,12 +74870,12 @@ function createTypeChecker(host) {
|
|
|
74876
74870
|
const args = getEffectiveCallArguments(node);
|
|
74877
74871
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
74878
74872
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
74879
|
-
argCheckMode |= checkMode &
|
|
74873
|
+
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
74880
74874
|
let candidatesForArgumentError;
|
|
74881
74875
|
let candidateForArgumentArityError;
|
|
74882
74876
|
let candidateForTypeArgumentError;
|
|
74883
74877
|
let result;
|
|
74884
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
74878
|
+
const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
74885
74879
|
if (candidates.length > 1) {
|
|
74886
74880
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
74887
74881
|
}
|
|
@@ -75100,7 +75094,7 @@ function createTypeChecker(host) {
|
|
|
75100
75094
|
continue;
|
|
75101
75095
|
}
|
|
75102
75096
|
if (argCheckMode) {
|
|
75103
|
-
argCheckMode = checkMode &
|
|
75097
|
+
argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
75104
75098
|
if (inferenceContext) {
|
|
75105
75099
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
75106
75100
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -78178,7 +78172,7 @@ function createTypeChecker(host) {
|
|
|
78178
78172
|
case 36 /* ExclamationEqualsToken */:
|
|
78179
78173
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
78180
78174
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
78181
|
-
if (!(checkMode && checkMode &
|
|
78175
|
+
if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
|
|
78182
78176
|
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
78183
78177
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
78184
78178
|
error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
@@ -78837,7 +78831,7 @@ function createTypeChecker(host) {
|
|
|
78837
78831
|
}
|
|
78838
78832
|
}
|
|
78839
78833
|
const startInvocationCount = flowInvocationCount;
|
|
78840
|
-
const type = checkExpression(node,
|
|
78834
|
+
const type = checkExpression(node, 128 /* TypeOnly */);
|
|
78841
78835
|
if (flowInvocationCount !== startInvocationCount) {
|
|
78842
78836
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
78843
78837
|
cache[getNodeId(node)] = type;
|
|
@@ -81308,7 +81302,7 @@ function createTypeChecker(host) {
|
|
|
81308
81302
|
checkComputedPropertyName(node.propertyName);
|
|
81309
81303
|
}
|
|
81310
81304
|
const parent2 = node.parent.parent;
|
|
81311
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
81305
|
+
const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
|
|
81312
81306
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
81313
81307
|
const name = node.propertyName || node.name;
|
|
81314
81308
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -100230,7 +100224,7 @@ function transformJsx(context) {
|
|
|
100230
100224
|
continue;
|
|
100231
100225
|
}
|
|
100232
100226
|
finishObjectLiteralIfNeeded();
|
|
100233
|
-
expressions.push(
|
|
100227
|
+
expressions.push(attr.expression);
|
|
100234
100228
|
continue;
|
|
100235
100229
|
}
|
|
100236
100230
|
properties.push(transformJsxAttributeToObjectLiteralElement(attr));
|
|
@@ -135645,8 +135639,8 @@ function getApplicableRefactors(context, includeInteractiveActions) {
|
|
|
135645
135639
|
return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context, includeInteractiveActions);
|
|
135646
135640
|
}));
|
|
135647
135641
|
}
|
|
135648
|
-
function getEditsForRefactor(context,
|
|
135649
|
-
const refactor = refactors.get(
|
|
135642
|
+
function getEditsForRefactor(context, refactorName14, actionName2, interactiveRefactorArguments) {
|
|
135643
|
+
const refactor = refactors.get(refactorName14);
|
|
135650
135644
|
return refactor && refactor.getEditsForAction(context, actionName2, interactiveRefactorArguments);
|
|
135651
135645
|
}
|
|
135652
135646
|
|
|
@@ -136414,24 +136408,147 @@ function refactorKindBeginsWith(known, requested) {
|
|
|
136414
136408
|
return known.substr(0, requested.length) === requested;
|
|
136415
136409
|
}
|
|
136416
136410
|
|
|
136411
|
+
// src/services/refactors/inlineVariable.ts
|
|
136412
|
+
var refactorName4 = "Inline variable";
|
|
136413
|
+
var refactorDescription = getLocaleSpecificMessage(Diagnostics.Inline_variable);
|
|
136414
|
+
var inlineVariableAction = {
|
|
136415
|
+
name: refactorName4,
|
|
136416
|
+
description: refactorDescription,
|
|
136417
|
+
kind: "refactor.inline.variable"
|
|
136418
|
+
};
|
|
136419
|
+
registerRefactor(refactorName4, {
|
|
136420
|
+
kinds: [inlineVariableAction.kind],
|
|
136421
|
+
getAvailableActions(context) {
|
|
136422
|
+
const {
|
|
136423
|
+
file,
|
|
136424
|
+
program,
|
|
136425
|
+
preferences,
|
|
136426
|
+
startPosition,
|
|
136427
|
+
triggerReason
|
|
136428
|
+
} = context;
|
|
136429
|
+
const info = getInliningInfo(file, startPosition, triggerReason === "invoked", program);
|
|
136430
|
+
if (!info) {
|
|
136431
|
+
return emptyArray;
|
|
136432
|
+
}
|
|
136433
|
+
if (ts_refactor_exports.isRefactorErrorInfo(info) && preferences.provideRefactorNotApplicableReason) {
|
|
136434
|
+
return [{
|
|
136435
|
+
name: refactorName4,
|
|
136436
|
+
description: refactorDescription,
|
|
136437
|
+
actions: [{
|
|
136438
|
+
...inlineVariableAction,
|
|
136439
|
+
notApplicableReason: info.error
|
|
136440
|
+
}]
|
|
136441
|
+
}];
|
|
136442
|
+
}
|
|
136443
|
+
if (!ts_refactor_exports.isRefactorErrorInfo(info)) {
|
|
136444
|
+
return [{
|
|
136445
|
+
name: refactorName4,
|
|
136446
|
+
description: refactorDescription,
|
|
136447
|
+
actions: [inlineVariableAction]
|
|
136448
|
+
}];
|
|
136449
|
+
}
|
|
136450
|
+
return emptyArray;
|
|
136451
|
+
},
|
|
136452
|
+
getEditsForAction(context, actionName2) {
|
|
136453
|
+
Debug.assert(actionName2 === refactorName4, "Unexpected refactor invoked");
|
|
136454
|
+
const { file, program, startPosition } = context;
|
|
136455
|
+
const info = getInliningInfo(
|
|
136456
|
+
file,
|
|
136457
|
+
startPosition,
|
|
136458
|
+
/*tryWithReferenceToken*/
|
|
136459
|
+
true,
|
|
136460
|
+
program
|
|
136461
|
+
);
|
|
136462
|
+
if (!info || ts_refactor_exports.isRefactorErrorInfo(info)) {
|
|
136463
|
+
return void 0;
|
|
136464
|
+
}
|
|
136465
|
+
const { references, declaration, replacement } = info;
|
|
136466
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
|
|
136467
|
+
for (const node of references) {
|
|
136468
|
+
tracker.replaceNode(file, node, getReplacementExpression(node, replacement));
|
|
136469
|
+
}
|
|
136470
|
+
tracker.delete(file, declaration);
|
|
136471
|
+
});
|
|
136472
|
+
return { edits };
|
|
136473
|
+
}
|
|
136474
|
+
});
|
|
136475
|
+
function getInliningInfo(file, startPosition, tryWithReferenceToken, program) {
|
|
136476
|
+
var _a, _b;
|
|
136477
|
+
const checker = program.getTypeChecker();
|
|
136478
|
+
const token = getTokenAtPosition(file, startPosition);
|
|
136479
|
+
const parent2 = token.parent;
|
|
136480
|
+
if (isInitializedVariable(parent2) && isVariableDeclarationInVariableStatement(parent2) && isIdentifier(parent2.name)) {
|
|
136481
|
+
if (((_a = parent2.symbol.declarations) == null ? void 0 : _a.length) !== 1) {
|
|
136482
|
+
return { error: getLocaleSpecificMessage(Diagnostics.Variables_that_share_a_name_with_a_type_or_namespace_in_the_same_scope_cannot_be_inlined) };
|
|
136483
|
+
}
|
|
136484
|
+
if (findAncestor(parent2, (node) => canHaveModifiers(node) && some(node.modifiers, isExportModifier))) {
|
|
136485
|
+
return void 0;
|
|
136486
|
+
}
|
|
136487
|
+
const references = getReferenceNodes(parent2, checker, file);
|
|
136488
|
+
return references && { references, declaration: parent2, replacement: parent2.initializer };
|
|
136489
|
+
}
|
|
136490
|
+
if (tryWithReferenceToken && isIdentifier(token)) {
|
|
136491
|
+
const definition = checker.resolveName(
|
|
136492
|
+
token.text,
|
|
136493
|
+
token,
|
|
136494
|
+
111551 /* Value */,
|
|
136495
|
+
/*excludeGlobals*/
|
|
136496
|
+
false
|
|
136497
|
+
);
|
|
136498
|
+
if (((_b = definition == null ? void 0 : definition.declarations) == null ? void 0 : _b.length) !== 1) {
|
|
136499
|
+
return { error: getLocaleSpecificMessage(Diagnostics.Variables_that_share_a_name_with_a_type_or_namespace_in_the_same_scope_cannot_be_inlined) };
|
|
136500
|
+
}
|
|
136501
|
+
const declaration = definition.declarations[0];
|
|
136502
|
+
if (!isInitializedVariable(declaration) || !isVariableDeclarationInVariableStatement(declaration) || !isIdentifier(declaration.name)) {
|
|
136503
|
+
return void 0;
|
|
136504
|
+
}
|
|
136505
|
+
const references = getReferenceNodes(declaration, checker, file);
|
|
136506
|
+
return references && { references, declaration, replacement: declaration.initializer };
|
|
136507
|
+
}
|
|
136508
|
+
return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_variable_to_inline) };
|
|
136509
|
+
}
|
|
136510
|
+
function getReferenceNodes(declaration, checker, file) {
|
|
136511
|
+
const references = [];
|
|
136512
|
+
const cannotInline = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(declaration.name, checker, file, (ref) => {
|
|
136513
|
+
if (ts_FindAllReferences_exports.isWriteAccessForReference(ref)) {
|
|
136514
|
+
return true;
|
|
136515
|
+
}
|
|
136516
|
+
if (isTypeQueryNode(ref.parent)) {
|
|
136517
|
+
return true;
|
|
136518
|
+
}
|
|
136519
|
+
if (findAncestor(ref, (node) => node === declaration.initializer)) {
|
|
136520
|
+
return true;
|
|
136521
|
+
}
|
|
136522
|
+
references.push(ref);
|
|
136523
|
+
});
|
|
136524
|
+
return references.length === 0 || cannotInline ? void 0 : references;
|
|
136525
|
+
}
|
|
136526
|
+
function getReplacementExpression(reference, replacement) {
|
|
136527
|
+
const { parent: parent2 } = reference;
|
|
136528
|
+
if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
|
|
136529
|
+
return factory.createParenthesizedExpression(replacement);
|
|
136530
|
+
}
|
|
136531
|
+
return replacement;
|
|
136532
|
+
}
|
|
136533
|
+
|
|
136417
136534
|
// src/services/refactors/moveToNewFile.ts
|
|
136418
|
-
var
|
|
136535
|
+
var refactorName5 = "Move to a new file";
|
|
136419
136536
|
var description = getLocaleSpecificMessage(Diagnostics.Move_to_a_new_file);
|
|
136420
136537
|
var moveToNewFileAction = {
|
|
136421
|
-
name:
|
|
136538
|
+
name: refactorName5,
|
|
136422
136539
|
description,
|
|
136423
136540
|
kind: "refactor.move.newFile"
|
|
136424
136541
|
};
|
|
136425
|
-
registerRefactor(
|
|
136542
|
+
registerRefactor(refactorName5, {
|
|
136426
136543
|
kinds: [moveToNewFileAction.kind],
|
|
136427
136544
|
getAvailableActions: function getRefactorActionsToMoveToNewFile(context) {
|
|
136428
136545
|
const statements = getStatementsToMove(context);
|
|
136429
136546
|
if (context.preferences.allowTextChangesInNewFiles && statements) {
|
|
136430
|
-
return [{ name:
|
|
136547
|
+
return [{ name: refactorName5, description, actions: [moveToNewFileAction] }];
|
|
136431
136548
|
}
|
|
136432
136549
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
136433
136550
|
return [{
|
|
136434
|
-
name:
|
|
136551
|
+
name: refactorName5,
|
|
136435
136552
|
description,
|
|
136436
136553
|
actions: [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }]
|
|
136437
136554
|
}];
|
|
@@ -136439,7 +136556,7 @@ registerRefactor(refactorName4, {
|
|
|
136439
136556
|
return emptyArray;
|
|
136440
136557
|
},
|
|
136441
136558
|
getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
|
|
136442
|
-
Debug.assert(actionName2 ===
|
|
136559
|
+
Debug.assert(actionName2 === refactorName5, "Wrong refactor invoked");
|
|
136443
136560
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
136444
136561
|
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange3(context.file, context.program, statements, t, context.host, context.preferences, context));
|
|
136445
136562
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
@@ -137416,14 +137533,14 @@ function getOverloadRangeToMove(sourceFile, statement) {
|
|
|
137416
137533
|
var ts_refactor_addOrRemoveBracesToArrowFunction_exports = {};
|
|
137417
137534
|
|
|
137418
137535
|
// src/services/refactors/convertOverloadListToSingleSignature.ts
|
|
137419
|
-
var
|
|
137420
|
-
var
|
|
137536
|
+
var refactorName6 = "Convert overload list to single signature";
|
|
137537
|
+
var refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
|
|
137421
137538
|
var functionOverloadAction = {
|
|
137422
|
-
name:
|
|
137423
|
-
description:
|
|
137539
|
+
name: refactorName6,
|
|
137540
|
+
description: refactorDescription2,
|
|
137424
137541
|
kind: "refactor.rewrite.function.overloadList"
|
|
137425
137542
|
};
|
|
137426
|
-
registerRefactor(
|
|
137543
|
+
registerRefactor(refactorName6, {
|
|
137427
137544
|
kinds: [functionOverloadAction.kind],
|
|
137428
137545
|
getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature,
|
|
137429
137546
|
getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature
|
|
@@ -137434,8 +137551,8 @@ function getRefactorActionsToConvertOverloadsToOneSignature(context) {
|
|
|
137434
137551
|
if (!info)
|
|
137435
137552
|
return emptyArray;
|
|
137436
137553
|
return [{
|
|
137437
|
-
name:
|
|
137438
|
-
description:
|
|
137554
|
+
name: refactorName6,
|
|
137555
|
+
description: refactorDescription2,
|
|
137439
137556
|
actions: [functionOverloadAction]
|
|
137440
137557
|
}];
|
|
137441
137558
|
}
|
|
@@ -137628,8 +137745,8 @@ function getConvertableOverloadListAtPosition(file, startPosition, program) {
|
|
|
137628
137745
|
}
|
|
137629
137746
|
|
|
137630
137747
|
// src/services/refactors/addOrRemoveBracesToArrowFunction.ts
|
|
137631
|
-
var
|
|
137632
|
-
var
|
|
137748
|
+
var refactorName7 = "Add or remove braces in an arrow function";
|
|
137749
|
+
var refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
|
|
137633
137750
|
var addBracesAction = {
|
|
137634
137751
|
name: "Add braces to arrow function",
|
|
137635
137752
|
description: getLocaleSpecificMessage(Diagnostics.Add_braces_to_arrow_function),
|
|
@@ -137640,7 +137757,7 @@ var removeBracesAction = {
|
|
|
137640
137757
|
description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function),
|
|
137641
137758
|
kind: "refactor.rewrite.arrow.braces.remove"
|
|
137642
137759
|
};
|
|
137643
|
-
registerRefactor(
|
|
137760
|
+
registerRefactor(refactorName7, {
|
|
137644
137761
|
kinds: [removeBracesAction.kind],
|
|
137645
137762
|
getEditsForAction: getRefactorEditsToRemoveFunctionBraces,
|
|
137646
137763
|
getAvailableActions: getRefactorActionsToRemoveFunctionBraces
|
|
@@ -137652,8 +137769,8 @@ function getRefactorActionsToRemoveFunctionBraces(context) {
|
|
|
137652
137769
|
return emptyArray;
|
|
137653
137770
|
if (!isRefactorErrorInfo(info)) {
|
|
137654
137771
|
return [{
|
|
137655
|
-
name:
|
|
137656
|
-
description:
|
|
137772
|
+
name: refactorName7,
|
|
137773
|
+
description: refactorDescription3,
|
|
137657
137774
|
actions: [
|
|
137658
137775
|
info.addBraces ? addBracesAction : removeBracesAction
|
|
137659
137776
|
]
|
|
@@ -137661,8 +137778,8 @@ function getRefactorActionsToRemoveFunctionBraces(context) {
|
|
|
137661
137778
|
}
|
|
137662
137779
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
137663
137780
|
return [{
|
|
137664
|
-
name:
|
|
137665
|
-
description:
|
|
137781
|
+
name: refactorName7,
|
|
137782
|
+
description: refactorDescription3,
|
|
137666
137783
|
actions: [
|
|
137667
137784
|
{ ...addBracesAction, notApplicableReason: info.error },
|
|
137668
137785
|
{ ...removeBracesAction, notApplicableReason: info.error }
|
|
@@ -137758,8 +137875,8 @@ function getConvertibleArrowFunctionAtPosition(file, startPosition, considerFunc
|
|
|
137758
137875
|
var ts_refactor_convertArrowFunctionOrFunctionExpression_exports = {};
|
|
137759
137876
|
|
|
137760
137877
|
// src/services/refactors/convertArrowFunctionOrFunctionExpression.ts
|
|
137761
|
-
var
|
|
137762
|
-
var
|
|
137878
|
+
var refactorName8 = "Convert arrow function or function expression";
|
|
137879
|
+
var refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression);
|
|
137763
137880
|
var toAnonymousFunctionAction = {
|
|
137764
137881
|
name: "Convert to anonymous function",
|
|
137765
137882
|
description: getLocaleSpecificMessage(Diagnostics.Convert_to_anonymous_function),
|
|
@@ -137775,7 +137892,7 @@ var toArrowFunctionAction = {
|
|
|
137775
137892
|
description: getLocaleSpecificMessage(Diagnostics.Convert_to_arrow_function),
|
|
137776
137893
|
kind: "refactor.rewrite.function.arrow"
|
|
137777
137894
|
};
|
|
137778
|
-
registerRefactor(
|
|
137895
|
+
registerRefactor(refactorName8, {
|
|
137779
137896
|
kinds: [
|
|
137780
137897
|
toAnonymousFunctionAction.kind,
|
|
137781
137898
|
toNamedFunctionAction.kind,
|
|
@@ -137817,8 +137934,8 @@ function getRefactorActionsToConvertFunctionExpressions(context) {
|
|
|
137817
137934
|
}
|
|
137818
137935
|
}
|
|
137819
137936
|
return [{
|
|
137820
|
-
name:
|
|
137821
|
-
description:
|
|
137937
|
+
name: refactorName8,
|
|
137938
|
+
description: refactorDescription4,
|
|
137822
137939
|
actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? errors : possibleActions
|
|
137823
137940
|
}];
|
|
137824
137941
|
}
|
|
@@ -137983,15 +138100,15 @@ function isFunctionReferencedInFile(sourceFile, typeChecker, node) {
|
|
|
137983
138100
|
var ts_refactor_convertParamsToDestructuredObject_exports = {};
|
|
137984
138101
|
|
|
137985
138102
|
// src/services/refactors/convertParamsToDestructuredObject.ts
|
|
137986
|
-
var
|
|
138103
|
+
var refactorName9 = "Convert parameters to destructured object";
|
|
137987
138104
|
var minimumParameterLength = 1;
|
|
137988
|
-
var
|
|
138105
|
+
var refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object);
|
|
137989
138106
|
var toDestructuredAction = {
|
|
137990
|
-
name:
|
|
137991
|
-
description:
|
|
138107
|
+
name: refactorName9,
|
|
138108
|
+
description: refactorDescription5,
|
|
137992
138109
|
kind: "refactor.rewrite.parameters.toDestructured"
|
|
137993
138110
|
};
|
|
137994
|
-
registerRefactor(
|
|
138111
|
+
registerRefactor(refactorName9, {
|
|
137995
138112
|
kinds: [toDestructuredAction.kind],
|
|
137996
138113
|
getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject,
|
|
137997
138114
|
getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject
|
|
@@ -138005,13 +138122,13 @@ function getRefactorActionsToConvertParametersToDestructuredObject(context) {
|
|
|
138005
138122
|
if (!functionDeclaration)
|
|
138006
138123
|
return emptyArray;
|
|
138007
138124
|
return [{
|
|
138008
|
-
name:
|
|
138009
|
-
description:
|
|
138125
|
+
name: refactorName9,
|
|
138126
|
+
description: refactorDescription5,
|
|
138010
138127
|
actions: [toDestructuredAction]
|
|
138011
138128
|
}];
|
|
138012
138129
|
}
|
|
138013
138130
|
function getRefactorEditsToConvertParametersToDestructuredObject(context, actionName2) {
|
|
138014
|
-
Debug.assert(actionName2 ===
|
|
138131
|
+
Debug.assert(actionName2 === refactorName9, "Unexpected action name");
|
|
138015
138132
|
const { file, startPosition, program, cancellationToken, host } = context;
|
|
138016
138133
|
const functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, program.getTypeChecker());
|
|
138017
138134
|
if (!functionDeclaration || !cancellationToken)
|
|
@@ -138526,14 +138643,14 @@ function getFunctionNames(functionDeclaration) {
|
|
|
138526
138643
|
var ts_refactor_convertStringOrTemplateLiteral_exports = {};
|
|
138527
138644
|
|
|
138528
138645
|
// src/services/refactors/convertStringOrTemplateLiteral.ts
|
|
138529
|
-
var
|
|
138530
|
-
var
|
|
138646
|
+
var refactorName10 = "Convert to template string";
|
|
138647
|
+
var refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string);
|
|
138531
138648
|
var convertStringAction = {
|
|
138532
|
-
name:
|
|
138533
|
-
description:
|
|
138649
|
+
name: refactorName10,
|
|
138650
|
+
description: refactorDescription6,
|
|
138534
138651
|
kind: "refactor.rewrite.string"
|
|
138535
138652
|
};
|
|
138536
|
-
registerRefactor(
|
|
138653
|
+
registerRefactor(refactorName10, {
|
|
138537
138654
|
kinds: [convertStringAction.kind],
|
|
138538
138655
|
getEditsForAction: getRefactorEditsToConvertToTemplateString,
|
|
138539
138656
|
getAvailableActions: getRefactorActionsToConvertToTemplateString
|
|
@@ -138542,7 +138659,7 @@ function getRefactorActionsToConvertToTemplateString(context) {
|
|
|
138542
138659
|
const { file, startPosition } = context;
|
|
138543
138660
|
const node = getNodeOrParentOfParentheses(file, startPosition);
|
|
138544
138661
|
const maybeBinary = getParentBinaryExpression(node);
|
|
138545
|
-
const refactorInfo = { name:
|
|
138662
|
+
const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
|
|
138546
138663
|
if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
|
|
138547
138664
|
refactorInfo.actions.push(convertStringAction);
|
|
138548
138665
|
return [refactorInfo];
|
|
@@ -138568,7 +138685,7 @@ function getRefactorEditsToConvertToTemplateString(context, actionName2) {
|
|
|
138568
138685
|
const { file, startPosition } = context;
|
|
138569
138686
|
const node = getNodeOrParentOfParentheses(file, startPosition);
|
|
138570
138687
|
switch (actionName2) {
|
|
138571
|
-
case
|
|
138688
|
+
case refactorDescription6:
|
|
138572
138689
|
return { edits: getEditsForToTemplateLiteral(context, node) };
|
|
138573
138690
|
default:
|
|
138574
138691
|
return Debug.fail("invalid action");
|
|
@@ -138750,14 +138867,14 @@ function getExpressionFromParenthesesOrExpression(node) {
|
|
|
138750
138867
|
var ts_refactor_convertToOptionalChainExpression_exports = {};
|
|
138751
138868
|
|
|
138752
138869
|
// src/services/refactors/convertToOptionalChainExpression.ts
|
|
138753
|
-
var
|
|
138870
|
+
var refactorName11 = "Convert to optional chain expression";
|
|
138754
138871
|
var convertToOptionalChainExpressionMessage = getLocaleSpecificMessage(Diagnostics.Convert_to_optional_chain_expression);
|
|
138755
138872
|
var toOptionalChainAction = {
|
|
138756
|
-
name:
|
|
138873
|
+
name: refactorName11,
|
|
138757
138874
|
description: convertToOptionalChainExpressionMessage,
|
|
138758
138875
|
kind: "refactor.rewrite.expression.optionalChain"
|
|
138759
138876
|
};
|
|
138760
|
-
registerRefactor(
|
|
138877
|
+
registerRefactor(refactorName11, {
|
|
138761
138878
|
kinds: [toOptionalChainAction.kind],
|
|
138762
138879
|
getEditsForAction: getRefactorEditsToConvertToOptionalChain,
|
|
138763
138880
|
getAvailableActions: getRefactorActionsToConvertToOptionalChain
|
|
@@ -138768,14 +138885,14 @@ function getRefactorActionsToConvertToOptionalChain(context) {
|
|
|
138768
138885
|
return emptyArray;
|
|
138769
138886
|
if (!isRefactorErrorInfo(info)) {
|
|
138770
138887
|
return [{
|
|
138771
|
-
name:
|
|
138888
|
+
name: refactorName11,
|
|
138772
138889
|
description: convertToOptionalChainExpressionMessage,
|
|
138773
138890
|
actions: [toOptionalChainAction]
|
|
138774
138891
|
}];
|
|
138775
138892
|
}
|
|
138776
138893
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
138777
138894
|
return [{
|
|
138778
|
-
name:
|
|
138895
|
+
name: refactorName11,
|
|
138779
138896
|
description: convertToOptionalChainExpressionMessage,
|
|
138780
138897
|
actions: [{ ...toOptionalChainAction, notApplicableReason: info.error }]
|
|
138781
138898
|
}];
|
|
@@ -138971,7 +139088,7 @@ __export(ts_refactor_extractSymbol_exports, {
|
|
|
138971
139088
|
});
|
|
138972
139089
|
|
|
138973
139090
|
// src/services/refactors/extractSymbol.ts
|
|
138974
|
-
var
|
|
139091
|
+
var refactorName12 = "Extract Symbol";
|
|
138975
139092
|
var extractConstantAction = {
|
|
138976
139093
|
name: "Extract Constant",
|
|
138977
139094
|
description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
|
|
@@ -138982,7 +139099,7 @@ var extractFunctionAction = {
|
|
|
138982
139099
|
description: getLocaleSpecificMessage(Diagnostics.Extract_function),
|
|
138983
139100
|
kind: "refactor.extract.function"
|
|
138984
139101
|
};
|
|
138985
|
-
registerRefactor(
|
|
139102
|
+
registerRefactor(refactorName12, {
|
|
138986
139103
|
kinds: [
|
|
138987
139104
|
extractConstantAction.kind,
|
|
138988
139105
|
extractFunctionAction.kind
|
|
@@ -139001,14 +139118,14 @@ function getRefactorActionsToExtractSymbol(context) {
|
|
|
139001
139118
|
const errors = [];
|
|
139002
139119
|
if (refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) {
|
|
139003
139120
|
errors.push({
|
|
139004
|
-
name:
|
|
139121
|
+
name: refactorName12,
|
|
139005
139122
|
description: extractFunctionAction.description,
|
|
139006
139123
|
actions: [{ ...extractFunctionAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
|
|
139007
139124
|
});
|
|
139008
139125
|
}
|
|
139009
139126
|
if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) {
|
|
139010
139127
|
errors.push({
|
|
139011
|
-
name:
|
|
139128
|
+
name: refactorName12,
|
|
139012
139129
|
description: extractConstantAction.description,
|
|
139013
139130
|
actions: [{ ...extractConstantAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
|
|
139014
139131
|
});
|
|
@@ -139072,26 +139189,26 @@ function getRefactorActionsToExtractSymbol(context) {
|
|
|
139072
139189
|
const infos = [];
|
|
139073
139190
|
if (functionActions.length) {
|
|
139074
139191
|
infos.push({
|
|
139075
|
-
name:
|
|
139192
|
+
name: refactorName12,
|
|
139076
139193
|
description: getLocaleSpecificMessage(Diagnostics.Extract_function),
|
|
139077
139194
|
actions: functionActions
|
|
139078
139195
|
});
|
|
139079
139196
|
} else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) {
|
|
139080
139197
|
infos.push({
|
|
139081
|
-
name:
|
|
139198
|
+
name: refactorName12,
|
|
139082
139199
|
description: getLocaleSpecificMessage(Diagnostics.Extract_function),
|
|
139083
139200
|
actions: [innermostErrorFunctionAction]
|
|
139084
139201
|
});
|
|
139085
139202
|
}
|
|
139086
139203
|
if (constantActions.length) {
|
|
139087
139204
|
infos.push({
|
|
139088
|
-
name:
|
|
139205
|
+
name: refactorName12,
|
|
139089
139206
|
description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
|
|
139090
139207
|
actions: constantActions
|
|
139091
139208
|
});
|
|
139092
139209
|
} else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) {
|
|
139093
139210
|
infos.push({
|
|
139094
|
-
name:
|
|
139211
|
+
name: refactorName12,
|
|
139095
139212
|
description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
|
|
139096
139213
|
actions: [innermostErrorConstantAction]
|
|
139097
139214
|
});
|
|
@@ -140623,14 +140740,14 @@ registerRefactor(actionName, {
|
|
|
140623
140740
|
var ts_refactor_inferFunctionReturnType_exports = {};
|
|
140624
140741
|
|
|
140625
140742
|
// src/services/refactors/inferFunctionReturnType.ts
|
|
140626
|
-
var
|
|
140627
|
-
var
|
|
140743
|
+
var refactorName13 = "Infer function return type";
|
|
140744
|
+
var refactorDescription7 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
|
|
140628
140745
|
var inferReturnTypeAction = {
|
|
140629
|
-
name:
|
|
140630
|
-
description:
|
|
140746
|
+
name: refactorName13,
|
|
140747
|
+
description: refactorDescription7,
|
|
140631
140748
|
kind: "refactor.rewrite.function.returnType"
|
|
140632
140749
|
};
|
|
140633
|
-
registerRefactor(
|
|
140750
|
+
registerRefactor(refactorName13, {
|
|
140634
140751
|
kinds: [inferReturnTypeAction.kind],
|
|
140635
140752
|
getEditsForAction: getRefactorEditsToInferReturnType,
|
|
140636
140753
|
getAvailableActions: getRefactorActionsToInferReturnType
|
|
@@ -140649,15 +140766,15 @@ function getRefactorActionsToInferReturnType(context) {
|
|
|
140649
140766
|
return emptyArray;
|
|
140650
140767
|
if (!isRefactorErrorInfo(info)) {
|
|
140651
140768
|
return [{
|
|
140652
|
-
name:
|
|
140653
|
-
description:
|
|
140769
|
+
name: refactorName13,
|
|
140770
|
+
description: refactorDescription7,
|
|
140654
140771
|
actions: [inferReturnTypeAction]
|
|
140655
140772
|
}];
|
|
140656
140773
|
}
|
|
140657
140774
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
140658
140775
|
return [{
|
|
140659
|
-
name:
|
|
140660
|
-
description:
|
|
140776
|
+
name: refactorName13,
|
|
140777
|
+
description: refactorDescription7,
|
|
140661
140778
|
actions: [{ ...inferReturnTypeAction, notApplicableReason: info.error }]
|
|
140662
140779
|
}];
|
|
140663
140780
|
}
|
|
@@ -142901,10 +143018,10 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
142901
143018
|
const newFileName = createNewFileName(sourceFile, program, getRefactorContext(sourceFile, positionOrRange, preferences, emptyOptions), host);
|
|
142902
143019
|
return { newFileName, files };
|
|
142903
143020
|
}
|
|
142904
|
-
function getEditsForRefactor2(fileName, formatOptions, positionOrRange,
|
|
143021
|
+
function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName14, actionName2, preferences = emptyOptions, interactiveRefactorArguments) {
|
|
142905
143022
|
synchronizeHostData();
|
|
142906
143023
|
const file = getValidSourceFile(fileName);
|
|
142907
|
-
return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions),
|
|
143024
|
+
return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName14, actionName2, interactiveRefactorArguments);
|
|
142908
143025
|
}
|
|
142909
143026
|
function toLineColumnOffset(fileName, position) {
|
|
142910
143027
|
if (position === 0) {
|
|
@@ -147608,41 +147725,19 @@ var fixId13 = "convertToTypeOnlyImport";
|
|
|
147608
147725
|
registerCodeFix({
|
|
147609
147726
|
errorCodes: errorCodes14,
|
|
147610
147727
|
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
147611
|
-
var _a;
|
|
147612
147728
|
const declaration = getDeclaration2(context.sourceFile, context.span.start);
|
|
147613
147729
|
if (declaration) {
|
|
147614
147730
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration));
|
|
147615
|
-
|
|
147616
|
-
const mainAction = createCodeFixAction(
|
|
147617
|
-
fixId13,
|
|
147618
|
-
changes,
|
|
147619
|
-
declaration.kind === 275 /* ImportSpecifier */ ? [Diagnostics.Use_type_0, ((_a = declaration.propertyName) == null ? void 0 : _a.text) ?? declaration.name.text] : Diagnostics.Use_import_type,
|
|
147620
|
-
fixId13,
|
|
147621
|
-
Diagnostics.Fix_all_with_type_only_imports
|
|
147622
|
-
);
|
|
147623
|
-
if (some(importDeclarationChanges)) {
|
|
147624
|
-
return [
|
|
147625
|
-
createCodeFixActionWithoutFixAll(fixId13, importDeclarationChanges, Diagnostics.Use_import_type),
|
|
147626
|
-
mainAction
|
|
147627
|
-
];
|
|
147628
|
-
}
|
|
147629
|
-
return [mainAction];
|
|
147731
|
+
return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)];
|
|
147630
147732
|
}
|
|
147631
147733
|
return void 0;
|
|
147632
147734
|
},
|
|
147633
147735
|
fixIds: [fixId13],
|
|
147634
147736
|
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
147635
|
-
const fixedImportDeclarations = /* @__PURE__ */ new Set();
|
|
147636
147737
|
return codeFixAll(context, errorCodes14, (changes, diag2) => {
|
|
147637
|
-
const
|
|
147638
|
-
if (
|
|
147639
|
-
doChange11(changes, diag2.file,
|
|
147640
|
-
fixedImportDeclarations.add(errorDeclaration);
|
|
147641
|
-
} else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 275 /* ImportSpecifier */ && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context.program)) {
|
|
147642
|
-
doChange11(changes, diag2.file, errorDeclaration.parent.parent.parent);
|
|
147643
|
-
fixedImportDeclarations.add(errorDeclaration.parent.parent.parent);
|
|
147644
|
-
} else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 275 /* ImportSpecifier */) {
|
|
147645
|
-
doChange11(changes, diag2.file, errorDeclaration);
|
|
147738
|
+
const declaration = getDeclaration2(diag2.file, diag2.start);
|
|
147739
|
+
if (declaration) {
|
|
147740
|
+
doChange11(changes, diag2.file, declaration);
|
|
147646
147741
|
}
|
|
147647
147742
|
});
|
|
147648
147743
|
}
|
|
@@ -147651,27 +147746,7 @@ function getDeclaration2(sourceFile, pos) {
|
|
|
147651
147746
|
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
147652
147747
|
return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
|
|
147653
147748
|
}
|
|
147654
|
-
function canConvertImportDeclarationForSpecifier(specifier, sourceFile, program) {
|
|
147655
|
-
if (specifier.parent.parent.name) {
|
|
147656
|
-
return false;
|
|
147657
|
-
}
|
|
147658
|
-
const nonTypeOnlySpecifiers = specifier.parent.elements.filter((e) => !e.isTypeOnly);
|
|
147659
|
-
if (nonTypeOnlySpecifiers.length === 1) {
|
|
147660
|
-
return true;
|
|
147661
|
-
}
|
|
147662
|
-
const checker = program.getTypeChecker();
|
|
147663
|
-
for (const specifier2 of nonTypeOnlySpecifiers) {
|
|
147664
|
-
const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (usage) => {
|
|
147665
|
-
return !isValidTypeOnlyAliasUseSite(usage);
|
|
147666
|
-
});
|
|
147667
|
-
if (isUsedAsValue) {
|
|
147668
|
-
return false;
|
|
147669
|
-
}
|
|
147670
|
-
}
|
|
147671
|
-
return true;
|
|
147672
|
-
}
|
|
147673
147749
|
function doChange11(changes, sourceFile, declaration) {
|
|
147674
|
-
var _a;
|
|
147675
147750
|
if (isImportSpecifier(declaration)) {
|
|
147676
147751
|
changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
|
|
147677
147752
|
declaration,
|
|
@@ -147742,16 +147817,6 @@ function doChange11(changes, sourceFile, declaration) {
|
|
|
147742
147817
|
)
|
|
147743
147818
|
]);
|
|
147744
147819
|
} else {
|
|
147745
|
-
const newNamedBindings = ((_a = importClause.namedBindings) == null ? void 0 : _a.kind) === 274 /* NamedImports */ ? factory.updateNamedImports(
|
|
147746
|
-
importClause.namedBindings,
|
|
147747
|
-
sameMap(importClause.namedBindings.elements, (e) => factory.updateImportSpecifier(
|
|
147748
|
-
e,
|
|
147749
|
-
/*isTypeOnly*/
|
|
147750
|
-
false,
|
|
147751
|
-
e.propertyName,
|
|
147752
|
-
e.name
|
|
147753
|
-
))
|
|
147754
|
-
) : importClause.namedBindings;
|
|
147755
147820
|
const importDeclaration = factory.updateImportDeclaration(
|
|
147756
147821
|
declaration,
|
|
147757
147822
|
declaration.modifiers,
|
|
@@ -147760,7 +147825,7 @@ function doChange11(changes, sourceFile, declaration) {
|
|
|
147760
147825
|
/*isTypeOnly*/
|
|
147761
147826
|
true,
|
|
147762
147827
|
importClause.name,
|
|
147763
|
-
|
|
147828
|
+
importClause.namedBindings
|
|
147764
147829
|
),
|
|
147765
147830
|
declaration.moduleSpecifier,
|
|
147766
147831
|
declaration.assertClause
|
|
@@ -151449,7 +151514,7 @@ registerCodeFix({
|
|
|
151449
151514
|
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
|
|
151450
151515
|
}
|
|
151451
151516
|
if (typeOnlyChanges.length) {
|
|
151452
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.
|
|
151517
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Convert_to_type_only_import));
|
|
151453
151518
|
}
|
|
151454
151519
|
return actions2;
|
|
151455
151520
|
},
|
|
@@ -159382,7 +159447,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
159382
159447
|
}
|
|
159383
159448
|
const keys = getOwnKeys(exports);
|
|
159384
159449
|
const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : "");
|
|
159385
|
-
const conditions =
|
|
159450
|
+
const conditions = mode === 99 /* ESNext */ ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
159386
159451
|
addCompletionEntriesFromPathsOrExports(
|
|
159387
159452
|
result,
|
|
159388
159453
|
fragmentSubpath,
|
|
@@ -159631,6 +159696,7 @@ __export(ts_FindAllReferences_exports, {
|
|
|
159631
159696
|
getTextSpanOfEntry: () => getTextSpanOfEntry,
|
|
159632
159697
|
isContextWithStartAndEndNode: () => isContextWithStartAndEndNode,
|
|
159633
159698
|
isDeclarationOfSymbol: () => isDeclarationOfSymbol,
|
|
159699
|
+
isWriteAccessForReference: () => isWriteAccessForReference,
|
|
159634
159700
|
nodeEntry: () => nodeEntry,
|
|
159635
159701
|
toContextSpan: () => toContextSpan,
|
|
159636
159702
|
toHighlightSpan: () => toHighlightSpan,
|
|
@@ -162743,29 +162809,13 @@ function provideInlayHints(context) {
|
|
|
162743
162809
|
if (!signature || !candidates.length) {
|
|
162744
162810
|
return;
|
|
162745
162811
|
}
|
|
162746
|
-
let
|
|
162747
|
-
|
|
162812
|
+
for (let i = 0; i < args.length; ++i) {
|
|
162813
|
+
const originalArg = args[i];
|
|
162748
162814
|
const arg = skipParentheses(originalArg);
|
|
162749
162815
|
if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
|
|
162750
162816
|
continue;
|
|
162751
162817
|
}
|
|
162752
|
-
|
|
162753
|
-
if (isSpreadElement(arg)) {
|
|
162754
|
-
const spreadType = checker.getTypeAtLocation(arg.expression);
|
|
162755
|
-
if (checker.isTupleType(spreadType)) {
|
|
162756
|
-
const { elementFlags, fixedLength } = spreadType.target;
|
|
162757
|
-
if (fixedLength === 0) {
|
|
162758
|
-
continue;
|
|
162759
|
-
}
|
|
162760
|
-
const firstOptionalIndex = findIndex(elementFlags, (f) => !(f & 1 /* Required */));
|
|
162761
|
-
const requiredArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
|
|
162762
|
-
if (requiredArgs > 0) {
|
|
162763
|
-
spreadArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
|
|
162764
|
-
}
|
|
162765
|
-
}
|
|
162766
|
-
}
|
|
162767
|
-
const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, signatureParamPos);
|
|
162768
|
-
signatureParamPos = signatureParamPos + (spreadArgs || 1);
|
|
162818
|
+
const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, i);
|
|
162769
162819
|
if (identifierNameInfo) {
|
|
162770
162820
|
const [parameterName, isFirstVariadicArgument] = identifierNameInfo;
|
|
162771
162821
|
const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
|
|
@@ -172291,9 +172341,9 @@ function buildOverload(name) {
|
|
|
172291
172341
|
|
|
172292
172342
|
// src/deprecatedCompat/5.0/identifierProperties.ts
|
|
172293
172343
|
addObjectAllocatorPatcher((objectAllocator2) => {
|
|
172294
|
-
const
|
|
172295
|
-
if (!hasProperty(
|
|
172296
|
-
Object.defineProperty(
|
|
172344
|
+
const Identifier75 = objectAllocator2.getIdentifierConstructor();
|
|
172345
|
+
if (!hasProperty(Identifier75.prototype, "originalKeywordKind")) {
|
|
172346
|
+
Object.defineProperty(Identifier75.prototype, "originalKeywordKind", {
|
|
172297
172347
|
get: deprecate(function() {
|
|
172298
172348
|
return identifierToKeywordKind(this);
|
|
172299
172349
|
}, {
|
|
@@ -172305,8 +172355,8 @@ addObjectAllocatorPatcher((objectAllocator2) => {
|
|
|
172305
172355
|
})
|
|
172306
172356
|
});
|
|
172307
172357
|
}
|
|
172308
|
-
if (!hasProperty(
|
|
172309
|
-
Object.defineProperty(
|
|
172358
|
+
if (!hasProperty(Identifier75.prototype, "isInJSDocNamespace")) {
|
|
172359
|
+
Object.defineProperty(Identifier75.prototype, "isInJSDocNamespace", {
|
|
172310
172360
|
get: deprecate(function() {
|
|
172311
172361
|
return this.flags & 2048 /* IdentifierIsInJSDocNamespace */ ? true : void 0;
|
|
172312
172362
|
}, {
|