typescript 5.2.0-dev.20230612 → 5.2.0-dev.20230614
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/tsc.js +103 -77
- package/lib/tsserver.js +319 -151
- package/lib/tsserverlibrary.js +337 -160
- package/lib/typescript.js +337 -160
- package/lib/typingsInstaller.js +11 -7
- package/package.json +3 -3
package/lib/tsserver.js
CHANGED
|
@@ -2305,7 +2305,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2305
2305
|
|
|
2306
2306
|
// src/compiler/corePublic.ts
|
|
2307
2307
|
var versionMajorMinor = "5.2";
|
|
2308
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2308
|
+
var version = `${versionMajorMinor}.0-dev.20230614`;
|
|
2309
2309
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2310
2310
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2311
2311
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -11227,6 +11227,9 @@ var Diagnostics = {
|
|
|
11227
11227
|
Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
|
|
11228
11228
|
Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
|
|
11229
11229
|
Cannot_move_statements_to_the_selected_file: diag(95183, 3 /* Message */, "Cannot_move_statements_to_the_selected_file_95183", "Cannot move statements to the selected file"),
|
|
11230
|
+
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
11231
|
+
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
11232
|
+
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
11230
11233
|
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."),
|
|
11231
11234
|
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'."),
|
|
11232
11235
|
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?"),
|
|
@@ -47322,11 +47325,10 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
47322
47325
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
47323
47326
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
47324
47327
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
47325
|
-
CheckMode3[CheckMode3["
|
|
47326
|
-
CheckMode3[CheckMode3["
|
|
47327
|
-
CheckMode3[CheckMode3["
|
|
47328
|
-
CheckMode3[CheckMode3["
|
|
47329
|
-
CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
|
|
47328
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
|
|
47329
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
|
|
47330
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
|
|
47331
|
+
CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
|
|
47330
47332
|
return CheckMode3;
|
|
47331
47333
|
})(CheckMode || {});
|
|
47332
47334
|
var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -47601,14 +47603,25 @@ function createTypeChecker(host) {
|
|
|
47601
47603
|
getTypeOfPropertyOfContextualType,
|
|
47602
47604
|
getFullyQualifiedName,
|
|
47603
47605
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
47604
|
-
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray
|
|
47605
|
-
|
|
47606
|
-
|
|
47607
|
-
|
|
47608
|
-
|
|
47609
|
-
|
|
47610
|
-
|
|
47611
|
-
|
|
47606
|
+
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) => {
|
|
47607
|
+
if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) {
|
|
47608
|
+
return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
47609
|
+
call,
|
|
47610
|
+
candidatesOutArray,
|
|
47611
|
+
/*argumentCount*/
|
|
47612
|
+
void 0,
|
|
47613
|
+
checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
|
|
47614
|
+
));
|
|
47615
|
+
}
|
|
47616
|
+
return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
|
|
47617
|
+
call,
|
|
47618
|
+
candidatesOutArray,
|
|
47619
|
+
/*argumentCount*/
|
|
47620
|
+
void 0,
|
|
47621
|
+
checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
|
|
47622
|
+
));
|
|
47623
|
+
},
|
|
47624
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
47612
47625
|
getExpandedParameters,
|
|
47613
47626
|
hasEffectiveRestParameter,
|
|
47614
47627
|
containsArgumentsReference,
|
|
@@ -55434,9 +55447,15 @@ function createTypeChecker(host) {
|
|
|
55434
55447
|
const prop = getPropertyOfType(type, name);
|
|
55435
55448
|
return prop ? getTypeOfSymbol(prop) : void 0;
|
|
55436
55449
|
}
|
|
55437
|
-
function getTypeOfPropertyOrIndexSignature(type, name) {
|
|
55450
|
+
function getTypeOfPropertyOrIndexSignature(type, name, addOptionalityToIndex) {
|
|
55438
55451
|
var _a;
|
|
55439
|
-
|
|
55452
|
+
let propType;
|
|
55453
|
+
return getTypeOfPropertyOfType(type, name) || (propType = (_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) && addOptionality(
|
|
55454
|
+
propType,
|
|
55455
|
+
/*isProperty*/
|
|
55456
|
+
true,
|
|
55457
|
+
addOptionalityToIndex
|
|
55458
|
+
) || unknownType;
|
|
55440
55459
|
}
|
|
55441
55460
|
function isTypeAny(type) {
|
|
55442
55461
|
return type && (type.flags & 1 /* Any */) !== 0;
|
|
@@ -55563,7 +55582,7 @@ function createTypeChecker(host) {
|
|
|
55563
55582
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
55564
55583
|
}
|
|
55565
55584
|
function getTypeForBindingElement(declaration) {
|
|
55566
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
55585
|
+
const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
|
|
55567
55586
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
55568
55587
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
55569
55588
|
}
|
|
@@ -57320,19 +57339,13 @@ function createTypeChecker(host) {
|
|
|
57320
57339
|
if (getObjectFlags(type) & 4 /* Reference */) {
|
|
57321
57340
|
const target = type.target;
|
|
57322
57341
|
const typeArguments = getTypeArguments(type);
|
|
57323
|
-
|
|
57324
|
-
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
|
|
57325
|
-
return needApparentType ? getApparentType(ref) : ref;
|
|
57326
|
-
}
|
|
57342
|
+
return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
|
|
57327
57343
|
} else if (type.flags & 2097152 /* Intersection */) {
|
|
57328
57344
|
const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
|
|
57329
57345
|
return types !== type.types ? getIntersectionType(types) : type;
|
|
57330
57346
|
}
|
|
57331
57347
|
return needApparentType ? getApparentType(type) : type;
|
|
57332
57348
|
}
|
|
57333
|
-
function getThisArgument(type) {
|
|
57334
|
-
return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
|
|
57335
|
-
}
|
|
57336
57349
|
function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
|
|
57337
57350
|
let mapper;
|
|
57338
57351
|
let members;
|
|
@@ -58398,7 +58411,7 @@ function createTypeChecker(host) {
|
|
|
58398
58411
|
return type.resolvedBaseConstraint;
|
|
58399
58412
|
}
|
|
58400
58413
|
const stack = [];
|
|
58401
|
-
return type.resolvedBaseConstraint =
|
|
58414
|
+
return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
|
|
58402
58415
|
function getImmediateBaseConstraint(t) {
|
|
58403
58416
|
if (!t.immediateBaseConstraint) {
|
|
58404
58417
|
if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
|
|
@@ -58490,18 +58503,18 @@ function createTypeChecker(host) {
|
|
|
58490
58503
|
}
|
|
58491
58504
|
if (isGenericTupleType(t)) {
|
|
58492
58505
|
const newElements = map(getElementTypes(t), (v, i) => {
|
|
58493
|
-
const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
58494
|
-
return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
58506
|
+
const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
58507
|
+
return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
58495
58508
|
});
|
|
58496
58509
|
return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
|
|
58497
58510
|
}
|
|
58498
58511
|
return t;
|
|
58499
58512
|
}
|
|
58500
58513
|
}
|
|
58501
|
-
function getApparentTypeOfIntersectionType(type) {
|
|
58514
|
+
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
58502
58515
|
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
58503
58516
|
type,
|
|
58504
|
-
|
|
58517
|
+
thisArgument,
|
|
58505
58518
|
/*needApparentType*/
|
|
58506
58519
|
true
|
|
58507
58520
|
));
|
|
@@ -58552,8 +58565,9 @@ function createTypeChecker(host) {
|
|
|
58552
58565
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
58553
58566
|
}
|
|
58554
58567
|
function getApparentType(type) {
|
|
58555
|
-
const t =
|
|
58556
|
-
|
|
58568
|
+
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
58569
|
+
const objectFlags = getObjectFlags(t);
|
|
58570
|
+
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;
|
|
58557
58571
|
}
|
|
58558
58572
|
function getReducedApparentType(type) {
|
|
58559
58573
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
@@ -65382,7 +65396,7 @@ function createTypeChecker(host) {
|
|
|
65382
65396
|
return 3 /* Maybe */;
|
|
65383
65397
|
}
|
|
65384
65398
|
const c = target2;
|
|
65385
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
65399
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
|
|
65386
65400
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
65387
65401
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
65388
65402
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -66443,7 +66457,12 @@ function createTypeChecker(host) {
|
|
|
66443
66457
|
let matched = false;
|
|
66444
66458
|
for (let i = 0; i < types.length; i++) {
|
|
66445
66459
|
if (include[i]) {
|
|
66446
|
-
const targetType =
|
|
66460
|
+
const targetType = getTypeOfPropertyOrIndexSignature(
|
|
66461
|
+
types[i],
|
|
66462
|
+
propertyName,
|
|
66463
|
+
/*addOptionalityToIndex*/
|
|
66464
|
+
true
|
|
66465
|
+
);
|
|
66447
66466
|
if (targetType && related(getDiscriminatingType(), targetType)) {
|
|
66448
66467
|
matched = true;
|
|
66449
66468
|
} else {
|
|
@@ -68374,7 +68393,7 @@ function createTypeChecker(host) {
|
|
|
68374
68393
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
68375
68394
|
if (constraint) {
|
|
68376
68395
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
68377
|
-
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
68396
|
+
if (!inferredType || inferredType === wildcardType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
68378
68397
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
68379
68398
|
}
|
|
68380
68399
|
}
|
|
@@ -69841,7 +69860,12 @@ function createTypeChecker(host) {
|
|
|
69841
69860
|
propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
|
|
69842
69861
|
const narrowedPropType = narrowType2(propType);
|
|
69843
69862
|
return filterType(type, (t) => {
|
|
69844
|
-
const discriminantType = getTypeOfPropertyOrIndexSignature(
|
|
69863
|
+
const discriminantType = getTypeOfPropertyOrIndexSignature(
|
|
69864
|
+
t,
|
|
69865
|
+
propName,
|
|
69866
|
+
/*addOptionalityToIndex*/
|
|
69867
|
+
false
|
|
69868
|
+
);
|
|
69845
69869
|
return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType);
|
|
69846
69870
|
});
|
|
69847
69871
|
}
|
|
@@ -70468,7 +70492,7 @@ function createTypeChecker(host) {
|
|
|
70468
70492
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
70469
70493
|
}
|
|
70470
70494
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
70471
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
70495
|
+
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(
|
|
70472
70496
|
node,
|
|
70473
70497
|
/*contextFlags*/
|
|
70474
70498
|
void 0
|
|
@@ -71115,6 +71139,25 @@ function createTypeChecker(host) {
|
|
|
71115
71139
|
return t.flags & 2097152 /* Intersection */ ? forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t);
|
|
71116
71140
|
});
|
|
71117
71141
|
}
|
|
71142
|
+
function getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType) {
|
|
71143
|
+
let literal = containingLiteral;
|
|
71144
|
+
let type = contextualType;
|
|
71145
|
+
while (type) {
|
|
71146
|
+
const thisType = getThisTypeFromContextualType(type);
|
|
71147
|
+
if (thisType) {
|
|
71148
|
+
return thisType;
|
|
71149
|
+
}
|
|
71150
|
+
if (literal.parent.kind !== 302 /* PropertyAssignment */) {
|
|
71151
|
+
break;
|
|
71152
|
+
}
|
|
71153
|
+
literal = literal.parent.parent;
|
|
71154
|
+
type = getApparentTypeOfContextualType(
|
|
71155
|
+
literal,
|
|
71156
|
+
/*contextFlags*/
|
|
71157
|
+
void 0
|
|
71158
|
+
);
|
|
71159
|
+
}
|
|
71160
|
+
}
|
|
71118
71161
|
function getContextualThisParameterType(func) {
|
|
71119
71162
|
if (func.kind === 218 /* ArrowFunction */) {
|
|
71120
71163
|
return void 0;
|
|
@@ -71137,22 +71180,9 @@ function createTypeChecker(host) {
|
|
|
71137
71180
|
/*contextFlags*/
|
|
71138
71181
|
void 0
|
|
71139
71182
|
);
|
|
71140
|
-
|
|
71141
|
-
|
|
71142
|
-
|
|
71143
|
-
const thisType = getThisTypeFromContextualType(type);
|
|
71144
|
-
if (thisType) {
|
|
71145
|
-
return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
|
|
71146
|
-
}
|
|
71147
|
-
if (literal.parent.kind !== 302 /* PropertyAssignment */) {
|
|
71148
|
-
break;
|
|
71149
|
-
}
|
|
71150
|
-
literal = literal.parent.parent;
|
|
71151
|
-
type = getApparentTypeOfContextualType(
|
|
71152
|
-
literal,
|
|
71153
|
-
/*contextFlags*/
|
|
71154
|
-
void 0
|
|
71155
|
-
);
|
|
71183
|
+
const thisType = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType);
|
|
71184
|
+
if (thisType) {
|
|
71185
|
+
return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
|
|
71156
71186
|
}
|
|
71157
71187
|
return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral));
|
|
71158
71188
|
}
|
|
@@ -71225,7 +71255,7 @@ function createTypeChecker(host) {
|
|
|
71225
71255
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
71226
71256
|
const parent2 = declaration.parent.parent;
|
|
71227
71257
|
const name = declaration.propertyName || declaration.name;
|
|
71228
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ?
|
|
71258
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
|
|
71229
71259
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
71230
71260
|
return void 0;
|
|
71231
71261
|
if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -72274,9 +72304,7 @@ function createTypeChecker(host) {
|
|
|
72274
72304
|
elementTypes.push(undefinedOrMissingType);
|
|
72275
72305
|
elementFlags.push(2 /* Optional */);
|
|
72276
72306
|
} else {
|
|
72277
|
-
const
|
|
72278
|
-
const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
72279
|
-
const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
|
|
72307
|
+
const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
|
|
72280
72308
|
elementTypes.push(addOptionality(
|
|
72281
72309
|
type,
|
|
72282
72310
|
/*isProperty*/
|
|
@@ -72284,7 +72312,7 @@ function createTypeChecker(host) {
|
|
|
72284
72312
|
hasOmittedExpression
|
|
72285
72313
|
));
|
|
72286
72314
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
72287
|
-
if (
|
|
72315
|
+
if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
|
|
72288
72316
|
const inferenceContext = getInferenceContext(node);
|
|
72289
72317
|
Debug.assert(inferenceContext);
|
|
72290
72318
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -72425,13 +72453,11 @@ function createTypeChecker(host) {
|
|
|
72425
72453
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
72426
72454
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
72427
72455
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
72428
|
-
|
|
72429
|
-
const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
72430
|
-
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
|
|
72456
|
+
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : (
|
|
72431
72457
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
72432
72458
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
72433
72459
|
// we don't want to say "could not find 'a'".
|
|
72434
|
-
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name,
|
|
72460
|
+
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode)
|
|
72435
72461
|
);
|
|
72436
72462
|
if (isInJavascript) {
|
|
72437
72463
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -72475,7 +72501,7 @@ function createTypeChecker(host) {
|
|
|
72475
72501
|
prop.links.target = member;
|
|
72476
72502
|
member = prop;
|
|
72477
72503
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
72478
|
-
if (
|
|
72504
|
+
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
|
|
72479
72505
|
const inferenceContext = getInferenceContext(node);
|
|
72480
72506
|
Debug.assert(inferenceContext);
|
|
72481
72507
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -72648,9 +72674,7 @@ function createTypeChecker(host) {
|
|
|
72648
72674
|
for (const attributeDecl of attributes.properties) {
|
|
72649
72675
|
const member = attributeDecl.symbol;
|
|
72650
72676
|
if (isJsxAttribute(attributeDecl)) {
|
|
72651
|
-
const
|
|
72652
|
-
const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
72653
|
-
const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
|
|
72677
|
+
const exprType = checkJsxAttribute(attributeDecl, checkMode);
|
|
72654
72678
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
72655
72679
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
72656
72680
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -72671,7 +72695,7 @@ function createTypeChecker(host) {
|
|
|
72671
72695
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
72672
72696
|
}
|
|
72673
72697
|
}
|
|
72674
|
-
if (
|
|
72698
|
+
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
|
|
72675
72699
|
const inferenceContext = getInferenceContext(attributes);
|
|
72676
72700
|
Debug.assert(inferenceContext);
|
|
72677
72701
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -74289,7 +74313,7 @@ function createTypeChecker(host) {
|
|
|
74289
74313
|
}
|
|
74290
74314
|
for (let i = 0; i < argCount; i++) {
|
|
74291
74315
|
const arg = args[i];
|
|
74292
|
-
if (arg.kind !== 231 /* OmittedExpression */
|
|
74316
|
+
if (arg.kind !== 231 /* OmittedExpression */) {
|
|
74293
74317
|
const paramType = getTypeAtPosition(signature, i);
|
|
74294
74318
|
if (couldContainTypeVariables(paramType)) {
|
|
74295
74319
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -74902,12 +74926,11 @@ function createTypeChecker(host) {
|
|
|
74902
74926
|
const args = getEffectiveCallArguments(node);
|
|
74903
74927
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
74904
74928
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
74905
|
-
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
74906
74929
|
let candidatesForArgumentError;
|
|
74907
74930
|
let candidateForArgumentArityError;
|
|
74908
74931
|
let candidateForTypeArgumentError;
|
|
74909
74932
|
let result;
|
|
74910
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
74933
|
+
const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
74911
74934
|
if (candidates.length > 1) {
|
|
74912
74935
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
74913
74936
|
}
|
|
@@ -75126,7 +75149,7 @@ function createTypeChecker(host) {
|
|
|
75126
75149
|
continue;
|
|
75127
75150
|
}
|
|
75128
75151
|
if (argCheckMode) {
|
|
75129
|
-
argCheckMode =
|
|
75152
|
+
argCheckMode = 0 /* Normal */;
|
|
75130
75153
|
if (inferenceContext) {
|
|
75131
75154
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
75132
75155
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -78204,8 +78227,9 @@ function createTypeChecker(host) {
|
|
|
78204
78227
|
case 36 /* ExclamationEqualsToken */:
|
|
78205
78228
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
78206
78229
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
78207
|
-
if (!(checkMode && checkMode &
|
|
78208
|
-
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right))
|
|
78230
|
+
if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
|
|
78231
|
+
if ((isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) && // only report for === and !== in JS, not == or !=
|
|
78232
|
+
(!isInJSFile(left) || (operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */))) {
|
|
78209
78233
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
78210
78234
|
error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
78211
78235
|
}
|
|
@@ -78863,7 +78887,7 @@ function createTypeChecker(host) {
|
|
|
78863
78887
|
}
|
|
78864
78888
|
}
|
|
78865
78889
|
const startInvocationCount = flowInvocationCount;
|
|
78866
|
-
const type = checkExpression(node,
|
|
78890
|
+
const type = checkExpression(node, 128 /* TypeOnly */);
|
|
78867
78891
|
if (flowInvocationCount !== startInvocationCount) {
|
|
78868
78892
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
78869
78893
|
cache[getNodeId(node)] = type;
|
|
@@ -78978,7 +79002,7 @@ function createTypeChecker(host) {
|
|
|
78978
79002
|
return nullWideningType;
|
|
78979
79003
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
78980
79004
|
case 11 /* StringLiteral */:
|
|
78981
|
-
return hasSkipDirectInferenceFlag(node) ?
|
|
79005
|
+
return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
|
|
78982
79006
|
case 9 /* NumericLiteral */:
|
|
78983
79007
|
checkGrammarNumericLiteral(node);
|
|
78984
79008
|
return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
|
|
@@ -81334,7 +81358,7 @@ function createTypeChecker(host) {
|
|
|
81334
81358
|
checkComputedPropertyName(node.propertyName);
|
|
81335
81359
|
}
|
|
81336
81360
|
const parent2 = node.parent.parent;
|
|
81337
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
81361
|
+
const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
|
|
81338
81362
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
81339
81363
|
const name = node.propertyName || node.name;
|
|
81340
81364
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -84924,7 +84948,7 @@ function createTypeChecker(host) {
|
|
|
84924
84948
|
/*contextFlags*/
|
|
84925
84949
|
void 0
|
|
84926
84950
|
);
|
|
84927
|
-
const type =
|
|
84951
|
+
const type = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType);
|
|
84928
84952
|
return type && !isTypeAny(type);
|
|
84929
84953
|
}
|
|
84930
84954
|
}
|
|
@@ -118643,7 +118667,9 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
118643
118667
|
Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
118644
118668
|
Diagnostics.Class_constructor_may_not_be_a_generator.code,
|
|
118645
118669
|
Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
118646
|
-
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code
|
|
118670
|
+
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
118671
|
+
// Type errors
|
|
118672
|
+
Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
|
|
118647
118673
|
]);
|
|
118648
118674
|
function shouldProgramCreateNewSourceFiles(program, newOptions) {
|
|
118649
118675
|
if (!program)
|
|
@@ -135666,8 +135692,8 @@ function getApplicableRefactors(context, includeInteractiveActions) {
|
|
|
135666
135692
|
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);
|
|
135667
135693
|
}));
|
|
135668
135694
|
}
|
|
135669
|
-
function getEditsForRefactor(context,
|
|
135670
|
-
const refactor = refactors.get(
|
|
135695
|
+
function getEditsForRefactor(context, refactorName14, actionName2, interactiveRefactorArguments) {
|
|
135696
|
+
const refactor = refactors.get(refactorName14);
|
|
135671
135697
|
return refactor && refactor.getEditsForAction(context, actionName2, interactiveRefactorArguments);
|
|
135672
135698
|
}
|
|
135673
135699
|
|
|
@@ -136435,24 +136461,165 @@ function refactorKindBeginsWith(known, requested) {
|
|
|
136435
136461
|
return known.substr(0, requested.length) === requested;
|
|
136436
136462
|
}
|
|
136437
136463
|
|
|
136464
|
+
// src/services/refactors/inlineVariable.ts
|
|
136465
|
+
var refactorName4 = "Inline variable";
|
|
136466
|
+
var refactorDescription = getLocaleSpecificMessage(Diagnostics.Inline_variable);
|
|
136467
|
+
var inlineVariableAction = {
|
|
136468
|
+
name: refactorName4,
|
|
136469
|
+
description: refactorDescription,
|
|
136470
|
+
kind: "refactor.inline.variable"
|
|
136471
|
+
};
|
|
136472
|
+
registerRefactor(refactorName4, {
|
|
136473
|
+
kinds: [inlineVariableAction.kind],
|
|
136474
|
+
getAvailableActions(context) {
|
|
136475
|
+
const {
|
|
136476
|
+
file,
|
|
136477
|
+
program,
|
|
136478
|
+
preferences,
|
|
136479
|
+
startPosition,
|
|
136480
|
+
triggerReason
|
|
136481
|
+
} = context;
|
|
136482
|
+
const info = getInliningInfo(file, startPosition, triggerReason === "invoked", program);
|
|
136483
|
+
if (!info) {
|
|
136484
|
+
return emptyArray;
|
|
136485
|
+
}
|
|
136486
|
+
if (!ts_refactor_exports.isRefactorErrorInfo(info)) {
|
|
136487
|
+
return [{
|
|
136488
|
+
name: refactorName4,
|
|
136489
|
+
description: refactorDescription,
|
|
136490
|
+
actions: [inlineVariableAction]
|
|
136491
|
+
}];
|
|
136492
|
+
}
|
|
136493
|
+
if (preferences.provideRefactorNotApplicableReason) {
|
|
136494
|
+
return [{
|
|
136495
|
+
name: refactorName4,
|
|
136496
|
+
description: refactorDescription,
|
|
136497
|
+
actions: [{
|
|
136498
|
+
...inlineVariableAction,
|
|
136499
|
+
notApplicableReason: info.error
|
|
136500
|
+
}]
|
|
136501
|
+
}];
|
|
136502
|
+
}
|
|
136503
|
+
return emptyArray;
|
|
136504
|
+
},
|
|
136505
|
+
getEditsForAction(context, actionName2) {
|
|
136506
|
+
Debug.assert(actionName2 === refactorName4, "Unexpected refactor invoked");
|
|
136507
|
+
const { file, program, startPosition } = context;
|
|
136508
|
+
const info = getInliningInfo(
|
|
136509
|
+
file,
|
|
136510
|
+
startPosition,
|
|
136511
|
+
/*tryWithReferenceToken*/
|
|
136512
|
+
true,
|
|
136513
|
+
program
|
|
136514
|
+
);
|
|
136515
|
+
if (!info || ts_refactor_exports.isRefactorErrorInfo(info)) {
|
|
136516
|
+
return void 0;
|
|
136517
|
+
}
|
|
136518
|
+
const { references, declaration, replacement } = info;
|
|
136519
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
|
|
136520
|
+
for (const node of references) {
|
|
136521
|
+
tracker.replaceNode(file, node, getReplacementExpression(node, replacement));
|
|
136522
|
+
}
|
|
136523
|
+
tracker.delete(file, declaration);
|
|
136524
|
+
});
|
|
136525
|
+
return { edits };
|
|
136526
|
+
}
|
|
136527
|
+
});
|
|
136528
|
+
function getInliningInfo(file, startPosition, tryWithReferenceToken, program) {
|
|
136529
|
+
var _a, _b;
|
|
136530
|
+
const checker = program.getTypeChecker();
|
|
136531
|
+
const token = getTouchingPropertyName(file, startPosition);
|
|
136532
|
+
const parent2 = token.parent;
|
|
136533
|
+
if (!isIdentifier(token)) {
|
|
136534
|
+
return void 0;
|
|
136535
|
+
}
|
|
136536
|
+
if (isInitializedVariable(parent2) && isVariableDeclarationInVariableStatement(parent2)) {
|
|
136537
|
+
if (((_a = checker.getMergedSymbol(parent2.symbol).declarations) == null ? void 0 : _a.length) !== 1) {
|
|
136538
|
+
return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) };
|
|
136539
|
+
}
|
|
136540
|
+
if (isDeclarationExported(parent2)) {
|
|
136541
|
+
return void 0;
|
|
136542
|
+
}
|
|
136543
|
+
const references = getReferenceNodes(parent2, checker, file);
|
|
136544
|
+
return references && { references, declaration: parent2, replacement: parent2.initializer };
|
|
136545
|
+
}
|
|
136546
|
+
if (tryWithReferenceToken) {
|
|
136547
|
+
let definition = checker.resolveName(
|
|
136548
|
+
token.text,
|
|
136549
|
+
token,
|
|
136550
|
+
111551 /* Value */,
|
|
136551
|
+
/*excludeGlobals*/
|
|
136552
|
+
false
|
|
136553
|
+
);
|
|
136554
|
+
definition = definition && checker.getMergedSymbol(definition);
|
|
136555
|
+
if (((_b = definition == null ? void 0 : definition.declarations) == null ? void 0 : _b.length) !== 1) {
|
|
136556
|
+
return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) };
|
|
136557
|
+
}
|
|
136558
|
+
const declaration = definition.declarations[0];
|
|
136559
|
+
if (!isInitializedVariable(declaration) || !isVariableDeclarationInVariableStatement(declaration) || !isIdentifier(declaration.name)) {
|
|
136560
|
+
return void 0;
|
|
136561
|
+
}
|
|
136562
|
+
if (isDeclarationExported(declaration)) {
|
|
136563
|
+
return void 0;
|
|
136564
|
+
}
|
|
136565
|
+
const references = getReferenceNodes(declaration, checker, file);
|
|
136566
|
+
return references && { references, declaration, replacement: declaration.initializer };
|
|
136567
|
+
}
|
|
136568
|
+
return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_variable_to_inline) };
|
|
136569
|
+
}
|
|
136570
|
+
function isDeclarationExported(declaration) {
|
|
136571
|
+
const variableStatement = cast(declaration.parent.parent, isVariableStatement);
|
|
136572
|
+
return some(variableStatement.modifiers, isExportModifier);
|
|
136573
|
+
}
|
|
136574
|
+
function getReferenceNodes(declaration, checker, file) {
|
|
136575
|
+
const references = [];
|
|
136576
|
+
const cannotInline = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(declaration.name, checker, file, (ref) => {
|
|
136577
|
+
if (ts_FindAllReferences_exports.isWriteAccessForReference(ref)) {
|
|
136578
|
+
return true;
|
|
136579
|
+
}
|
|
136580
|
+
if (isExportSpecifier(ref.parent) || isExportAssignment(ref.parent)) {
|
|
136581
|
+
return true;
|
|
136582
|
+
}
|
|
136583
|
+
if (isTypeQueryNode(ref.parent)) {
|
|
136584
|
+
return true;
|
|
136585
|
+
}
|
|
136586
|
+
if (textRangeContainsPositionInclusive(declaration, ref.pos)) {
|
|
136587
|
+
return true;
|
|
136588
|
+
}
|
|
136589
|
+
references.push(ref);
|
|
136590
|
+
});
|
|
136591
|
+
return references.length === 0 || cannotInline ? void 0 : references;
|
|
136592
|
+
}
|
|
136593
|
+
function getReplacementExpression(reference, replacement) {
|
|
136594
|
+
replacement = getSynthesizedDeepClone(replacement);
|
|
136595
|
+
const { parent: parent2 } = reference;
|
|
136596
|
+
if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
|
|
136597
|
+
return factory.createParenthesizedExpression(replacement);
|
|
136598
|
+
}
|
|
136599
|
+
if (isFunctionLike(replacement) && isCallLikeExpression(parent2)) {
|
|
136600
|
+
return factory.createParenthesizedExpression(replacement);
|
|
136601
|
+
}
|
|
136602
|
+
return replacement;
|
|
136603
|
+
}
|
|
136604
|
+
|
|
136438
136605
|
// src/services/refactors/moveToNewFile.ts
|
|
136439
|
-
var
|
|
136606
|
+
var refactorName5 = "Move to a new file";
|
|
136440
136607
|
var description = getLocaleSpecificMessage(Diagnostics.Move_to_a_new_file);
|
|
136441
136608
|
var moveToNewFileAction = {
|
|
136442
|
-
name:
|
|
136609
|
+
name: refactorName5,
|
|
136443
136610
|
description,
|
|
136444
136611
|
kind: "refactor.move.newFile"
|
|
136445
136612
|
};
|
|
136446
|
-
registerRefactor(
|
|
136613
|
+
registerRefactor(refactorName5, {
|
|
136447
136614
|
kinds: [moveToNewFileAction.kind],
|
|
136448
136615
|
getAvailableActions: function getRefactorActionsToMoveToNewFile(context) {
|
|
136449
136616
|
const statements = getStatementsToMove(context);
|
|
136450
136617
|
if (context.preferences.allowTextChangesInNewFiles && statements) {
|
|
136451
|
-
return [{ name:
|
|
136618
|
+
return [{ name: refactorName5, description, actions: [moveToNewFileAction] }];
|
|
136452
136619
|
}
|
|
136453
136620
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
136454
136621
|
return [{
|
|
136455
|
-
name:
|
|
136622
|
+
name: refactorName5,
|
|
136456
136623
|
description,
|
|
136457
136624
|
actions: [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }]
|
|
136458
136625
|
}];
|
|
@@ -136460,7 +136627,7 @@ registerRefactor(refactorName4, {
|
|
|
136460
136627
|
return emptyArray;
|
|
136461
136628
|
},
|
|
136462
136629
|
getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
|
|
136463
|
-
Debug.assert(actionName2 ===
|
|
136630
|
+
Debug.assert(actionName2 === refactorName5, "Wrong refactor invoked");
|
|
136464
136631
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
136465
136632
|
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange3(context.file, context.program, statements, t, context.host, context.preferences, context));
|
|
136466
136633
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
@@ -137444,14 +137611,14 @@ function getOverloadRangeToMove(sourceFile, statement) {
|
|
|
137444
137611
|
var ts_refactor_addOrRemoveBracesToArrowFunction_exports = {};
|
|
137445
137612
|
|
|
137446
137613
|
// src/services/refactors/convertOverloadListToSingleSignature.ts
|
|
137447
|
-
var
|
|
137448
|
-
var
|
|
137614
|
+
var refactorName6 = "Convert overload list to single signature";
|
|
137615
|
+
var refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
|
|
137449
137616
|
var functionOverloadAction = {
|
|
137450
|
-
name:
|
|
137451
|
-
description:
|
|
137617
|
+
name: refactorName6,
|
|
137618
|
+
description: refactorDescription2,
|
|
137452
137619
|
kind: "refactor.rewrite.function.overloadList"
|
|
137453
137620
|
};
|
|
137454
|
-
registerRefactor(
|
|
137621
|
+
registerRefactor(refactorName6, {
|
|
137455
137622
|
kinds: [functionOverloadAction.kind],
|
|
137456
137623
|
getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature,
|
|
137457
137624
|
getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature
|
|
@@ -137462,8 +137629,8 @@ function getRefactorActionsToConvertOverloadsToOneSignature(context) {
|
|
|
137462
137629
|
if (!info)
|
|
137463
137630
|
return emptyArray;
|
|
137464
137631
|
return [{
|
|
137465
|
-
name:
|
|
137466
|
-
description:
|
|
137632
|
+
name: refactorName6,
|
|
137633
|
+
description: refactorDescription2,
|
|
137467
137634
|
actions: [functionOverloadAction]
|
|
137468
137635
|
}];
|
|
137469
137636
|
}
|
|
@@ -137656,8 +137823,8 @@ function getConvertableOverloadListAtPosition(file, startPosition, program) {
|
|
|
137656
137823
|
}
|
|
137657
137824
|
|
|
137658
137825
|
// src/services/refactors/addOrRemoveBracesToArrowFunction.ts
|
|
137659
|
-
var
|
|
137660
|
-
var
|
|
137826
|
+
var refactorName7 = "Add or remove braces in an arrow function";
|
|
137827
|
+
var refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
|
|
137661
137828
|
var addBracesAction = {
|
|
137662
137829
|
name: "Add braces to arrow function",
|
|
137663
137830
|
description: getLocaleSpecificMessage(Diagnostics.Add_braces_to_arrow_function),
|
|
@@ -137668,7 +137835,7 @@ var removeBracesAction = {
|
|
|
137668
137835
|
description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function),
|
|
137669
137836
|
kind: "refactor.rewrite.arrow.braces.remove"
|
|
137670
137837
|
};
|
|
137671
|
-
registerRefactor(
|
|
137838
|
+
registerRefactor(refactorName7, {
|
|
137672
137839
|
kinds: [removeBracesAction.kind],
|
|
137673
137840
|
getEditsForAction: getRefactorEditsToRemoveFunctionBraces,
|
|
137674
137841
|
getAvailableActions: getRefactorActionsToRemoveFunctionBraces
|
|
@@ -137680,8 +137847,8 @@ function getRefactorActionsToRemoveFunctionBraces(context) {
|
|
|
137680
137847
|
return emptyArray;
|
|
137681
137848
|
if (!isRefactorErrorInfo(info)) {
|
|
137682
137849
|
return [{
|
|
137683
|
-
name:
|
|
137684
|
-
description:
|
|
137850
|
+
name: refactorName7,
|
|
137851
|
+
description: refactorDescription3,
|
|
137685
137852
|
actions: [
|
|
137686
137853
|
info.addBraces ? addBracesAction : removeBracesAction
|
|
137687
137854
|
]
|
|
@@ -137689,8 +137856,8 @@ function getRefactorActionsToRemoveFunctionBraces(context) {
|
|
|
137689
137856
|
}
|
|
137690
137857
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
137691
137858
|
return [{
|
|
137692
|
-
name:
|
|
137693
|
-
description:
|
|
137859
|
+
name: refactorName7,
|
|
137860
|
+
description: refactorDescription3,
|
|
137694
137861
|
actions: [
|
|
137695
137862
|
{ ...addBracesAction, notApplicableReason: info.error },
|
|
137696
137863
|
{ ...removeBracesAction, notApplicableReason: info.error }
|
|
@@ -137786,8 +137953,8 @@ function getConvertibleArrowFunctionAtPosition(file, startPosition, considerFunc
|
|
|
137786
137953
|
var ts_refactor_convertArrowFunctionOrFunctionExpression_exports = {};
|
|
137787
137954
|
|
|
137788
137955
|
// src/services/refactors/convertArrowFunctionOrFunctionExpression.ts
|
|
137789
|
-
var
|
|
137790
|
-
var
|
|
137956
|
+
var refactorName8 = "Convert arrow function or function expression";
|
|
137957
|
+
var refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression);
|
|
137791
137958
|
var toAnonymousFunctionAction = {
|
|
137792
137959
|
name: "Convert to anonymous function",
|
|
137793
137960
|
description: getLocaleSpecificMessage(Diagnostics.Convert_to_anonymous_function),
|
|
@@ -137803,7 +137970,7 @@ var toArrowFunctionAction = {
|
|
|
137803
137970
|
description: getLocaleSpecificMessage(Diagnostics.Convert_to_arrow_function),
|
|
137804
137971
|
kind: "refactor.rewrite.function.arrow"
|
|
137805
137972
|
};
|
|
137806
|
-
registerRefactor(
|
|
137973
|
+
registerRefactor(refactorName8, {
|
|
137807
137974
|
kinds: [
|
|
137808
137975
|
toAnonymousFunctionAction.kind,
|
|
137809
137976
|
toNamedFunctionAction.kind,
|
|
@@ -137845,8 +138012,8 @@ function getRefactorActionsToConvertFunctionExpressions(context) {
|
|
|
137845
138012
|
}
|
|
137846
138013
|
}
|
|
137847
138014
|
return [{
|
|
137848
|
-
name:
|
|
137849
|
-
description:
|
|
138015
|
+
name: refactorName8,
|
|
138016
|
+
description: refactorDescription4,
|
|
137850
138017
|
actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? errors : possibleActions
|
|
137851
138018
|
}];
|
|
137852
138019
|
}
|
|
@@ -138011,15 +138178,15 @@ function isFunctionReferencedInFile(sourceFile, typeChecker, node) {
|
|
|
138011
138178
|
var ts_refactor_convertParamsToDestructuredObject_exports = {};
|
|
138012
138179
|
|
|
138013
138180
|
// src/services/refactors/convertParamsToDestructuredObject.ts
|
|
138014
|
-
var
|
|
138181
|
+
var refactorName9 = "Convert parameters to destructured object";
|
|
138015
138182
|
var minimumParameterLength = 1;
|
|
138016
|
-
var
|
|
138183
|
+
var refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object);
|
|
138017
138184
|
var toDestructuredAction = {
|
|
138018
|
-
name:
|
|
138019
|
-
description:
|
|
138185
|
+
name: refactorName9,
|
|
138186
|
+
description: refactorDescription5,
|
|
138020
138187
|
kind: "refactor.rewrite.parameters.toDestructured"
|
|
138021
138188
|
};
|
|
138022
|
-
registerRefactor(
|
|
138189
|
+
registerRefactor(refactorName9, {
|
|
138023
138190
|
kinds: [toDestructuredAction.kind],
|
|
138024
138191
|
getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject,
|
|
138025
138192
|
getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject
|
|
@@ -138033,13 +138200,13 @@ function getRefactorActionsToConvertParametersToDestructuredObject(context) {
|
|
|
138033
138200
|
if (!functionDeclaration)
|
|
138034
138201
|
return emptyArray;
|
|
138035
138202
|
return [{
|
|
138036
|
-
name:
|
|
138037
|
-
description:
|
|
138203
|
+
name: refactorName9,
|
|
138204
|
+
description: refactorDescription5,
|
|
138038
138205
|
actions: [toDestructuredAction]
|
|
138039
138206
|
}];
|
|
138040
138207
|
}
|
|
138041
138208
|
function getRefactorEditsToConvertParametersToDestructuredObject(context, actionName2) {
|
|
138042
|
-
Debug.assert(actionName2 ===
|
|
138209
|
+
Debug.assert(actionName2 === refactorName9, "Unexpected action name");
|
|
138043
138210
|
const { file, startPosition, program, cancellationToken, host } = context;
|
|
138044
138211
|
const functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, program.getTypeChecker());
|
|
138045
138212
|
if (!functionDeclaration || !cancellationToken)
|
|
@@ -138554,14 +138721,14 @@ function getFunctionNames(functionDeclaration) {
|
|
|
138554
138721
|
var ts_refactor_convertStringOrTemplateLiteral_exports = {};
|
|
138555
138722
|
|
|
138556
138723
|
// src/services/refactors/convertStringOrTemplateLiteral.ts
|
|
138557
|
-
var
|
|
138558
|
-
var
|
|
138724
|
+
var refactorName10 = "Convert to template string";
|
|
138725
|
+
var refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string);
|
|
138559
138726
|
var convertStringAction = {
|
|
138560
|
-
name:
|
|
138561
|
-
description:
|
|
138727
|
+
name: refactorName10,
|
|
138728
|
+
description: refactorDescription6,
|
|
138562
138729
|
kind: "refactor.rewrite.string"
|
|
138563
138730
|
};
|
|
138564
|
-
registerRefactor(
|
|
138731
|
+
registerRefactor(refactorName10, {
|
|
138565
138732
|
kinds: [convertStringAction.kind],
|
|
138566
138733
|
getEditsForAction: getRefactorEditsToConvertToTemplateString,
|
|
138567
138734
|
getAvailableActions: getRefactorActionsToConvertToTemplateString
|
|
@@ -138570,7 +138737,7 @@ function getRefactorActionsToConvertToTemplateString(context) {
|
|
|
138570
138737
|
const { file, startPosition } = context;
|
|
138571
138738
|
const node = getNodeOrParentOfParentheses(file, startPosition);
|
|
138572
138739
|
const maybeBinary = getParentBinaryExpression(node);
|
|
138573
|
-
const refactorInfo = { name:
|
|
138740
|
+
const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
|
|
138574
138741
|
if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
|
|
138575
138742
|
refactorInfo.actions.push(convertStringAction);
|
|
138576
138743
|
return [refactorInfo];
|
|
@@ -138596,7 +138763,7 @@ function getRefactorEditsToConvertToTemplateString(context, actionName2) {
|
|
|
138596
138763
|
const { file, startPosition } = context;
|
|
138597
138764
|
const node = getNodeOrParentOfParentheses(file, startPosition);
|
|
138598
138765
|
switch (actionName2) {
|
|
138599
|
-
case
|
|
138766
|
+
case refactorDescription6:
|
|
138600
138767
|
return { edits: getEditsForToTemplateLiteral(context, node) };
|
|
138601
138768
|
default:
|
|
138602
138769
|
return Debug.fail("invalid action");
|
|
@@ -138778,14 +138945,14 @@ function getExpressionFromParenthesesOrExpression(node) {
|
|
|
138778
138945
|
var ts_refactor_convertToOptionalChainExpression_exports = {};
|
|
138779
138946
|
|
|
138780
138947
|
// src/services/refactors/convertToOptionalChainExpression.ts
|
|
138781
|
-
var
|
|
138948
|
+
var refactorName11 = "Convert to optional chain expression";
|
|
138782
138949
|
var convertToOptionalChainExpressionMessage = getLocaleSpecificMessage(Diagnostics.Convert_to_optional_chain_expression);
|
|
138783
138950
|
var toOptionalChainAction = {
|
|
138784
|
-
name:
|
|
138951
|
+
name: refactorName11,
|
|
138785
138952
|
description: convertToOptionalChainExpressionMessage,
|
|
138786
138953
|
kind: "refactor.rewrite.expression.optionalChain"
|
|
138787
138954
|
};
|
|
138788
|
-
registerRefactor(
|
|
138955
|
+
registerRefactor(refactorName11, {
|
|
138789
138956
|
kinds: [toOptionalChainAction.kind],
|
|
138790
138957
|
getEditsForAction: getRefactorEditsToConvertToOptionalChain,
|
|
138791
138958
|
getAvailableActions: getRefactorActionsToConvertToOptionalChain
|
|
@@ -138796,14 +138963,14 @@ function getRefactorActionsToConvertToOptionalChain(context) {
|
|
|
138796
138963
|
return emptyArray;
|
|
138797
138964
|
if (!isRefactorErrorInfo(info)) {
|
|
138798
138965
|
return [{
|
|
138799
|
-
name:
|
|
138966
|
+
name: refactorName11,
|
|
138800
138967
|
description: convertToOptionalChainExpressionMessage,
|
|
138801
138968
|
actions: [toOptionalChainAction]
|
|
138802
138969
|
}];
|
|
138803
138970
|
}
|
|
138804
138971
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
138805
138972
|
return [{
|
|
138806
|
-
name:
|
|
138973
|
+
name: refactorName11,
|
|
138807
138974
|
description: convertToOptionalChainExpressionMessage,
|
|
138808
138975
|
actions: [{ ...toOptionalChainAction, notApplicableReason: info.error }]
|
|
138809
138976
|
}];
|
|
@@ -138999,7 +139166,7 @@ __export(ts_refactor_extractSymbol_exports, {
|
|
|
138999
139166
|
});
|
|
139000
139167
|
|
|
139001
139168
|
// src/services/refactors/extractSymbol.ts
|
|
139002
|
-
var
|
|
139169
|
+
var refactorName12 = "Extract Symbol";
|
|
139003
139170
|
var extractConstantAction = {
|
|
139004
139171
|
name: "Extract Constant",
|
|
139005
139172
|
description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
|
|
@@ -139010,7 +139177,7 @@ var extractFunctionAction = {
|
|
|
139010
139177
|
description: getLocaleSpecificMessage(Diagnostics.Extract_function),
|
|
139011
139178
|
kind: "refactor.extract.function"
|
|
139012
139179
|
};
|
|
139013
|
-
registerRefactor(
|
|
139180
|
+
registerRefactor(refactorName12, {
|
|
139014
139181
|
kinds: [
|
|
139015
139182
|
extractConstantAction.kind,
|
|
139016
139183
|
extractFunctionAction.kind
|
|
@@ -139029,14 +139196,14 @@ function getRefactorActionsToExtractSymbol(context) {
|
|
|
139029
139196
|
const errors = [];
|
|
139030
139197
|
if (refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) {
|
|
139031
139198
|
errors.push({
|
|
139032
|
-
name:
|
|
139199
|
+
name: refactorName12,
|
|
139033
139200
|
description: extractFunctionAction.description,
|
|
139034
139201
|
actions: [{ ...extractFunctionAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
|
|
139035
139202
|
});
|
|
139036
139203
|
}
|
|
139037
139204
|
if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) {
|
|
139038
139205
|
errors.push({
|
|
139039
|
-
name:
|
|
139206
|
+
name: refactorName12,
|
|
139040
139207
|
description: extractConstantAction.description,
|
|
139041
139208
|
actions: [{ ...extractConstantAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
|
|
139042
139209
|
});
|
|
@@ -139100,26 +139267,26 @@ function getRefactorActionsToExtractSymbol(context) {
|
|
|
139100
139267
|
const infos = [];
|
|
139101
139268
|
if (functionActions.length) {
|
|
139102
139269
|
infos.push({
|
|
139103
|
-
name:
|
|
139270
|
+
name: refactorName12,
|
|
139104
139271
|
description: getLocaleSpecificMessage(Diagnostics.Extract_function),
|
|
139105
139272
|
actions: functionActions
|
|
139106
139273
|
});
|
|
139107
139274
|
} else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) {
|
|
139108
139275
|
infos.push({
|
|
139109
|
-
name:
|
|
139276
|
+
name: refactorName12,
|
|
139110
139277
|
description: getLocaleSpecificMessage(Diagnostics.Extract_function),
|
|
139111
139278
|
actions: [innermostErrorFunctionAction]
|
|
139112
139279
|
});
|
|
139113
139280
|
}
|
|
139114
139281
|
if (constantActions.length) {
|
|
139115
139282
|
infos.push({
|
|
139116
|
-
name:
|
|
139283
|
+
name: refactorName12,
|
|
139117
139284
|
description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
|
|
139118
139285
|
actions: constantActions
|
|
139119
139286
|
});
|
|
139120
139287
|
} else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) {
|
|
139121
139288
|
infos.push({
|
|
139122
|
-
name:
|
|
139289
|
+
name: refactorName12,
|
|
139123
139290
|
description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
|
|
139124
139291
|
actions: [innermostErrorConstantAction]
|
|
139125
139292
|
});
|
|
@@ -140651,14 +140818,14 @@ registerRefactor(actionName, {
|
|
|
140651
140818
|
var ts_refactor_inferFunctionReturnType_exports = {};
|
|
140652
140819
|
|
|
140653
140820
|
// src/services/refactors/inferFunctionReturnType.ts
|
|
140654
|
-
var
|
|
140655
|
-
var
|
|
140821
|
+
var refactorName13 = "Infer function return type";
|
|
140822
|
+
var refactorDescription7 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
|
|
140656
140823
|
var inferReturnTypeAction = {
|
|
140657
|
-
name:
|
|
140658
|
-
description:
|
|
140824
|
+
name: refactorName13,
|
|
140825
|
+
description: refactorDescription7,
|
|
140659
140826
|
kind: "refactor.rewrite.function.returnType"
|
|
140660
140827
|
};
|
|
140661
|
-
registerRefactor(
|
|
140828
|
+
registerRefactor(refactorName13, {
|
|
140662
140829
|
kinds: [inferReturnTypeAction.kind],
|
|
140663
140830
|
getEditsForAction: getRefactorEditsToInferReturnType,
|
|
140664
140831
|
getAvailableActions: getRefactorActionsToInferReturnType
|
|
@@ -140677,15 +140844,15 @@ function getRefactorActionsToInferReturnType(context) {
|
|
|
140677
140844
|
return emptyArray;
|
|
140678
140845
|
if (!isRefactorErrorInfo(info)) {
|
|
140679
140846
|
return [{
|
|
140680
|
-
name:
|
|
140681
|
-
description:
|
|
140847
|
+
name: refactorName13,
|
|
140848
|
+
description: refactorDescription7,
|
|
140682
140849
|
actions: [inferReturnTypeAction]
|
|
140683
140850
|
}];
|
|
140684
140851
|
}
|
|
140685
140852
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
140686
140853
|
return [{
|
|
140687
|
-
name:
|
|
140688
|
-
description:
|
|
140854
|
+
name: refactorName13,
|
|
140855
|
+
description: refactorDescription7,
|
|
140689
140856
|
actions: [{ ...inferReturnTypeAction, notApplicableReason: info.error }]
|
|
140690
140857
|
}];
|
|
140691
140858
|
}
|
|
@@ -142929,10 +143096,10 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
142929
143096
|
const newFileName = createNewFileName(sourceFile, program, getRefactorContext(sourceFile, positionOrRange, preferences, emptyOptions), host);
|
|
142930
143097
|
return { newFileName, files };
|
|
142931
143098
|
}
|
|
142932
|
-
function getEditsForRefactor2(fileName, formatOptions, positionOrRange,
|
|
143099
|
+
function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName14, actionName2, preferences = emptyOptions, interactiveRefactorArguments) {
|
|
142933
143100
|
synchronizeHostData();
|
|
142934
143101
|
const file = getValidSourceFile(fileName);
|
|
142935
|
-
return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions),
|
|
143102
|
+
return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName14, actionName2, interactiveRefactorArguments);
|
|
142936
143103
|
}
|
|
142937
143104
|
function toLineColumnOffset(fileName, position) {
|
|
142938
143105
|
if (position === 0) {
|
|
@@ -158975,7 +159142,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
|
|
|
158975
159142
|
case 290 /* JsxAttribute */:
|
|
158976
159143
|
if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
|
|
158977
159144
|
const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
|
|
158978
|
-
return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType();
|
|
159145
|
+
return argumentInfo && (getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker, 0 /* Normal */)) || fromContextualType(0 /* None */);
|
|
158979
159146
|
}
|
|
158980
159147
|
case 271 /* ImportDeclaration */:
|
|
158981
159148
|
case 277 /* ExportDeclaration */:
|
|
@@ -159044,12 +159211,12 @@ function walkUpParentheses(node) {
|
|
|
159044
159211
|
function getAlreadyUsedTypesInStringLiteralUnion(union, current) {
|
|
159045
159212
|
return mapDefined(union.types, (type) => type !== current && isLiteralTypeNode(type) && isStringLiteral(type.literal) ? type.literal.text : void 0);
|
|
159046
159213
|
}
|
|
159047
|
-
function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker) {
|
|
159214
|
+
function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) {
|
|
159048
159215
|
let isNewIdentifier = false;
|
|
159049
159216
|
const uniques = /* @__PURE__ */ new Map();
|
|
159050
159217
|
const candidates = [];
|
|
159051
159218
|
const editingArgument = isJsxOpeningLikeElement(call) ? Debug.checkDefined(findAncestor(arg.parent, isJsxAttribute)) : arg;
|
|
159052
|
-
checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates);
|
|
159219
|
+
checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates, checkMode);
|
|
159053
159220
|
const types = flatMap(candidates, (candidate) => {
|
|
159054
159221
|
if (!signatureHasRestParameter(candidate) && argumentInfo.argumentCount > candidate.parameters.length)
|
|
159055
159222
|
return;
|
|
@@ -159659,6 +159826,7 @@ __export(ts_FindAllReferences_exports, {
|
|
|
159659
159826
|
getTextSpanOfEntry: () => getTextSpanOfEntry,
|
|
159660
159827
|
isContextWithStartAndEndNode: () => isContextWithStartAndEndNode,
|
|
159661
159828
|
isDeclarationOfSymbol: () => isDeclarationOfSymbol,
|
|
159829
|
+
isWriteAccessForReference: () => isWriteAccessForReference,
|
|
159662
159830
|
nodeEntry: () => nodeEntry,
|
|
159663
159831
|
toContextSpan: () => toContextSpan,
|
|
159664
159832
|
toHighlightSpan: () => toHighlightSpan,
|
|
@@ -172323,9 +172491,9 @@ function buildOverload(name) {
|
|
|
172323
172491
|
|
|
172324
172492
|
// src/deprecatedCompat/5.0/identifierProperties.ts
|
|
172325
172493
|
addObjectAllocatorPatcher((objectAllocator2) => {
|
|
172326
|
-
const
|
|
172327
|
-
if (!hasProperty(
|
|
172328
|
-
Object.defineProperty(
|
|
172494
|
+
const Identifier75 = objectAllocator2.getIdentifierConstructor();
|
|
172495
|
+
if (!hasProperty(Identifier75.prototype, "originalKeywordKind")) {
|
|
172496
|
+
Object.defineProperty(Identifier75.prototype, "originalKeywordKind", {
|
|
172329
172497
|
get: deprecate(function() {
|
|
172330
172498
|
return identifierToKeywordKind(this);
|
|
172331
172499
|
}, {
|
|
@@ -172337,8 +172505,8 @@ addObjectAllocatorPatcher((objectAllocator2) => {
|
|
|
172337
172505
|
})
|
|
172338
172506
|
});
|
|
172339
172507
|
}
|
|
172340
|
-
if (!hasProperty(
|
|
172341
|
-
Object.defineProperty(
|
|
172508
|
+
if (!hasProperty(Identifier75.prototype, "isInJSDocNamespace")) {
|
|
172509
|
+
Object.defineProperty(Identifier75.prototype, "isInJSDocNamespace", {
|
|
172342
172510
|
get: deprecate(function() {
|
|
172343
172511
|
return this.flags & 2048 /* IdentifierIsInJSDocNamespace */ ? true : void 0;
|
|
172344
172512
|
}, {
|