@typescript-deploys/pr-build 5.1.0-pr-53907-15 → 5.1.0-pr-54186-8
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 +35 -33
- package/lib/tsserver.js +35 -33
- package/lib/tsserverlibrary.js +35 -33
- package/lib/typescript.js +35 -33
- package/lib/typingsInstaller.js +5 -4
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.1";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230508`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -42598,9 +42598,10 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
42598
42598
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
42599
42599
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
42600
42600
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
42601
|
-
CheckMode3[CheckMode3["
|
|
42602
|
-
CheckMode3[CheckMode3["
|
|
42603
|
-
CheckMode3[CheckMode3["
|
|
42601
|
+
CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
|
|
42602
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
|
|
42603
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
|
|
42604
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
|
|
42604
42605
|
return CheckMode3;
|
|
42605
42606
|
})(CheckMode || {});
|
|
42606
42607
|
var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -42892,9 +42893,9 @@ function createTypeChecker(host) {
|
|
|
42892
42893
|
candidatesOutArray,
|
|
42893
42894
|
/*argumentCount*/
|
|
42894
42895
|
void 0,
|
|
42895
|
-
|
|
42896
|
+
64 /* IsForStringLiteralArgumentCompletions */
|
|
42896
42897
|
)),
|
|
42897
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount,
|
|
42898
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
|
|
42898
42899
|
getExpandedParameters,
|
|
42899
42900
|
hasEffectiveRestParameter,
|
|
42900
42901
|
containsArgumentsReference,
|
|
@@ -50879,7 +50880,7 @@ function createTypeChecker(host) {
|
|
|
50879
50880
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
50880
50881
|
}
|
|
50881
50882
|
function getTypeForBindingElement(declaration) {
|
|
50882
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
50883
|
+
const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
50883
50884
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
50884
50885
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
50885
50886
|
}
|
|
@@ -65728,7 +65729,7 @@ function createTypeChecker(host) {
|
|
|
65728
65729
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
65729
65730
|
}
|
|
65730
65731
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
65731
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
65732
|
+
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 128 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
|
|
65732
65733
|
node,
|
|
65733
65734
|
/*contextFlags*/
|
|
65734
65735
|
void 0
|
|
@@ -66485,7 +66486,7 @@ function createTypeChecker(host) {
|
|
|
66485
66486
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
66486
66487
|
const parent = declaration.parent.parent;
|
|
66487
66488
|
const name = declaration.propertyName || declaration.name;
|
|
66488
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 207 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ?
|
|
66489
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 207 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
|
|
66489
66490
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
66490
66491
|
return void 0;
|
|
66491
66492
|
if (parent.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -66992,7 +66993,6 @@ function createTypeChecker(host) {
|
|
|
66992
66993
|
case 9 /* NumericLiteral */:
|
|
66993
66994
|
case 10 /* BigIntLiteral */:
|
|
66994
66995
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
66995
|
-
case 227 /* TemplateExpression */:
|
|
66996
66996
|
case 112 /* TrueKeyword */:
|
|
66997
66997
|
case 97 /* FalseKeyword */:
|
|
66998
66998
|
case 106 /* NullKeyword */:
|
|
@@ -67534,7 +67534,9 @@ function createTypeChecker(host) {
|
|
|
67534
67534
|
elementTypes.push(undefinedOrMissingType);
|
|
67535
67535
|
elementFlags.push(2 /* Optional */);
|
|
67536
67536
|
} else {
|
|
67537
|
-
const
|
|
67537
|
+
const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
|
|
67538
|
+
const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
67539
|
+
const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
|
|
67538
67540
|
elementTypes.push(addOptionality(
|
|
67539
67541
|
type,
|
|
67540
67542
|
/*isProperty*/
|
|
@@ -67542,7 +67544,7 @@ function createTypeChecker(host) {
|
|
|
67542
67544
|
hasOmittedExpression
|
|
67543
67545
|
));
|
|
67544
67546
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
67545
|
-
if (
|
|
67547
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
67546
67548
|
const inferenceContext = getInferenceContext(node);
|
|
67547
67549
|
Debug.assert(inferenceContext);
|
|
67548
67550
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -67648,7 +67650,7 @@ function createTypeChecker(host) {
|
|
|
67648
67650
|
}
|
|
67649
67651
|
return links.immediateTarget;
|
|
67650
67652
|
}
|
|
67651
|
-
function checkObjectLiteral(node, checkMode) {
|
|
67653
|
+
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
67652
67654
|
var _a;
|
|
67653
67655
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
67654
67656
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
@@ -67683,11 +67685,13 @@ function createTypeChecker(host) {
|
|
|
67683
67685
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
67684
67686
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
67685
67687
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
67686
|
-
|
|
67688
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
|
|
67689
|
+
const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
67690
|
+
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
|
|
67687
67691
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
67688
67692
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
67689
67693
|
// we don't want to say "could not find 'a'".
|
|
67690
|
-
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name,
|
|
67694
|
+
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
|
|
67691
67695
|
);
|
|
67692
67696
|
if (isInJavascript) {
|
|
67693
67697
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -67731,7 +67735,7 @@ function createTypeChecker(host) {
|
|
|
67731
67735
|
prop.links.target = member;
|
|
67732
67736
|
member = prop;
|
|
67733
67737
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
67734
|
-
if (
|
|
67738
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
67735
67739
|
const inferenceContext = getInferenceContext(node);
|
|
67736
67740
|
Debug.assert(inferenceContext);
|
|
67737
67741
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -67890,7 +67894,7 @@ function createTypeChecker(host) {
|
|
|
67890
67894
|
function checkJsxAttribute(node, checkMode) {
|
|
67891
67895
|
return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType;
|
|
67892
67896
|
}
|
|
67893
|
-
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
67897
|
+
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode = 0 /* Normal */) {
|
|
67894
67898
|
const attributes = openingLikeElement.attributes;
|
|
67895
67899
|
const contextualType = getContextualType(attributes, 0 /* None */);
|
|
67896
67900
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -67904,7 +67908,9 @@ function createTypeChecker(host) {
|
|
|
67904
67908
|
for (const attributeDecl of attributes.properties) {
|
|
67905
67909
|
const member = attributeDecl.symbol;
|
|
67906
67910
|
if (isJsxAttribute(attributeDecl)) {
|
|
67907
|
-
const
|
|
67911
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
|
|
67912
|
+
const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
67913
|
+
const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
|
|
67908
67914
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
67909
67915
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
67910
67916
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -67925,7 +67931,7 @@ function createTypeChecker(host) {
|
|
|
67925
67931
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
67926
67932
|
}
|
|
67927
67933
|
}
|
|
67928
|
-
if (
|
|
67934
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
67929
67935
|
const inferenceContext = getInferenceContext(attributes);
|
|
67930
67936
|
Debug.assert(inferenceContext);
|
|
67931
67937
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -69543,7 +69549,7 @@ function createTypeChecker(host) {
|
|
|
69543
69549
|
}
|
|
69544
69550
|
for (let i = 0; i < argCount; i++) {
|
|
69545
69551
|
const arg = args[i];
|
|
69546
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
69552
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
69547
69553
|
const paramType = getTypeAtPosition(signature, i);
|
|
69548
69554
|
if (couldContainTypeVariables(paramType)) {
|
|
69549
69555
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -70155,12 +70161,12 @@ function createTypeChecker(host) {
|
|
|
70155
70161
|
const args = getEffectiveCallArguments(node);
|
|
70156
70162
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
70157
70163
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
70158
|
-
argCheckMode |= checkMode &
|
|
70164
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
70159
70165
|
let candidatesForArgumentError;
|
|
70160
70166
|
let candidateForArgumentArityError;
|
|
70161
70167
|
let candidateForTypeArgumentError;
|
|
70162
70168
|
let result;
|
|
70163
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
70169
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
70164
70170
|
if (candidates.length > 1) {
|
|
70165
70171
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
70166
70172
|
}
|
|
@@ -70379,7 +70385,7 @@ function createTypeChecker(host) {
|
|
|
70379
70385
|
continue;
|
|
70380
70386
|
}
|
|
70381
70387
|
if (argCheckMode) {
|
|
70382
|
-
argCheckMode = checkMode &
|
|
70388
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
70383
70389
|
if (inferenceContext) {
|
|
70384
70390
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
70385
70391
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -73790,15 +73796,11 @@ function createTypeChecker(host) {
|
|
|
73790
73796
|
texts.push(span.literal.text);
|
|
73791
73797
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
73792
73798
|
}
|
|
73793
|
-
|
|
73799
|
+
return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(
|
|
73794
73800
|
node,
|
|
73795
73801
|
/*contextFlags*/
|
|
73796
73802
|
void 0
|
|
73797
|
-
) || unknownType, isTemplateLiteralContextualType))
|
|
73798
|
-
return getTemplateLiteralType(texts, types);
|
|
73799
|
-
}
|
|
73800
|
-
const evaluated = node.parent.kind !== 214 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
|
|
73801
|
-
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
73803
|
+
) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
73802
73804
|
}
|
|
73803
73805
|
function isTemplateLiteralContextualType(type) {
|
|
73804
73806
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
@@ -76578,7 +76580,7 @@ function createTypeChecker(host) {
|
|
|
76578
76580
|
checkComputedPropertyName(node.propertyName);
|
|
76579
76581
|
}
|
|
76580
76582
|
const parent = node.parent.parent;
|
|
76581
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
76583
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
76582
76584
|
const parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
76583
76585
|
const name = node.propertyName || node.name;
|
|
76584
76586
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -78776,11 +78778,11 @@ function createTypeChecker(host) {
|
|
|
78776
78778
|
);
|
|
78777
78779
|
if (symbol) {
|
|
78778
78780
|
if (symbol.flags & 8 /* EnumMember */) {
|
|
78779
|
-
return
|
|
78781
|
+
return evaluateEnumMember(expr, symbol, location);
|
|
78780
78782
|
}
|
|
78781
78783
|
if (isConstVariable(symbol)) {
|
|
78782
78784
|
const declaration = symbol.valueDeclaration;
|
|
78783
|
-
if (declaration && !declaration.type && declaration.initializer &&
|
|
78785
|
+
if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
78784
78786
|
return evaluate(declaration.initializer, declaration);
|
|
78785
78787
|
}
|
|
78786
78788
|
}
|
|
@@ -78800,7 +78802,7 @@ function createTypeChecker(host) {
|
|
|
78800
78802
|
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
78801
78803
|
const member = rootSymbol.exports.get(name);
|
|
78802
78804
|
if (member) {
|
|
78803
|
-
return
|
|
78805
|
+
return evaluateEnumMember(expr, member, location);
|
|
78804
78806
|
}
|
|
78805
78807
|
}
|
|
78806
78808
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -2303,7 +2303,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2303
2303
|
|
|
2304
2304
|
// src/compiler/corePublic.ts
|
|
2305
2305
|
var versionMajorMinor = "5.1";
|
|
2306
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2306
|
+
var version = `${versionMajorMinor}.0-insiders.20230508`;
|
|
2307
2307
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2308
2308
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2309
2309
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -47248,9 +47248,10 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
47248
47248
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
47249
47249
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
47250
47250
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
47251
|
-
CheckMode3[CheckMode3["
|
|
47252
|
-
CheckMode3[CheckMode3["
|
|
47253
|
-
CheckMode3[CheckMode3["
|
|
47251
|
+
CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
|
|
47252
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
|
|
47253
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
|
|
47254
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
|
|
47254
47255
|
return CheckMode3;
|
|
47255
47256
|
})(CheckMode || {});
|
|
47256
47257
|
var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -47542,9 +47543,9 @@ function createTypeChecker(host) {
|
|
|
47542
47543
|
candidatesOutArray,
|
|
47543
47544
|
/*argumentCount*/
|
|
47544
47545
|
void 0,
|
|
47545
|
-
|
|
47546
|
+
64 /* IsForStringLiteralArgumentCompletions */
|
|
47546
47547
|
)),
|
|
47547
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount,
|
|
47548
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
|
|
47548
47549
|
getExpandedParameters,
|
|
47549
47550
|
hasEffectiveRestParameter,
|
|
47550
47551
|
containsArgumentsReference,
|
|
@@ -55529,7 +55530,7 @@ function createTypeChecker(host) {
|
|
|
55529
55530
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
55530
55531
|
}
|
|
55531
55532
|
function getTypeForBindingElement(declaration) {
|
|
55532
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
55533
|
+
const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
55533
55534
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
55534
55535
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
55535
55536
|
}
|
|
@@ -70378,7 +70379,7 @@ function createTypeChecker(host) {
|
|
|
70378
70379
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
70379
70380
|
}
|
|
70380
70381
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
70381
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
70382
|
+
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 128 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
|
|
70382
70383
|
node,
|
|
70383
70384
|
/*contextFlags*/
|
|
70384
70385
|
void 0
|
|
@@ -71135,7 +71136,7 @@ function createTypeChecker(host) {
|
|
|
71135
71136
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
71136
71137
|
const parent2 = declaration.parent.parent;
|
|
71137
71138
|
const name = declaration.propertyName || declaration.name;
|
|
71138
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ?
|
|
71139
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
|
|
71139
71140
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
71140
71141
|
return void 0;
|
|
71141
71142
|
if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -71642,7 +71643,6 @@ function createTypeChecker(host) {
|
|
|
71642
71643
|
case 9 /* NumericLiteral */:
|
|
71643
71644
|
case 10 /* BigIntLiteral */:
|
|
71644
71645
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
71645
|
-
case 227 /* TemplateExpression */:
|
|
71646
71646
|
case 112 /* TrueKeyword */:
|
|
71647
71647
|
case 97 /* FalseKeyword */:
|
|
71648
71648
|
case 106 /* NullKeyword */:
|
|
@@ -72184,7 +72184,9 @@ function createTypeChecker(host) {
|
|
|
72184
72184
|
elementTypes.push(undefinedOrMissingType);
|
|
72185
72185
|
elementFlags.push(2 /* Optional */);
|
|
72186
72186
|
} else {
|
|
72187
|
-
const
|
|
72187
|
+
const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
|
|
72188
|
+
const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
72189
|
+
const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
|
|
72188
72190
|
elementTypes.push(addOptionality(
|
|
72189
72191
|
type,
|
|
72190
72192
|
/*isProperty*/
|
|
@@ -72192,7 +72194,7 @@ function createTypeChecker(host) {
|
|
|
72192
72194
|
hasOmittedExpression
|
|
72193
72195
|
));
|
|
72194
72196
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
72195
|
-
if (
|
|
72197
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
72196
72198
|
const inferenceContext = getInferenceContext(node);
|
|
72197
72199
|
Debug.assert(inferenceContext);
|
|
72198
72200
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -72298,7 +72300,7 @@ function createTypeChecker(host) {
|
|
|
72298
72300
|
}
|
|
72299
72301
|
return links.immediateTarget;
|
|
72300
72302
|
}
|
|
72301
|
-
function checkObjectLiteral(node, checkMode) {
|
|
72303
|
+
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
72302
72304
|
var _a;
|
|
72303
72305
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
72304
72306
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
@@ -72333,11 +72335,13 @@ function createTypeChecker(host) {
|
|
|
72333
72335
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
72334
72336
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
72335
72337
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
72336
|
-
|
|
72338
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
|
|
72339
|
+
const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
72340
|
+
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
|
|
72337
72341
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
72338
72342
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
72339
72343
|
// we don't want to say "could not find 'a'".
|
|
72340
|
-
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name,
|
|
72344
|
+
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
|
|
72341
72345
|
);
|
|
72342
72346
|
if (isInJavascript) {
|
|
72343
72347
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -72381,7 +72385,7 @@ function createTypeChecker(host) {
|
|
|
72381
72385
|
prop.links.target = member;
|
|
72382
72386
|
member = prop;
|
|
72383
72387
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
72384
|
-
if (
|
|
72388
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
72385
72389
|
const inferenceContext = getInferenceContext(node);
|
|
72386
72390
|
Debug.assert(inferenceContext);
|
|
72387
72391
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -72540,7 +72544,7 @@ function createTypeChecker(host) {
|
|
|
72540
72544
|
function checkJsxAttribute(node, checkMode) {
|
|
72541
72545
|
return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType;
|
|
72542
72546
|
}
|
|
72543
|
-
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
72547
|
+
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode = 0 /* Normal */) {
|
|
72544
72548
|
const attributes = openingLikeElement.attributes;
|
|
72545
72549
|
const contextualType = getContextualType2(attributes, 0 /* None */);
|
|
72546
72550
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -72554,7 +72558,9 @@ function createTypeChecker(host) {
|
|
|
72554
72558
|
for (const attributeDecl of attributes.properties) {
|
|
72555
72559
|
const member = attributeDecl.symbol;
|
|
72556
72560
|
if (isJsxAttribute(attributeDecl)) {
|
|
72557
|
-
const
|
|
72561
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
|
|
72562
|
+
const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
72563
|
+
const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
|
|
72558
72564
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
72559
72565
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
72560
72566
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -72575,7 +72581,7 @@ function createTypeChecker(host) {
|
|
|
72575
72581
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
72576
72582
|
}
|
|
72577
72583
|
}
|
|
72578
|
-
if (
|
|
72584
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
72579
72585
|
const inferenceContext = getInferenceContext(attributes);
|
|
72580
72586
|
Debug.assert(inferenceContext);
|
|
72581
72587
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -74193,7 +74199,7 @@ function createTypeChecker(host) {
|
|
|
74193
74199
|
}
|
|
74194
74200
|
for (let i = 0; i < argCount; i++) {
|
|
74195
74201
|
const arg = args[i];
|
|
74196
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
74202
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
74197
74203
|
const paramType = getTypeAtPosition(signature, i);
|
|
74198
74204
|
if (couldContainTypeVariables(paramType)) {
|
|
74199
74205
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -74805,12 +74811,12 @@ function createTypeChecker(host) {
|
|
|
74805
74811
|
const args = getEffectiveCallArguments(node);
|
|
74806
74812
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
74807
74813
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
74808
|
-
argCheckMode |= checkMode &
|
|
74814
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
74809
74815
|
let candidatesForArgumentError;
|
|
74810
74816
|
let candidateForArgumentArityError;
|
|
74811
74817
|
let candidateForTypeArgumentError;
|
|
74812
74818
|
let result;
|
|
74813
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
74819
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
74814
74820
|
if (candidates.length > 1) {
|
|
74815
74821
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
74816
74822
|
}
|
|
@@ -75029,7 +75035,7 @@ function createTypeChecker(host) {
|
|
|
75029
75035
|
continue;
|
|
75030
75036
|
}
|
|
75031
75037
|
if (argCheckMode) {
|
|
75032
|
-
argCheckMode = checkMode &
|
|
75038
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
75033
75039
|
if (inferenceContext) {
|
|
75034
75040
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
75035
75041
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -78440,15 +78446,11 @@ function createTypeChecker(host) {
|
|
|
78440
78446
|
texts.push(span.literal.text);
|
|
78441
78447
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
78442
78448
|
}
|
|
78443
|
-
|
|
78449
|
+
return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType2(
|
|
78444
78450
|
node,
|
|
78445
78451
|
/*contextFlags*/
|
|
78446
78452
|
void 0
|
|
78447
|
-
) || unknownType, isTemplateLiteralContextualType))
|
|
78448
|
-
return getTemplateLiteralType(texts, types);
|
|
78449
|
-
}
|
|
78450
|
-
const evaluated = node.parent.kind !== 214 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
|
|
78451
|
-
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
78453
|
+
) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
78452
78454
|
}
|
|
78453
78455
|
function isTemplateLiteralContextualType(type) {
|
|
78454
78456
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
@@ -81228,7 +81230,7 @@ function createTypeChecker(host) {
|
|
|
81228
81230
|
checkComputedPropertyName(node.propertyName);
|
|
81229
81231
|
}
|
|
81230
81232
|
const parent2 = node.parent.parent;
|
|
81231
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
81233
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
81232
81234
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
81233
81235
|
const name = node.propertyName || node.name;
|
|
81234
81236
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -83426,11 +83428,11 @@ function createTypeChecker(host) {
|
|
|
83426
83428
|
);
|
|
83427
83429
|
if (symbol) {
|
|
83428
83430
|
if (symbol.flags & 8 /* EnumMember */) {
|
|
83429
|
-
return
|
|
83431
|
+
return evaluateEnumMember(expr, symbol, location);
|
|
83430
83432
|
}
|
|
83431
83433
|
if (isConstVariable(symbol)) {
|
|
83432
83434
|
const declaration = symbol.valueDeclaration;
|
|
83433
|
-
if (declaration && !declaration.type && declaration.initializer &&
|
|
83435
|
+
if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
83434
83436
|
return evaluate(declaration.initializer, declaration);
|
|
83435
83437
|
}
|
|
83436
83438
|
}
|
|
@@ -83450,7 +83452,7 @@ function createTypeChecker(host) {
|
|
|
83450
83452
|
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
83451
83453
|
const member = rootSymbol.exports.get(name);
|
|
83452
83454
|
if (member) {
|
|
83453
|
-
return
|
|
83455
|
+
return evaluateEnumMember(expr, member, location);
|
|
83454
83456
|
}
|
|
83455
83457
|
}
|
|
83456
83458
|
}
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230508`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -45334,9 +45334,9 @@ ${lanes.join("\n")}
|
|
|
45334
45334
|
candidatesOutArray,
|
|
45335
45335
|
/*argumentCount*/
|
|
45336
45336
|
void 0,
|
|
45337
|
-
|
|
45337
|
+
64 /* IsForStringLiteralArgumentCompletions */
|
|
45338
45338
|
)),
|
|
45339
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount,
|
|
45339
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
|
|
45340
45340
|
getExpandedParameters,
|
|
45341
45341
|
hasEffectiveRestParameter,
|
|
45342
45342
|
containsArgumentsReference,
|
|
@@ -53321,7 +53321,7 @@ ${lanes.join("\n")}
|
|
|
53321
53321
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
53322
53322
|
}
|
|
53323
53323
|
function getTypeForBindingElement(declaration) {
|
|
53324
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
53324
|
+
const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
53325
53325
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
53326
53326
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
53327
53327
|
}
|
|
@@ -68170,7 +68170,7 @@ ${lanes.join("\n")}
|
|
|
68170
68170
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
68171
68171
|
}
|
|
68172
68172
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
68173
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
68173
|
+
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 128 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
|
|
68174
68174
|
node,
|
|
68175
68175
|
/*contextFlags*/
|
|
68176
68176
|
void 0
|
|
@@ -68927,7 +68927,7 @@ ${lanes.join("\n")}
|
|
|
68927
68927
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
68928
68928
|
const parent2 = declaration.parent.parent;
|
|
68929
68929
|
const name = declaration.propertyName || declaration.name;
|
|
68930
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ?
|
|
68930
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
|
|
68931
68931
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
68932
68932
|
return void 0;
|
|
68933
68933
|
if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -69434,7 +69434,6 @@ ${lanes.join("\n")}
|
|
|
69434
69434
|
case 9 /* NumericLiteral */:
|
|
69435
69435
|
case 10 /* BigIntLiteral */:
|
|
69436
69436
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
69437
|
-
case 227 /* TemplateExpression */:
|
|
69438
69437
|
case 112 /* TrueKeyword */:
|
|
69439
69438
|
case 97 /* FalseKeyword */:
|
|
69440
69439
|
case 106 /* NullKeyword */:
|
|
@@ -69976,7 +69975,9 @@ ${lanes.join("\n")}
|
|
|
69976
69975
|
elementTypes.push(undefinedOrMissingType);
|
|
69977
69976
|
elementFlags.push(2 /* Optional */);
|
|
69978
69977
|
} else {
|
|
69979
|
-
const
|
|
69978
|
+
const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
|
|
69979
|
+
const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
69980
|
+
const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
|
|
69980
69981
|
elementTypes.push(addOptionality(
|
|
69981
69982
|
type,
|
|
69982
69983
|
/*isProperty*/
|
|
@@ -69984,7 +69985,7 @@ ${lanes.join("\n")}
|
|
|
69984
69985
|
hasOmittedExpression
|
|
69985
69986
|
));
|
|
69986
69987
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
69987
|
-
if (
|
|
69988
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
69988
69989
|
const inferenceContext = getInferenceContext(node);
|
|
69989
69990
|
Debug.assert(inferenceContext);
|
|
69990
69991
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -70090,7 +70091,7 @@ ${lanes.join("\n")}
|
|
|
70090
70091
|
}
|
|
70091
70092
|
return links.immediateTarget;
|
|
70092
70093
|
}
|
|
70093
|
-
function checkObjectLiteral(node, checkMode) {
|
|
70094
|
+
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
70094
70095
|
var _a;
|
|
70095
70096
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
70096
70097
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
@@ -70125,11 +70126,13 @@ ${lanes.join("\n")}
|
|
|
70125
70126
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
70126
70127
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
70127
70128
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
70128
|
-
|
|
70129
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
|
|
70130
|
+
const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70131
|
+
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
|
|
70129
70132
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
70130
70133
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
70131
70134
|
// we don't want to say "could not find 'a'".
|
|
70132
|
-
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name,
|
|
70135
|
+
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
|
|
70133
70136
|
);
|
|
70134
70137
|
if (isInJavascript) {
|
|
70135
70138
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -70173,7 +70176,7 @@ ${lanes.join("\n")}
|
|
|
70173
70176
|
prop.links.target = member;
|
|
70174
70177
|
member = prop;
|
|
70175
70178
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
70176
|
-
if (
|
|
70179
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70177
70180
|
const inferenceContext = getInferenceContext(node);
|
|
70178
70181
|
Debug.assert(inferenceContext);
|
|
70179
70182
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -70332,7 +70335,7 @@ ${lanes.join("\n")}
|
|
|
70332
70335
|
function checkJsxAttribute(node, checkMode) {
|
|
70333
70336
|
return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType;
|
|
70334
70337
|
}
|
|
70335
|
-
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
70338
|
+
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode = 0 /* Normal */) {
|
|
70336
70339
|
const attributes = openingLikeElement.attributes;
|
|
70337
70340
|
const contextualType = getContextualType2(attributes, 0 /* None */);
|
|
70338
70341
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -70346,7 +70349,9 @@ ${lanes.join("\n")}
|
|
|
70346
70349
|
for (const attributeDecl of attributes.properties) {
|
|
70347
70350
|
const member = attributeDecl.symbol;
|
|
70348
70351
|
if (isJsxAttribute(attributeDecl)) {
|
|
70349
|
-
const
|
|
70352
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
|
|
70353
|
+
const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70354
|
+
const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
|
|
70350
70355
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
70351
70356
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
70352
70357
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -70367,7 +70372,7 @@ ${lanes.join("\n")}
|
|
|
70367
70372
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
70368
70373
|
}
|
|
70369
70374
|
}
|
|
70370
|
-
if (
|
|
70375
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70371
70376
|
const inferenceContext = getInferenceContext(attributes);
|
|
70372
70377
|
Debug.assert(inferenceContext);
|
|
70373
70378
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -71985,7 +71990,7 @@ ${lanes.join("\n")}
|
|
|
71985
71990
|
}
|
|
71986
71991
|
for (let i = 0; i < argCount; i++) {
|
|
71987
71992
|
const arg = args[i];
|
|
71988
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
71993
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
71989
71994
|
const paramType = getTypeAtPosition(signature, i);
|
|
71990
71995
|
if (couldContainTypeVariables(paramType)) {
|
|
71991
71996
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -72597,12 +72602,12 @@ ${lanes.join("\n")}
|
|
|
72597
72602
|
const args = getEffectiveCallArguments(node);
|
|
72598
72603
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
72599
72604
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
72600
|
-
argCheckMode |= checkMode &
|
|
72605
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72601
72606
|
let candidatesForArgumentError;
|
|
72602
72607
|
let candidateForArgumentArityError;
|
|
72603
72608
|
let candidateForTypeArgumentError;
|
|
72604
72609
|
let result;
|
|
72605
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
72610
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
72606
72611
|
if (candidates.length > 1) {
|
|
72607
72612
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
72608
72613
|
}
|
|
@@ -72821,7 +72826,7 @@ ${lanes.join("\n")}
|
|
|
72821
72826
|
continue;
|
|
72822
72827
|
}
|
|
72823
72828
|
if (argCheckMode) {
|
|
72824
|
-
argCheckMode = checkMode &
|
|
72829
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72825
72830
|
if (inferenceContext) {
|
|
72826
72831
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72827
72832
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -76232,15 +76237,11 @@ ${lanes.join("\n")}
|
|
|
76232
76237
|
texts.push(span.literal.text);
|
|
76233
76238
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
76234
76239
|
}
|
|
76235
|
-
|
|
76240
|
+
return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType2(
|
|
76236
76241
|
node,
|
|
76237
76242
|
/*contextFlags*/
|
|
76238
76243
|
void 0
|
|
76239
|
-
) || unknownType, isTemplateLiteralContextualType))
|
|
76240
|
-
return getTemplateLiteralType(texts, types);
|
|
76241
|
-
}
|
|
76242
|
-
const evaluated = node.parent.kind !== 214 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
|
|
76243
|
-
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
76244
|
+
) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
76244
76245
|
}
|
|
76245
76246
|
function isTemplateLiteralContextualType(type) {
|
|
76246
76247
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
@@ -79020,7 +79021,7 @@ ${lanes.join("\n")}
|
|
|
79020
79021
|
checkComputedPropertyName(node.propertyName);
|
|
79021
79022
|
}
|
|
79022
79023
|
const parent2 = node.parent.parent;
|
|
79023
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
79024
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
79024
79025
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
79025
79026
|
const name = node.propertyName || node.name;
|
|
79026
79027
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -81218,11 +81219,11 @@ ${lanes.join("\n")}
|
|
|
81218
81219
|
);
|
|
81219
81220
|
if (symbol) {
|
|
81220
81221
|
if (symbol.flags & 8 /* EnumMember */) {
|
|
81221
|
-
return
|
|
81222
|
+
return evaluateEnumMember(expr, symbol, location);
|
|
81222
81223
|
}
|
|
81223
81224
|
if (isConstVariable(symbol)) {
|
|
81224
81225
|
const declaration = symbol.valueDeclaration;
|
|
81225
|
-
if (declaration && !declaration.type && declaration.initializer &&
|
|
81226
|
+
if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
81226
81227
|
return evaluate(declaration.initializer, declaration);
|
|
81227
81228
|
}
|
|
81228
81229
|
}
|
|
@@ -81242,7 +81243,7 @@ ${lanes.join("\n")}
|
|
|
81242
81243
|
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
81243
81244
|
const member = rootSymbol.exports.get(name);
|
|
81244
81245
|
if (member) {
|
|
81245
|
-
return
|
|
81246
|
+
return evaluateEnumMember(expr, member, location);
|
|
81246
81247
|
}
|
|
81247
81248
|
}
|
|
81248
81249
|
}
|
|
@@ -85756,9 +85757,10 @@ ${lanes.join("\n")}
|
|
|
85756
85757
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
85757
85758
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
85758
85759
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
85759
|
-
CheckMode3[CheckMode3["
|
|
85760
|
-
CheckMode3[CheckMode3["
|
|
85761
|
-
CheckMode3[CheckMode3["
|
|
85760
|
+
CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
|
|
85761
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
|
|
85762
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
|
|
85763
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
|
|
85762
85764
|
return CheckMode3;
|
|
85763
85765
|
})(CheckMode || {});
|
|
85764
85766
|
SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230508`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -45334,9 +45334,9 @@ ${lanes.join("\n")}
|
|
|
45334
45334
|
candidatesOutArray,
|
|
45335
45335
|
/*argumentCount*/
|
|
45336
45336
|
void 0,
|
|
45337
|
-
|
|
45337
|
+
64 /* IsForStringLiteralArgumentCompletions */
|
|
45338
45338
|
)),
|
|
45339
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount,
|
|
45339
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
|
|
45340
45340
|
getExpandedParameters,
|
|
45341
45341
|
hasEffectiveRestParameter,
|
|
45342
45342
|
containsArgumentsReference,
|
|
@@ -53321,7 +53321,7 @@ ${lanes.join("\n")}
|
|
|
53321
53321
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
53322
53322
|
}
|
|
53323
53323
|
function getTypeForBindingElement(declaration) {
|
|
53324
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
53324
|
+
const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
53325
53325
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
53326
53326
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
53327
53327
|
}
|
|
@@ -68170,7 +68170,7 @@ ${lanes.join("\n")}
|
|
|
68170
68170
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
68171
68171
|
}
|
|
68172
68172
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
68173
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
68173
|
+
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 128 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
|
|
68174
68174
|
node,
|
|
68175
68175
|
/*contextFlags*/
|
|
68176
68176
|
void 0
|
|
@@ -68927,7 +68927,7 @@ ${lanes.join("\n")}
|
|
|
68927
68927
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
68928
68928
|
const parent2 = declaration.parent.parent;
|
|
68929
68929
|
const name = declaration.propertyName || declaration.name;
|
|
68930
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ?
|
|
68930
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
|
|
68931
68931
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
68932
68932
|
return void 0;
|
|
68933
68933
|
if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -69434,7 +69434,6 @@ ${lanes.join("\n")}
|
|
|
69434
69434
|
case 9 /* NumericLiteral */:
|
|
69435
69435
|
case 10 /* BigIntLiteral */:
|
|
69436
69436
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
69437
|
-
case 227 /* TemplateExpression */:
|
|
69438
69437
|
case 112 /* TrueKeyword */:
|
|
69439
69438
|
case 97 /* FalseKeyword */:
|
|
69440
69439
|
case 106 /* NullKeyword */:
|
|
@@ -69976,7 +69975,9 @@ ${lanes.join("\n")}
|
|
|
69976
69975
|
elementTypes.push(undefinedOrMissingType);
|
|
69977
69976
|
elementFlags.push(2 /* Optional */);
|
|
69978
69977
|
} else {
|
|
69979
|
-
const
|
|
69978
|
+
const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
|
|
69979
|
+
const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
69980
|
+
const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
|
|
69980
69981
|
elementTypes.push(addOptionality(
|
|
69981
69982
|
type,
|
|
69982
69983
|
/*isProperty*/
|
|
@@ -69984,7 +69985,7 @@ ${lanes.join("\n")}
|
|
|
69984
69985
|
hasOmittedExpression
|
|
69985
69986
|
));
|
|
69986
69987
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
69987
|
-
if (
|
|
69988
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
69988
69989
|
const inferenceContext = getInferenceContext(node);
|
|
69989
69990
|
Debug.assert(inferenceContext);
|
|
69990
69991
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -70090,7 +70091,7 @@ ${lanes.join("\n")}
|
|
|
70090
70091
|
}
|
|
70091
70092
|
return links.immediateTarget;
|
|
70092
70093
|
}
|
|
70093
|
-
function checkObjectLiteral(node, checkMode) {
|
|
70094
|
+
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
70094
70095
|
var _a;
|
|
70095
70096
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
70096
70097
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
@@ -70125,11 +70126,13 @@ ${lanes.join("\n")}
|
|
|
70125
70126
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
70126
70127
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
70127
70128
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
70128
|
-
|
|
70129
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
|
|
70130
|
+
const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70131
|
+
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
|
|
70129
70132
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
70130
70133
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
70131
70134
|
// we don't want to say "could not find 'a'".
|
|
70132
|
-
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name,
|
|
70135
|
+
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
|
|
70133
70136
|
);
|
|
70134
70137
|
if (isInJavascript) {
|
|
70135
70138
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -70173,7 +70176,7 @@ ${lanes.join("\n")}
|
|
|
70173
70176
|
prop.links.target = member;
|
|
70174
70177
|
member = prop;
|
|
70175
70178
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
70176
|
-
if (
|
|
70179
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70177
70180
|
const inferenceContext = getInferenceContext(node);
|
|
70178
70181
|
Debug.assert(inferenceContext);
|
|
70179
70182
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -70332,7 +70335,7 @@ ${lanes.join("\n")}
|
|
|
70332
70335
|
function checkJsxAttribute(node, checkMode) {
|
|
70333
70336
|
return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType;
|
|
70334
70337
|
}
|
|
70335
|
-
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
70338
|
+
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode = 0 /* Normal */) {
|
|
70336
70339
|
const attributes = openingLikeElement.attributes;
|
|
70337
70340
|
const contextualType = getContextualType2(attributes, 0 /* None */);
|
|
70338
70341
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -70346,7 +70349,9 @@ ${lanes.join("\n")}
|
|
|
70346
70349
|
for (const attributeDecl of attributes.properties) {
|
|
70347
70350
|
const member = attributeDecl.symbol;
|
|
70348
70351
|
if (isJsxAttribute(attributeDecl)) {
|
|
70349
|
-
const
|
|
70352
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
|
|
70353
|
+
const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70354
|
+
const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
|
|
70350
70355
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
70351
70356
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
70352
70357
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -70367,7 +70372,7 @@ ${lanes.join("\n")}
|
|
|
70367
70372
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
70368
70373
|
}
|
|
70369
70374
|
}
|
|
70370
|
-
if (
|
|
70375
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70371
70376
|
const inferenceContext = getInferenceContext(attributes);
|
|
70372
70377
|
Debug.assert(inferenceContext);
|
|
70373
70378
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -71985,7 +71990,7 @@ ${lanes.join("\n")}
|
|
|
71985
71990
|
}
|
|
71986
71991
|
for (let i = 0; i < argCount; i++) {
|
|
71987
71992
|
const arg = args[i];
|
|
71988
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
71993
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
71989
71994
|
const paramType = getTypeAtPosition(signature, i);
|
|
71990
71995
|
if (couldContainTypeVariables(paramType)) {
|
|
71991
71996
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -72597,12 +72602,12 @@ ${lanes.join("\n")}
|
|
|
72597
72602
|
const args = getEffectiveCallArguments(node);
|
|
72598
72603
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
72599
72604
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
72600
|
-
argCheckMode |= checkMode &
|
|
72605
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72601
72606
|
let candidatesForArgumentError;
|
|
72602
72607
|
let candidateForArgumentArityError;
|
|
72603
72608
|
let candidateForTypeArgumentError;
|
|
72604
72609
|
let result;
|
|
72605
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
72610
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
72606
72611
|
if (candidates.length > 1) {
|
|
72607
72612
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
72608
72613
|
}
|
|
@@ -72821,7 +72826,7 @@ ${lanes.join("\n")}
|
|
|
72821
72826
|
continue;
|
|
72822
72827
|
}
|
|
72823
72828
|
if (argCheckMode) {
|
|
72824
|
-
argCheckMode = checkMode &
|
|
72829
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72825
72830
|
if (inferenceContext) {
|
|
72826
72831
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72827
72832
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -76232,15 +76237,11 @@ ${lanes.join("\n")}
|
|
|
76232
76237
|
texts.push(span.literal.text);
|
|
76233
76238
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
76234
76239
|
}
|
|
76235
|
-
|
|
76240
|
+
return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType2(
|
|
76236
76241
|
node,
|
|
76237
76242
|
/*contextFlags*/
|
|
76238
76243
|
void 0
|
|
76239
|
-
) || unknownType, isTemplateLiteralContextualType))
|
|
76240
|
-
return getTemplateLiteralType(texts, types);
|
|
76241
|
-
}
|
|
76242
|
-
const evaluated = node.parent.kind !== 214 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
|
|
76243
|
-
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
76244
|
+
) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
76244
76245
|
}
|
|
76245
76246
|
function isTemplateLiteralContextualType(type) {
|
|
76246
76247
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
@@ -79020,7 +79021,7 @@ ${lanes.join("\n")}
|
|
|
79020
79021
|
checkComputedPropertyName(node.propertyName);
|
|
79021
79022
|
}
|
|
79022
79023
|
const parent2 = node.parent.parent;
|
|
79023
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
79024
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
79024
79025
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
79025
79026
|
const name = node.propertyName || node.name;
|
|
79026
79027
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -81218,11 +81219,11 @@ ${lanes.join("\n")}
|
|
|
81218
81219
|
);
|
|
81219
81220
|
if (symbol) {
|
|
81220
81221
|
if (symbol.flags & 8 /* EnumMember */) {
|
|
81221
|
-
return
|
|
81222
|
+
return evaluateEnumMember(expr, symbol, location);
|
|
81222
81223
|
}
|
|
81223
81224
|
if (isConstVariable(symbol)) {
|
|
81224
81225
|
const declaration = symbol.valueDeclaration;
|
|
81225
|
-
if (declaration && !declaration.type && declaration.initializer &&
|
|
81226
|
+
if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
81226
81227
|
return evaluate(declaration.initializer, declaration);
|
|
81227
81228
|
}
|
|
81228
81229
|
}
|
|
@@ -81242,7 +81243,7 @@ ${lanes.join("\n")}
|
|
|
81242
81243
|
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
81243
81244
|
const member = rootSymbol.exports.get(name);
|
|
81244
81245
|
if (member) {
|
|
81245
|
-
return
|
|
81246
|
+
return evaluateEnumMember(expr, member, location);
|
|
81246
81247
|
}
|
|
81247
81248
|
}
|
|
81248
81249
|
}
|
|
@@ -85756,9 +85757,10 @@ ${lanes.join("\n")}
|
|
|
85756
85757
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
85757
85758
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
85758
85759
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
85759
|
-
CheckMode3[CheckMode3["
|
|
85760
|
-
CheckMode3[CheckMode3["
|
|
85761
|
-
CheckMode3[CheckMode3["
|
|
85760
|
+
CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
|
|
85761
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
|
|
85762
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
|
|
85763
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
|
|
85762
85764
|
return CheckMode3;
|
|
85763
85765
|
})(CheckMode || {});
|
|
85764
85766
|
SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.1";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20230508`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -28888,9 +28888,10 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
28888
28888
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
28889
28889
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
28890
28890
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
28891
|
-
CheckMode3[CheckMode3["
|
|
28892
|
-
CheckMode3[CheckMode3["
|
|
28893
|
-
CheckMode3[CheckMode3["
|
|
28891
|
+
CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
|
|
28892
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
|
|
28893
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
|
|
28894
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
|
|
28894
28895
|
return CheckMode3;
|
|
28895
28896
|
})(CheckMode || {});
|
|
28896
28897
|
var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.1.0-pr-
|
|
5
|
+
"version": "5.1.0-pr-54186-8",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"node": "14.21.1",
|
|
117
117
|
"npm": "8.19.3"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "f33e1707d43729412e05d7668707a136b46a5327"
|
|
120
120
|
}
|