@typescript-deploys/pr-build 5.1.0-pr-54112-28 → 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 -24
- package/lib/tsserver.js +36 -25
- package/lib/tsserverlibrary.js +36 -25
- package/lib/typescript.js +36 -25
- 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
|
}
|
|
@@ -53979,7 +53980,7 @@ function createTypeChecker(host) {
|
|
|
53979
53980
|
} else if (type !== firstType) {
|
|
53980
53981
|
checkFlags |= 64 /* HasNonUniformType */;
|
|
53981
53982
|
}
|
|
53982
|
-
if (isLiteralType(type) || isPatternLiteralType(type)) {
|
|
53983
|
+
if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
|
|
53983
53984
|
checkFlags |= 128 /* HasLiteralType */;
|
|
53984
53985
|
}
|
|
53985
53986
|
if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
|
|
@@ -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 */) {
|
|
@@ -67533,7 +67534,9 @@ function createTypeChecker(host) {
|
|
|
67533
67534
|
elementTypes.push(undefinedOrMissingType);
|
|
67534
67535
|
elementFlags.push(2 /* Optional */);
|
|
67535
67536
|
} else {
|
|
67536
|
-
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);
|
|
67537
67540
|
elementTypes.push(addOptionality(
|
|
67538
67541
|
type,
|
|
67539
67542
|
/*isProperty*/
|
|
@@ -67541,7 +67544,7 @@ function createTypeChecker(host) {
|
|
|
67541
67544
|
hasOmittedExpression
|
|
67542
67545
|
));
|
|
67543
67546
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
67544
|
-
if (
|
|
67547
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
67545
67548
|
const inferenceContext = getInferenceContext(node);
|
|
67546
67549
|
Debug.assert(inferenceContext);
|
|
67547
67550
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -67647,7 +67650,7 @@ function createTypeChecker(host) {
|
|
|
67647
67650
|
}
|
|
67648
67651
|
return links.immediateTarget;
|
|
67649
67652
|
}
|
|
67650
|
-
function checkObjectLiteral(node, checkMode) {
|
|
67653
|
+
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
67651
67654
|
var _a;
|
|
67652
67655
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
67653
67656
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
@@ -67682,11 +67685,13 @@ function createTypeChecker(host) {
|
|
|
67682
67685
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
67683
67686
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
67684
67687
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
67685
|
-
|
|
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) : (
|
|
67686
67691
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
67687
67692
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
67688
67693
|
// we don't want to say "could not find 'a'".
|
|
67689
|
-
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)
|
|
67690
67695
|
);
|
|
67691
67696
|
if (isInJavascript) {
|
|
67692
67697
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -67730,7 +67735,7 @@ function createTypeChecker(host) {
|
|
|
67730
67735
|
prop.links.target = member;
|
|
67731
67736
|
member = prop;
|
|
67732
67737
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
67733
|
-
if (
|
|
67738
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
67734
67739
|
const inferenceContext = getInferenceContext(node);
|
|
67735
67740
|
Debug.assert(inferenceContext);
|
|
67736
67741
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -67889,7 +67894,7 @@ function createTypeChecker(host) {
|
|
|
67889
67894
|
function checkJsxAttribute(node, checkMode) {
|
|
67890
67895
|
return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType;
|
|
67891
67896
|
}
|
|
67892
|
-
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
67897
|
+
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode = 0 /* Normal */) {
|
|
67893
67898
|
const attributes = openingLikeElement.attributes;
|
|
67894
67899
|
const contextualType = getContextualType(attributes, 0 /* None */);
|
|
67895
67900
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -67903,7 +67908,9 @@ function createTypeChecker(host) {
|
|
|
67903
67908
|
for (const attributeDecl of attributes.properties) {
|
|
67904
67909
|
const member = attributeDecl.symbol;
|
|
67905
67910
|
if (isJsxAttribute(attributeDecl)) {
|
|
67906
|
-
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);
|
|
67907
67914
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
67908
67915
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
67909
67916
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -67924,7 +67931,7 @@ function createTypeChecker(host) {
|
|
|
67924
67931
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
67925
67932
|
}
|
|
67926
67933
|
}
|
|
67927
|
-
if (
|
|
67934
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
67928
67935
|
const inferenceContext = getInferenceContext(attributes);
|
|
67929
67936
|
Debug.assert(inferenceContext);
|
|
67930
67937
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -69542,7 +69549,7 @@ function createTypeChecker(host) {
|
|
|
69542
69549
|
}
|
|
69543
69550
|
for (let i = 0; i < argCount; i++) {
|
|
69544
69551
|
const arg = args[i];
|
|
69545
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
69552
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
69546
69553
|
const paramType = getTypeAtPosition(signature, i);
|
|
69547
69554
|
if (couldContainTypeVariables(paramType)) {
|
|
69548
69555
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -70154,12 +70161,12 @@ function createTypeChecker(host) {
|
|
|
70154
70161
|
const args = getEffectiveCallArguments(node);
|
|
70155
70162
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
70156
70163
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
70157
|
-
argCheckMode |= checkMode &
|
|
70164
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
70158
70165
|
let candidatesForArgumentError;
|
|
70159
70166
|
let candidateForArgumentArityError;
|
|
70160
70167
|
let candidateForTypeArgumentError;
|
|
70161
70168
|
let result;
|
|
70162
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
70169
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
70163
70170
|
if (candidates.length > 1) {
|
|
70164
70171
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
70165
70172
|
}
|
|
@@ -70378,7 +70385,7 @@ function createTypeChecker(host) {
|
|
|
70378
70385
|
continue;
|
|
70379
70386
|
}
|
|
70380
70387
|
if (argCheckMode) {
|
|
70381
|
-
argCheckMode = checkMode &
|
|
70388
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
70382
70389
|
if (inferenceContext) {
|
|
70383
70390
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
70384
70391
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -72386,6 +72393,10 @@ function createTypeChecker(host) {
|
|
|
72386
72393
|
forEachReturnStatement(func.body, (returnStatement) => {
|
|
72387
72394
|
const expr = returnStatement.expression;
|
|
72388
72395
|
if (expr) {
|
|
72396
|
+
if (expr.kind === 212 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
|
|
72397
|
+
hasReturnOfTypeNever = true;
|
|
72398
|
+
return;
|
|
72399
|
+
}
|
|
72389
72400
|
let type = checkExpressionCached(expr, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
|
|
72390
72401
|
if (functionFlags & 2 /* Async */) {
|
|
72391
72402
|
type = unwrapAwaitedType(checkAwaitedType(
|
|
@@ -76569,7 +76580,7 @@ function createTypeChecker(host) {
|
|
|
76569
76580
|
checkComputedPropertyName(node.propertyName);
|
|
76570
76581
|
}
|
|
76571
76582
|
const parent = node.parent.parent;
|
|
76572
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
76583
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
76573
76584
|
const parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
76574
76585
|
const name = node.propertyName || node.name;
|
|
76575
76586
|
if (parentType && !isBindingPattern(name)) {
|
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
|
}
|
|
@@ -58629,7 +58630,7 @@ function createTypeChecker(host) {
|
|
|
58629
58630
|
} else if (type !== firstType) {
|
|
58630
58631
|
checkFlags |= 64 /* HasNonUniformType */;
|
|
58631
58632
|
}
|
|
58632
|
-
if (isLiteralType(type) || isPatternLiteralType(type)) {
|
|
58633
|
+
if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
|
|
58633
58634
|
checkFlags |= 128 /* HasLiteralType */;
|
|
58634
58635
|
}
|
|
58635
58636
|
if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
|
|
@@ -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 */) {
|
|
@@ -72183,7 +72184,9 @@ function createTypeChecker(host) {
|
|
|
72183
72184
|
elementTypes.push(undefinedOrMissingType);
|
|
72184
72185
|
elementFlags.push(2 /* Optional */);
|
|
72185
72186
|
} else {
|
|
72186
|
-
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);
|
|
72187
72190
|
elementTypes.push(addOptionality(
|
|
72188
72191
|
type,
|
|
72189
72192
|
/*isProperty*/
|
|
@@ -72191,7 +72194,7 @@ function createTypeChecker(host) {
|
|
|
72191
72194
|
hasOmittedExpression
|
|
72192
72195
|
));
|
|
72193
72196
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
72194
|
-
if (
|
|
72197
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
72195
72198
|
const inferenceContext = getInferenceContext(node);
|
|
72196
72199
|
Debug.assert(inferenceContext);
|
|
72197
72200
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -72297,7 +72300,7 @@ function createTypeChecker(host) {
|
|
|
72297
72300
|
}
|
|
72298
72301
|
return links.immediateTarget;
|
|
72299
72302
|
}
|
|
72300
|
-
function checkObjectLiteral(node, checkMode) {
|
|
72303
|
+
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
72301
72304
|
var _a;
|
|
72302
72305
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
72303
72306
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
@@ -72332,11 +72335,13 @@ function createTypeChecker(host) {
|
|
|
72332
72335
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
72333
72336
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
72334
72337
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
72335
|
-
|
|
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) : (
|
|
72336
72341
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
72337
72342
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
72338
72343
|
// we don't want to say "could not find 'a'".
|
|
72339
|
-
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)
|
|
72340
72345
|
);
|
|
72341
72346
|
if (isInJavascript) {
|
|
72342
72347
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -72380,7 +72385,7 @@ function createTypeChecker(host) {
|
|
|
72380
72385
|
prop.links.target = member;
|
|
72381
72386
|
member = prop;
|
|
72382
72387
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
72383
|
-
if (
|
|
72388
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
72384
72389
|
const inferenceContext = getInferenceContext(node);
|
|
72385
72390
|
Debug.assert(inferenceContext);
|
|
72386
72391
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -72539,7 +72544,7 @@ function createTypeChecker(host) {
|
|
|
72539
72544
|
function checkJsxAttribute(node, checkMode) {
|
|
72540
72545
|
return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType;
|
|
72541
72546
|
}
|
|
72542
|
-
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
72547
|
+
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode = 0 /* Normal */) {
|
|
72543
72548
|
const attributes = openingLikeElement.attributes;
|
|
72544
72549
|
const contextualType = getContextualType2(attributes, 0 /* None */);
|
|
72545
72550
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -72553,7 +72558,9 @@ function createTypeChecker(host) {
|
|
|
72553
72558
|
for (const attributeDecl of attributes.properties) {
|
|
72554
72559
|
const member = attributeDecl.symbol;
|
|
72555
72560
|
if (isJsxAttribute(attributeDecl)) {
|
|
72556
|
-
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);
|
|
72557
72564
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
72558
72565
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
72559
72566
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -72574,7 +72581,7 @@ function createTypeChecker(host) {
|
|
|
72574
72581
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
72575
72582
|
}
|
|
72576
72583
|
}
|
|
72577
|
-
if (
|
|
72584
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
72578
72585
|
const inferenceContext = getInferenceContext(attributes);
|
|
72579
72586
|
Debug.assert(inferenceContext);
|
|
72580
72587
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -74192,7 +74199,7 @@ function createTypeChecker(host) {
|
|
|
74192
74199
|
}
|
|
74193
74200
|
for (let i = 0; i < argCount; i++) {
|
|
74194
74201
|
const arg = args[i];
|
|
74195
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
74202
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
74196
74203
|
const paramType = getTypeAtPosition(signature, i);
|
|
74197
74204
|
if (couldContainTypeVariables(paramType)) {
|
|
74198
74205
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -74804,12 +74811,12 @@ function createTypeChecker(host) {
|
|
|
74804
74811
|
const args = getEffectiveCallArguments(node);
|
|
74805
74812
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
74806
74813
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
74807
|
-
argCheckMode |= checkMode &
|
|
74814
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
74808
74815
|
let candidatesForArgumentError;
|
|
74809
74816
|
let candidateForArgumentArityError;
|
|
74810
74817
|
let candidateForTypeArgumentError;
|
|
74811
74818
|
let result;
|
|
74812
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
74819
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
74813
74820
|
if (candidates.length > 1) {
|
|
74814
74821
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
74815
74822
|
}
|
|
@@ -75028,7 +75035,7 @@ function createTypeChecker(host) {
|
|
|
75028
75035
|
continue;
|
|
75029
75036
|
}
|
|
75030
75037
|
if (argCheckMode) {
|
|
75031
|
-
argCheckMode = checkMode &
|
|
75038
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
75032
75039
|
if (inferenceContext) {
|
|
75033
75040
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
75034
75041
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -77036,6 +77043,10 @@ function createTypeChecker(host) {
|
|
|
77036
77043
|
forEachReturnStatement(func.body, (returnStatement) => {
|
|
77037
77044
|
const expr = returnStatement.expression;
|
|
77038
77045
|
if (expr) {
|
|
77046
|
+
if (expr.kind === 212 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
|
|
77047
|
+
hasReturnOfTypeNever = true;
|
|
77048
|
+
return;
|
|
77049
|
+
}
|
|
77039
77050
|
let type = checkExpressionCached(expr, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
|
|
77040
77051
|
if (functionFlags & 2 /* Async */) {
|
|
77041
77052
|
type = unwrapAwaitedType(checkAwaitedType(
|
|
@@ -81219,7 +81230,7 @@ function createTypeChecker(host) {
|
|
|
81219
81230
|
checkComputedPropertyName(node.propertyName);
|
|
81220
81231
|
}
|
|
81221
81232
|
const parent2 = node.parent.parent;
|
|
81222
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
81233
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
81223
81234
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
81224
81235
|
const name = node.propertyName || node.name;
|
|
81225
81236
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -165063,7 +165074,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
|
|
|
165063
165074
|
displayParts.push(spacePart());
|
|
165064
165075
|
displayParts.push(operatorPart(64 /* EqualsToken */));
|
|
165065
165076
|
displayParts.push(spacePart());
|
|
165066
|
-
addRange(displayParts, typeToDisplayParts(typeChecker, isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
|
|
165077
|
+
addRange(displayParts, typeToDisplayParts(typeChecker, location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
|
|
165067
165078
|
}
|
|
165068
165079
|
if (symbolFlags & 384 /* Enum */) {
|
|
165069
165080
|
prefixNextMeaning();
|
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
|
}
|
|
@@ -56421,7 +56421,7 @@ ${lanes.join("\n")}
|
|
|
56421
56421
|
} else if (type !== firstType) {
|
|
56422
56422
|
checkFlags |= 64 /* HasNonUniformType */;
|
|
56423
56423
|
}
|
|
56424
|
-
if (isLiteralType(type) || isPatternLiteralType(type)) {
|
|
56424
|
+
if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
|
|
56425
56425
|
checkFlags |= 128 /* HasLiteralType */;
|
|
56426
56426
|
}
|
|
56427
56427
|
if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
|
|
@@ -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 */) {
|
|
@@ -69975,7 +69975,9 @@ ${lanes.join("\n")}
|
|
|
69975
69975
|
elementTypes.push(undefinedOrMissingType);
|
|
69976
69976
|
elementFlags.push(2 /* Optional */);
|
|
69977
69977
|
} else {
|
|
69978
|
-
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);
|
|
69979
69981
|
elementTypes.push(addOptionality(
|
|
69980
69982
|
type,
|
|
69981
69983
|
/*isProperty*/
|
|
@@ -69983,7 +69985,7 @@ ${lanes.join("\n")}
|
|
|
69983
69985
|
hasOmittedExpression
|
|
69984
69986
|
));
|
|
69985
69987
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
69986
|
-
if (
|
|
69988
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
69987
69989
|
const inferenceContext = getInferenceContext(node);
|
|
69988
69990
|
Debug.assert(inferenceContext);
|
|
69989
69991
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -70089,7 +70091,7 @@ ${lanes.join("\n")}
|
|
|
70089
70091
|
}
|
|
70090
70092
|
return links.immediateTarget;
|
|
70091
70093
|
}
|
|
70092
|
-
function checkObjectLiteral(node, checkMode) {
|
|
70094
|
+
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
70093
70095
|
var _a;
|
|
70094
70096
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
70095
70097
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
@@ -70124,11 +70126,13 @@ ${lanes.join("\n")}
|
|
|
70124
70126
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
70125
70127
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
70126
70128
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
70127
|
-
|
|
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) : (
|
|
70128
70132
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
70129
70133
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
70130
70134
|
// we don't want to say "could not find 'a'".
|
|
70131
|
-
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)
|
|
70132
70136
|
);
|
|
70133
70137
|
if (isInJavascript) {
|
|
70134
70138
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -70172,7 +70176,7 @@ ${lanes.join("\n")}
|
|
|
70172
70176
|
prop.links.target = member;
|
|
70173
70177
|
member = prop;
|
|
70174
70178
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
70175
|
-
if (
|
|
70179
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70176
70180
|
const inferenceContext = getInferenceContext(node);
|
|
70177
70181
|
Debug.assert(inferenceContext);
|
|
70178
70182
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -70331,7 +70335,7 @@ ${lanes.join("\n")}
|
|
|
70331
70335
|
function checkJsxAttribute(node, checkMode) {
|
|
70332
70336
|
return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType;
|
|
70333
70337
|
}
|
|
70334
|
-
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
70338
|
+
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode = 0 /* Normal */) {
|
|
70335
70339
|
const attributes = openingLikeElement.attributes;
|
|
70336
70340
|
const contextualType = getContextualType2(attributes, 0 /* None */);
|
|
70337
70341
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -70345,7 +70349,9 @@ ${lanes.join("\n")}
|
|
|
70345
70349
|
for (const attributeDecl of attributes.properties) {
|
|
70346
70350
|
const member = attributeDecl.symbol;
|
|
70347
70351
|
if (isJsxAttribute(attributeDecl)) {
|
|
70348
|
-
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);
|
|
70349
70355
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
70350
70356
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
70351
70357
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -70366,7 +70372,7 @@ ${lanes.join("\n")}
|
|
|
70366
70372
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
70367
70373
|
}
|
|
70368
70374
|
}
|
|
70369
|
-
if (
|
|
70375
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70370
70376
|
const inferenceContext = getInferenceContext(attributes);
|
|
70371
70377
|
Debug.assert(inferenceContext);
|
|
70372
70378
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -71984,7 +71990,7 @@ ${lanes.join("\n")}
|
|
|
71984
71990
|
}
|
|
71985
71991
|
for (let i = 0; i < argCount; i++) {
|
|
71986
71992
|
const arg = args[i];
|
|
71987
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
71993
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
71988
71994
|
const paramType = getTypeAtPosition(signature, i);
|
|
71989
71995
|
if (couldContainTypeVariables(paramType)) {
|
|
71990
71996
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -72596,12 +72602,12 @@ ${lanes.join("\n")}
|
|
|
72596
72602
|
const args = getEffectiveCallArguments(node);
|
|
72597
72603
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
72598
72604
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
72599
|
-
argCheckMode |= checkMode &
|
|
72605
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72600
72606
|
let candidatesForArgumentError;
|
|
72601
72607
|
let candidateForArgumentArityError;
|
|
72602
72608
|
let candidateForTypeArgumentError;
|
|
72603
72609
|
let result;
|
|
72604
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
72610
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
72605
72611
|
if (candidates.length > 1) {
|
|
72606
72612
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
72607
72613
|
}
|
|
@@ -72820,7 +72826,7 @@ ${lanes.join("\n")}
|
|
|
72820
72826
|
continue;
|
|
72821
72827
|
}
|
|
72822
72828
|
if (argCheckMode) {
|
|
72823
|
-
argCheckMode = checkMode &
|
|
72829
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72824
72830
|
if (inferenceContext) {
|
|
72825
72831
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72826
72832
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -74828,6 +74834,10 @@ ${lanes.join("\n")}
|
|
|
74828
74834
|
forEachReturnStatement(func.body, (returnStatement) => {
|
|
74829
74835
|
const expr = returnStatement.expression;
|
|
74830
74836
|
if (expr) {
|
|
74837
|
+
if (expr.kind === 212 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
|
|
74838
|
+
hasReturnOfTypeNever = true;
|
|
74839
|
+
return;
|
|
74840
|
+
}
|
|
74831
74841
|
let type = checkExpressionCached(expr, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
|
|
74832
74842
|
if (functionFlags & 2 /* Async */) {
|
|
74833
74843
|
type = unwrapAwaitedType(checkAwaitedType(
|
|
@@ -79011,7 +79021,7 @@ ${lanes.join("\n")}
|
|
|
79011
79021
|
checkComputedPropertyName(node.propertyName);
|
|
79012
79022
|
}
|
|
79013
79023
|
const parent2 = node.parent.parent;
|
|
79014
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
79024
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
79015
79025
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
79016
79026
|
const name = node.propertyName || node.name;
|
|
79017
79027
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -85747,9 +85757,10 @@ ${lanes.join("\n")}
|
|
|
85747
85757
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
85748
85758
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
85749
85759
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
85750
|
-
CheckMode3[CheckMode3["
|
|
85751
|
-
CheckMode3[CheckMode3["
|
|
85752
|
-
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";
|
|
85753
85764
|
return CheckMode3;
|
|
85754
85765
|
})(CheckMode || {});
|
|
85755
85766
|
SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -164503,7 +164514,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164503
164514
|
displayParts.push(spacePart());
|
|
164504
164515
|
displayParts.push(operatorPart(64 /* EqualsToken */));
|
|
164505
164516
|
displayParts.push(spacePart());
|
|
164506
|
-
addRange(displayParts, typeToDisplayParts(typeChecker, isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
|
|
164517
|
+
addRange(displayParts, typeToDisplayParts(typeChecker, location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
|
|
164507
164518
|
}
|
|
164508
164519
|
if (symbolFlags & 384 /* Enum */) {
|
|
164509
164520
|
prefixNextMeaning();
|
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
|
}
|
|
@@ -56421,7 +56421,7 @@ ${lanes.join("\n")}
|
|
|
56421
56421
|
} else if (type !== firstType) {
|
|
56422
56422
|
checkFlags |= 64 /* HasNonUniformType */;
|
|
56423
56423
|
}
|
|
56424
|
-
if (isLiteralType(type) || isPatternLiteralType(type)) {
|
|
56424
|
+
if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
|
|
56425
56425
|
checkFlags |= 128 /* HasLiteralType */;
|
|
56426
56426
|
}
|
|
56427
56427
|
if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
|
|
@@ -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 */) {
|
|
@@ -69975,7 +69975,9 @@ ${lanes.join("\n")}
|
|
|
69975
69975
|
elementTypes.push(undefinedOrMissingType);
|
|
69976
69976
|
elementFlags.push(2 /* Optional */);
|
|
69977
69977
|
} else {
|
|
69978
|
-
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);
|
|
69979
69981
|
elementTypes.push(addOptionality(
|
|
69980
69982
|
type,
|
|
69981
69983
|
/*isProperty*/
|
|
@@ -69983,7 +69985,7 @@ ${lanes.join("\n")}
|
|
|
69983
69985
|
hasOmittedExpression
|
|
69984
69986
|
));
|
|
69985
69987
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
69986
|
-
if (
|
|
69988
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
69987
69989
|
const inferenceContext = getInferenceContext(node);
|
|
69988
69990
|
Debug.assert(inferenceContext);
|
|
69989
69991
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -70089,7 +70091,7 @@ ${lanes.join("\n")}
|
|
|
70089
70091
|
}
|
|
70090
70092
|
return links.immediateTarget;
|
|
70091
70093
|
}
|
|
70092
|
-
function checkObjectLiteral(node, checkMode) {
|
|
70094
|
+
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
70093
70095
|
var _a;
|
|
70094
70096
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
70095
70097
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
@@ -70124,11 +70126,13 @@ ${lanes.join("\n")}
|
|
|
70124
70126
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
70125
70127
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
70126
70128
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
70127
|
-
|
|
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) : (
|
|
70128
70132
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
70129
70133
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
70130
70134
|
// we don't want to say "could not find 'a'".
|
|
70131
|
-
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)
|
|
70132
70136
|
);
|
|
70133
70137
|
if (isInJavascript) {
|
|
70134
70138
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -70172,7 +70176,7 @@ ${lanes.join("\n")}
|
|
|
70172
70176
|
prop.links.target = member;
|
|
70173
70177
|
member = prop;
|
|
70174
70178
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
70175
|
-
if (
|
|
70179
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70176
70180
|
const inferenceContext = getInferenceContext(node);
|
|
70177
70181
|
Debug.assert(inferenceContext);
|
|
70178
70182
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -70331,7 +70335,7 @@ ${lanes.join("\n")}
|
|
|
70331
70335
|
function checkJsxAttribute(node, checkMode) {
|
|
70332
70336
|
return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType;
|
|
70333
70337
|
}
|
|
70334
|
-
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
70338
|
+
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode = 0 /* Normal */) {
|
|
70335
70339
|
const attributes = openingLikeElement.attributes;
|
|
70336
70340
|
const contextualType = getContextualType2(attributes, 0 /* None */);
|
|
70337
70341
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -70345,7 +70349,9 @@ ${lanes.join("\n")}
|
|
|
70345
70349
|
for (const attributeDecl of attributes.properties) {
|
|
70346
70350
|
const member = attributeDecl.symbol;
|
|
70347
70351
|
if (isJsxAttribute(attributeDecl)) {
|
|
70348
|
-
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);
|
|
70349
70355
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
70350
70356
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
70351
70357
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -70366,7 +70372,7 @@ ${lanes.join("\n")}
|
|
|
70366
70372
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
70367
70373
|
}
|
|
70368
70374
|
}
|
|
70369
|
-
if (
|
|
70375
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70370
70376
|
const inferenceContext = getInferenceContext(attributes);
|
|
70371
70377
|
Debug.assert(inferenceContext);
|
|
70372
70378
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -71984,7 +71990,7 @@ ${lanes.join("\n")}
|
|
|
71984
71990
|
}
|
|
71985
71991
|
for (let i = 0; i < argCount; i++) {
|
|
71986
71992
|
const arg = args[i];
|
|
71987
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
71993
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
71988
71994
|
const paramType = getTypeAtPosition(signature, i);
|
|
71989
71995
|
if (couldContainTypeVariables(paramType)) {
|
|
71990
71996
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -72596,12 +72602,12 @@ ${lanes.join("\n")}
|
|
|
72596
72602
|
const args = getEffectiveCallArguments(node);
|
|
72597
72603
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
72598
72604
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
72599
|
-
argCheckMode |= checkMode &
|
|
72605
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72600
72606
|
let candidatesForArgumentError;
|
|
72601
72607
|
let candidateForArgumentArityError;
|
|
72602
72608
|
let candidateForTypeArgumentError;
|
|
72603
72609
|
let result;
|
|
72604
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
72610
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
72605
72611
|
if (candidates.length > 1) {
|
|
72606
72612
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
72607
72613
|
}
|
|
@@ -72820,7 +72826,7 @@ ${lanes.join("\n")}
|
|
|
72820
72826
|
continue;
|
|
72821
72827
|
}
|
|
72822
72828
|
if (argCheckMode) {
|
|
72823
|
-
argCheckMode = checkMode &
|
|
72829
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72824
72830
|
if (inferenceContext) {
|
|
72825
72831
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72826
72832
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -74828,6 +74834,10 @@ ${lanes.join("\n")}
|
|
|
74828
74834
|
forEachReturnStatement(func.body, (returnStatement) => {
|
|
74829
74835
|
const expr = returnStatement.expression;
|
|
74830
74836
|
if (expr) {
|
|
74837
|
+
if (expr.kind === 212 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
|
|
74838
|
+
hasReturnOfTypeNever = true;
|
|
74839
|
+
return;
|
|
74840
|
+
}
|
|
74831
74841
|
let type = checkExpressionCached(expr, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
|
|
74832
74842
|
if (functionFlags & 2 /* Async */) {
|
|
74833
74843
|
type = unwrapAwaitedType(checkAwaitedType(
|
|
@@ -79011,7 +79021,7 @@ ${lanes.join("\n")}
|
|
|
79011
79021
|
checkComputedPropertyName(node.propertyName);
|
|
79012
79022
|
}
|
|
79013
79023
|
const parent2 = node.parent.parent;
|
|
79014
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
79024
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
79015
79025
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
79016
79026
|
const name = node.propertyName || node.name;
|
|
79017
79027
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -85747,9 +85757,10 @@ ${lanes.join("\n")}
|
|
|
85747
85757
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
85748
85758
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
85749
85759
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
85750
|
-
CheckMode3[CheckMode3["
|
|
85751
|
-
CheckMode3[CheckMode3["
|
|
85752
|
-
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";
|
|
85753
85764
|
return CheckMode3;
|
|
85754
85765
|
})(CheckMode || {});
|
|
85755
85766
|
SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -164518,7 +164529,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164518
164529
|
displayParts.push(spacePart());
|
|
164519
164530
|
displayParts.push(operatorPart(64 /* EqualsToken */));
|
|
164520
164531
|
displayParts.push(spacePart());
|
|
164521
|
-
addRange(displayParts, typeToDisplayParts(typeChecker, isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
|
|
164532
|
+
addRange(displayParts, typeToDisplayParts(typeChecker, location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
|
|
164522
164533
|
}
|
|
164523
164534
|
if (symbolFlags & 384 /* Enum */) {
|
|
164524
164535
|
prefixNextMeaning();
|
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
|
}
|