@typescript-deploys/pr-build 5.2.0-pr-54503-2 → 5.2.0-pr-54536-13
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 +41 -39
- package/lib/tsserver.js +59 -52
- package/lib/tsserverlibrary.js +59 -52
- package/lib/typescript.js +59 -52
- package/lib/typingsInstaller.js +6 -5
- 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.2";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230605`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -42658,10 +42658,11 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
42658
42658
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
42659
42659
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
42660
42660
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
42661
|
-
CheckMode3[CheckMode3["
|
|
42662
|
-
CheckMode3[CheckMode3["
|
|
42663
|
-
CheckMode3[CheckMode3["
|
|
42664
|
-
CheckMode3[CheckMode3["
|
|
42661
|
+
CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
|
|
42662
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
|
|
42663
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
|
|
42664
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
|
|
42665
|
+
CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
|
|
42665
42666
|
return CheckMode3;
|
|
42666
42667
|
})(CheckMode || {});
|
|
42667
42668
|
var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -42941,9 +42942,9 @@ function createTypeChecker(host) {
|
|
|
42941
42942
|
candidatesOutArray,
|
|
42942
42943
|
/*argumentCount*/
|
|
42943
42944
|
void 0,
|
|
42944
|
-
|
|
42945
|
+
64 /* IsForStringLiteralArgumentCompletions */
|
|
42945
42946
|
)),
|
|
42946
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount,
|
|
42947
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
|
|
42947
42948
|
getExpandedParameters,
|
|
42948
42949
|
hasEffectiveRestParameter,
|
|
42949
42950
|
containsArgumentsReference,
|
|
@@ -50898,7 +50899,7 @@ function createTypeChecker(host) {
|
|
|
50898
50899
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
50899
50900
|
}
|
|
50900
50901
|
function getTypeForBindingElement(declaration) {
|
|
50901
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
50902
|
+
const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
50902
50903
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
50903
50904
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
50904
50905
|
}
|
|
@@ -52655,19 +52656,13 @@ function createTypeChecker(host) {
|
|
|
52655
52656
|
if (getObjectFlags(type) & 4 /* Reference */) {
|
|
52656
52657
|
const target = type.target;
|
|
52657
52658
|
const typeArguments = getTypeArguments(type);
|
|
52658
|
-
|
|
52659
|
-
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
|
|
52660
|
-
return needApparentType ? getApparentType(ref) : ref;
|
|
52661
|
-
}
|
|
52659
|
+
return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
|
|
52662
52660
|
} else if (type.flags & 2097152 /* Intersection */) {
|
|
52663
52661
|
const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
|
|
52664
52662
|
return types !== type.types ? getIntersectionType(types) : type;
|
|
52665
52663
|
}
|
|
52666
52664
|
return needApparentType ? getApparentType(type) : type;
|
|
52667
52665
|
}
|
|
52668
|
-
function getThisArgument(type) {
|
|
52669
|
-
return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
|
|
52670
|
-
}
|
|
52671
52666
|
function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
|
|
52672
52667
|
let mapper;
|
|
52673
52668
|
let members;
|
|
@@ -53733,7 +53728,7 @@ function createTypeChecker(host) {
|
|
|
53733
53728
|
return type.resolvedBaseConstraint;
|
|
53734
53729
|
}
|
|
53735
53730
|
const stack = [];
|
|
53736
|
-
return type.resolvedBaseConstraint =
|
|
53731
|
+
return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
|
|
53737
53732
|
function getImmediateBaseConstraint(t) {
|
|
53738
53733
|
if (!t.immediateBaseConstraint) {
|
|
53739
53734
|
if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
|
|
@@ -53825,18 +53820,18 @@ function createTypeChecker(host) {
|
|
|
53825
53820
|
}
|
|
53826
53821
|
if (isGenericTupleType(t)) {
|
|
53827
53822
|
const newElements = map(getElementTypes(t), (v, i) => {
|
|
53828
|
-
const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
53829
|
-
return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
53823
|
+
const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
53824
|
+
return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
53830
53825
|
});
|
|
53831
53826
|
return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
|
|
53832
53827
|
}
|
|
53833
53828
|
return t;
|
|
53834
53829
|
}
|
|
53835
53830
|
}
|
|
53836
|
-
function getApparentTypeOfIntersectionType(type) {
|
|
53831
|
+
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
53837
53832
|
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
53838
53833
|
type,
|
|
53839
|
-
|
|
53834
|
+
thisArgument,
|
|
53840
53835
|
/*needApparentType*/
|
|
53841
53836
|
true
|
|
53842
53837
|
));
|
|
@@ -53887,8 +53882,9 @@ function createTypeChecker(host) {
|
|
|
53887
53882
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
53888
53883
|
}
|
|
53889
53884
|
function getApparentType(type) {
|
|
53890
|
-
const t =
|
|
53891
|
-
|
|
53885
|
+
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
53886
|
+
const objectFlags = getObjectFlags(t);
|
|
53887
|
+
return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
53892
53888
|
}
|
|
53893
53889
|
function getReducedApparentType(type) {
|
|
53894
53890
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
@@ -60709,7 +60705,7 @@ function createTypeChecker(host) {
|
|
|
60709
60705
|
return 3 /* Maybe */;
|
|
60710
60706
|
}
|
|
60711
60707
|
const c = target2;
|
|
60712
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
60708
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
|
|
60713
60709
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
60714
60710
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
60715
60711
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -65795,7 +65791,7 @@ function createTypeChecker(host) {
|
|
|
65795
65791
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
65796
65792
|
}
|
|
65797
65793
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
65798
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
65794
|
+
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(
|
|
65799
65795
|
node,
|
|
65800
65796
|
/*contextFlags*/
|
|
65801
65797
|
void 0
|
|
@@ -66552,7 +66548,7 @@ function createTypeChecker(host) {
|
|
|
66552
66548
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
66553
66549
|
const parent = declaration.parent.parent;
|
|
66554
66550
|
const name = declaration.propertyName || declaration.name;
|
|
66555
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 207 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ?
|
|
66551
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 207 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
|
|
66556
66552
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
66557
66553
|
return void 0;
|
|
66558
66554
|
if (parent.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -67601,7 +67597,9 @@ function createTypeChecker(host) {
|
|
|
67601
67597
|
elementTypes.push(undefinedOrMissingType);
|
|
67602
67598
|
elementFlags.push(2 /* Optional */);
|
|
67603
67599
|
} else {
|
|
67604
|
-
const
|
|
67600
|
+
const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
|
|
67601
|
+
const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
67602
|
+
const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
|
|
67605
67603
|
elementTypes.push(addOptionality(
|
|
67606
67604
|
type,
|
|
67607
67605
|
/*isProperty*/
|
|
@@ -67609,7 +67607,7 @@ function createTypeChecker(host) {
|
|
|
67609
67607
|
hasOmittedExpression
|
|
67610
67608
|
));
|
|
67611
67609
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
67612
|
-
if (
|
|
67610
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
67613
67611
|
const inferenceContext = getInferenceContext(node);
|
|
67614
67612
|
Debug.assert(inferenceContext);
|
|
67615
67613
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -67750,11 +67748,13 @@ function createTypeChecker(host) {
|
|
|
67750
67748
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
67751
67749
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
67752
67750
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
67753
|
-
|
|
67751
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
|
|
67752
|
+
const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
67753
|
+
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
|
|
67754
67754
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
67755
67755
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
67756
67756
|
// we don't want to say "could not find 'a'".
|
|
67757
|
-
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name,
|
|
67757
|
+
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
|
|
67758
67758
|
);
|
|
67759
67759
|
if (isInJavascript) {
|
|
67760
67760
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -67798,7 +67798,7 @@ function createTypeChecker(host) {
|
|
|
67798
67798
|
prop.links.target = member;
|
|
67799
67799
|
member = prop;
|
|
67800
67800
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
67801
|
-
if (
|
|
67801
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
67802
67802
|
const inferenceContext = getInferenceContext(node);
|
|
67803
67803
|
Debug.assert(inferenceContext);
|
|
67804
67804
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -67971,7 +67971,9 @@ function createTypeChecker(host) {
|
|
|
67971
67971
|
for (const attributeDecl of attributes.properties) {
|
|
67972
67972
|
const member = attributeDecl.symbol;
|
|
67973
67973
|
if (isJsxAttribute(attributeDecl)) {
|
|
67974
|
-
const
|
|
67974
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
|
|
67975
|
+
const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
67976
|
+
const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
|
|
67975
67977
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
67976
67978
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
67977
67979
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -67992,7 +67994,7 @@ function createTypeChecker(host) {
|
|
|
67992
67994
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
67993
67995
|
}
|
|
67994
67996
|
}
|
|
67995
|
-
if (
|
|
67997
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
67996
67998
|
const inferenceContext = getInferenceContext(attributes);
|
|
67997
67999
|
Debug.assert(inferenceContext);
|
|
67998
68000
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -69610,7 +69612,7 @@ function createTypeChecker(host) {
|
|
|
69610
69612
|
}
|
|
69611
69613
|
for (let i = 0; i < argCount; i++) {
|
|
69612
69614
|
const arg = args[i];
|
|
69613
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
69615
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
69614
69616
|
const paramType = getTypeAtPosition(signature, i);
|
|
69615
69617
|
if (couldContainTypeVariables(paramType)) {
|
|
69616
69618
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -70223,12 +70225,12 @@ function createTypeChecker(host) {
|
|
|
70223
70225
|
const args = getEffectiveCallArguments(node);
|
|
70224
70226
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
70225
70227
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
70226
|
-
argCheckMode |= checkMode &
|
|
70228
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
70227
70229
|
let candidatesForArgumentError;
|
|
70228
70230
|
let candidateForArgumentArityError;
|
|
70229
70231
|
let candidateForTypeArgumentError;
|
|
70230
70232
|
let result;
|
|
70231
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
70233
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
70232
70234
|
if (candidates.length > 1) {
|
|
70233
70235
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
70234
70236
|
}
|
|
@@ -70447,7 +70449,7 @@ function createTypeChecker(host) {
|
|
|
70447
70449
|
continue;
|
|
70448
70450
|
}
|
|
70449
70451
|
if (argCheckMode) {
|
|
70450
|
-
argCheckMode = checkMode &
|
|
70452
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
70451
70453
|
if (inferenceContext) {
|
|
70452
70454
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
70453
70455
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -73525,7 +73527,7 @@ function createTypeChecker(host) {
|
|
|
73525
73527
|
case 36 /* ExclamationEqualsToken */:
|
|
73526
73528
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
73527
73529
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
73528
|
-
if (!(checkMode && checkMode &
|
|
73530
|
+
if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
|
|
73529
73531
|
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
73530
73532
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
73531
73533
|
error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
@@ -74184,7 +74186,7 @@ function createTypeChecker(host) {
|
|
|
74184
74186
|
}
|
|
74185
74187
|
}
|
|
74186
74188
|
const startInvocationCount = flowInvocationCount;
|
|
74187
|
-
const type = checkExpression(node,
|
|
74189
|
+
const type = checkExpression(node, 256 /* TypeOnly */);
|
|
74188
74190
|
if (flowInvocationCount !== startInvocationCount) {
|
|
74189
74191
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
74190
74192
|
cache[getNodeId(node)] = type;
|
|
@@ -76655,7 +76657,7 @@ function createTypeChecker(host) {
|
|
|
76655
76657
|
checkComputedPropertyName(node.propertyName);
|
|
76656
76658
|
}
|
|
76657
76659
|
const parent = node.parent.parent;
|
|
76658
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
76660
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
76659
76661
|
const parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
76660
76662
|
const name = node.propertyName || node.name;
|
|
76661
76663
|
if (parentType && !isBindingPattern(name)) {
|
package/lib/tsserver.js
CHANGED
|
@@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2304
2304
|
|
|
2305
2305
|
// src/compiler/corePublic.ts
|
|
2306
2306
|
var versionMajorMinor = "5.2";
|
|
2307
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2307
|
+
var version = `${versionMajorMinor}.0-insiders.20230605`;
|
|
2308
2308
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2309
2309
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2310
2310
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -47309,10 +47309,11 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
47309
47309
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
47310
47310
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
47311
47311
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
47312
|
-
CheckMode3[CheckMode3["
|
|
47313
|
-
CheckMode3[CheckMode3["
|
|
47314
|
-
CheckMode3[CheckMode3["
|
|
47315
|
-
CheckMode3[CheckMode3["
|
|
47312
|
+
CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
|
|
47313
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
|
|
47314
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
|
|
47315
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
|
|
47316
|
+
CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
|
|
47316
47317
|
return CheckMode3;
|
|
47317
47318
|
})(CheckMode || {});
|
|
47318
47319
|
var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -47592,9 +47593,9 @@ function createTypeChecker(host) {
|
|
|
47592
47593
|
candidatesOutArray,
|
|
47593
47594
|
/*argumentCount*/
|
|
47594
47595
|
void 0,
|
|
47595
|
-
|
|
47596
|
+
64 /* IsForStringLiteralArgumentCompletions */
|
|
47596
47597
|
)),
|
|
47597
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount,
|
|
47598
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
|
|
47598
47599
|
getExpandedParameters,
|
|
47599
47600
|
hasEffectiveRestParameter,
|
|
47600
47601
|
containsArgumentsReference,
|
|
@@ -55549,7 +55550,7 @@ function createTypeChecker(host) {
|
|
|
55549
55550
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
55550
55551
|
}
|
|
55551
55552
|
function getTypeForBindingElement(declaration) {
|
|
55552
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
55553
|
+
const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
55553
55554
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
55554
55555
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
55555
55556
|
}
|
|
@@ -57306,19 +57307,13 @@ function createTypeChecker(host) {
|
|
|
57306
57307
|
if (getObjectFlags(type) & 4 /* Reference */) {
|
|
57307
57308
|
const target = type.target;
|
|
57308
57309
|
const typeArguments = getTypeArguments(type);
|
|
57309
|
-
|
|
57310
|
-
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
|
|
57311
|
-
return needApparentType ? getApparentType(ref) : ref;
|
|
57312
|
-
}
|
|
57310
|
+
return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
|
|
57313
57311
|
} else if (type.flags & 2097152 /* Intersection */) {
|
|
57314
57312
|
const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
|
|
57315
57313
|
return types !== type.types ? getIntersectionType(types) : type;
|
|
57316
57314
|
}
|
|
57317
57315
|
return needApparentType ? getApparentType(type) : type;
|
|
57318
57316
|
}
|
|
57319
|
-
function getThisArgument(type) {
|
|
57320
|
-
return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
|
|
57321
|
-
}
|
|
57322
57317
|
function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
|
|
57323
57318
|
let mapper;
|
|
57324
57319
|
let members;
|
|
@@ -58384,7 +58379,7 @@ function createTypeChecker(host) {
|
|
|
58384
58379
|
return type.resolvedBaseConstraint;
|
|
58385
58380
|
}
|
|
58386
58381
|
const stack = [];
|
|
58387
|
-
return type.resolvedBaseConstraint =
|
|
58382
|
+
return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
|
|
58388
58383
|
function getImmediateBaseConstraint(t) {
|
|
58389
58384
|
if (!t.immediateBaseConstraint) {
|
|
58390
58385
|
if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
|
|
@@ -58476,18 +58471,18 @@ function createTypeChecker(host) {
|
|
|
58476
58471
|
}
|
|
58477
58472
|
if (isGenericTupleType(t)) {
|
|
58478
58473
|
const newElements = map(getElementTypes(t), (v, i) => {
|
|
58479
|
-
const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
58480
|
-
return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
58474
|
+
const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
58475
|
+
return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
58481
58476
|
});
|
|
58482
58477
|
return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
|
|
58483
58478
|
}
|
|
58484
58479
|
return t;
|
|
58485
58480
|
}
|
|
58486
58481
|
}
|
|
58487
|
-
function getApparentTypeOfIntersectionType(type) {
|
|
58482
|
+
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
58488
58483
|
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
58489
58484
|
type,
|
|
58490
|
-
|
|
58485
|
+
thisArgument,
|
|
58491
58486
|
/*needApparentType*/
|
|
58492
58487
|
true
|
|
58493
58488
|
));
|
|
@@ -58538,8 +58533,9 @@ function createTypeChecker(host) {
|
|
|
58538
58533
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
58539
58534
|
}
|
|
58540
58535
|
function getApparentType(type) {
|
|
58541
|
-
const t =
|
|
58542
|
-
|
|
58536
|
+
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
58537
|
+
const objectFlags = getObjectFlags(t);
|
|
58538
|
+
return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
58543
58539
|
}
|
|
58544
58540
|
function getReducedApparentType(type) {
|
|
58545
58541
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
@@ -65360,7 +65356,7 @@ function createTypeChecker(host) {
|
|
|
65360
65356
|
return 3 /* Maybe */;
|
|
65361
65357
|
}
|
|
65362
65358
|
const c = target2;
|
|
65363
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
65359
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
|
|
65364
65360
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
65365
65361
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
65366
65362
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -70446,7 +70442,7 @@ function createTypeChecker(host) {
|
|
|
70446
70442
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
70447
70443
|
}
|
|
70448
70444
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
70449
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
70445
|
+
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 128 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
|
|
70450
70446
|
node,
|
|
70451
70447
|
/*contextFlags*/
|
|
70452
70448
|
void 0
|
|
@@ -71203,7 +71199,7 @@ function createTypeChecker(host) {
|
|
|
71203
71199
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
71204
71200
|
const parent2 = declaration.parent.parent;
|
|
71205
71201
|
const name = declaration.propertyName || declaration.name;
|
|
71206
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ?
|
|
71202
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
|
|
71207
71203
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
71208
71204
|
return void 0;
|
|
71209
71205
|
if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -72252,7 +72248,9 @@ function createTypeChecker(host) {
|
|
|
72252
72248
|
elementTypes.push(undefinedOrMissingType);
|
|
72253
72249
|
elementFlags.push(2 /* Optional */);
|
|
72254
72250
|
} else {
|
|
72255
|
-
const
|
|
72251
|
+
const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
|
|
72252
|
+
const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
72253
|
+
const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
|
|
72256
72254
|
elementTypes.push(addOptionality(
|
|
72257
72255
|
type,
|
|
72258
72256
|
/*isProperty*/
|
|
@@ -72260,7 +72258,7 @@ function createTypeChecker(host) {
|
|
|
72260
72258
|
hasOmittedExpression
|
|
72261
72259
|
));
|
|
72262
72260
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
72263
|
-
if (
|
|
72261
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
72264
72262
|
const inferenceContext = getInferenceContext(node);
|
|
72265
72263
|
Debug.assert(inferenceContext);
|
|
72266
72264
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -72401,11 +72399,13 @@ function createTypeChecker(host) {
|
|
|
72401
72399
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
72402
72400
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
72403
72401
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
72404
|
-
|
|
72402
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
|
|
72403
|
+
const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
72404
|
+
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
|
|
72405
72405
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
72406
72406
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
72407
72407
|
// we don't want to say "could not find 'a'".
|
|
72408
|
-
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name,
|
|
72408
|
+
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
|
|
72409
72409
|
);
|
|
72410
72410
|
if (isInJavascript) {
|
|
72411
72411
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -72449,7 +72449,7 @@ function createTypeChecker(host) {
|
|
|
72449
72449
|
prop.links.target = member;
|
|
72450
72450
|
member = prop;
|
|
72451
72451
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
72452
|
-
if (
|
|
72452
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
72453
72453
|
const inferenceContext = getInferenceContext(node);
|
|
72454
72454
|
Debug.assert(inferenceContext);
|
|
72455
72455
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -72622,7 +72622,9 @@ function createTypeChecker(host) {
|
|
|
72622
72622
|
for (const attributeDecl of attributes.properties) {
|
|
72623
72623
|
const member = attributeDecl.symbol;
|
|
72624
72624
|
if (isJsxAttribute(attributeDecl)) {
|
|
72625
|
-
const
|
|
72625
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
|
|
72626
|
+
const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
72627
|
+
const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
|
|
72626
72628
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
72627
72629
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
72628
72630
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -72643,7 +72645,7 @@ function createTypeChecker(host) {
|
|
|
72643
72645
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
72644
72646
|
}
|
|
72645
72647
|
}
|
|
72646
|
-
if (
|
|
72648
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
72647
72649
|
const inferenceContext = getInferenceContext(attributes);
|
|
72648
72650
|
Debug.assert(inferenceContext);
|
|
72649
72651
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -74261,7 +74263,7 @@ function createTypeChecker(host) {
|
|
|
74261
74263
|
}
|
|
74262
74264
|
for (let i = 0; i < argCount; i++) {
|
|
74263
74265
|
const arg = args[i];
|
|
74264
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
74266
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
74265
74267
|
const paramType = getTypeAtPosition(signature, i);
|
|
74266
74268
|
if (couldContainTypeVariables(paramType)) {
|
|
74267
74269
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -74874,12 +74876,12 @@ function createTypeChecker(host) {
|
|
|
74874
74876
|
const args = getEffectiveCallArguments(node);
|
|
74875
74877
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
74876
74878
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
74877
|
-
argCheckMode |= checkMode &
|
|
74879
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
74878
74880
|
let candidatesForArgumentError;
|
|
74879
74881
|
let candidateForArgumentArityError;
|
|
74880
74882
|
let candidateForTypeArgumentError;
|
|
74881
74883
|
let result;
|
|
74882
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
74884
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
74883
74885
|
if (candidates.length > 1) {
|
|
74884
74886
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
74885
74887
|
}
|
|
@@ -75098,7 +75100,7 @@ function createTypeChecker(host) {
|
|
|
75098
75100
|
continue;
|
|
75099
75101
|
}
|
|
75100
75102
|
if (argCheckMode) {
|
|
75101
|
-
argCheckMode = checkMode &
|
|
75103
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
75102
75104
|
if (inferenceContext) {
|
|
75103
75105
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
75104
75106
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -78176,7 +78178,7 @@ function createTypeChecker(host) {
|
|
|
78176
78178
|
case 36 /* ExclamationEqualsToken */:
|
|
78177
78179
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
78178
78180
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
78179
|
-
if (!(checkMode && checkMode &
|
|
78181
|
+
if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
|
|
78180
78182
|
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
78181
78183
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
78182
78184
|
error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
@@ -78835,7 +78837,7 @@ function createTypeChecker(host) {
|
|
|
78835
78837
|
}
|
|
78836
78838
|
}
|
|
78837
78839
|
const startInvocationCount = flowInvocationCount;
|
|
78838
|
-
const type = checkExpression(node,
|
|
78840
|
+
const type = checkExpression(node, 256 /* TypeOnly */);
|
|
78839
78841
|
if (flowInvocationCount !== startInvocationCount) {
|
|
78840
78842
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
78841
78843
|
cache[getNodeId(node)] = type;
|
|
@@ -81306,7 +81308,7 @@ function createTypeChecker(host) {
|
|
|
81306
81308
|
checkComputedPropertyName(node.propertyName);
|
|
81307
81309
|
}
|
|
81308
81310
|
const parent2 = node.parent.parent;
|
|
81309
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
81311
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
81310
81312
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
81311
81313
|
const name = node.propertyName || node.name;
|
|
81312
81314
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -162741,13 +162743,29 @@ function provideInlayHints(context) {
|
|
|
162741
162743
|
if (!signature || !candidates.length) {
|
|
162742
162744
|
return;
|
|
162743
162745
|
}
|
|
162744
|
-
let
|
|
162746
|
+
let signatureParamPos = 0;
|
|
162745
162747
|
for (const originalArg of args) {
|
|
162746
162748
|
const arg = skipParentheses(originalArg);
|
|
162747
162749
|
if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
|
|
162748
162750
|
continue;
|
|
162749
162751
|
}
|
|
162750
|
-
|
|
162752
|
+
let spreadArgs = 0;
|
|
162753
|
+
if (isSpreadElement(arg)) {
|
|
162754
|
+
const spreadType = checker.getTypeAtLocation(arg.expression);
|
|
162755
|
+
if (checker.isTupleType(spreadType)) {
|
|
162756
|
+
const { elementFlags, fixedLength } = spreadType.target;
|
|
162757
|
+
if (fixedLength === 0) {
|
|
162758
|
+
continue;
|
|
162759
|
+
}
|
|
162760
|
+
const firstOptionalIndex = findIndex(elementFlags, (f) => !(f & 1 /* Required */));
|
|
162761
|
+
const requiredArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
|
|
162762
|
+
if (requiredArgs > 0) {
|
|
162763
|
+
spreadArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
|
|
162764
|
+
}
|
|
162765
|
+
}
|
|
162766
|
+
}
|
|
162767
|
+
const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, signatureParamPos);
|
|
162768
|
+
signatureParamPos = signatureParamPos + (spreadArgs || 1);
|
|
162751
162769
|
if (identifierNameInfo) {
|
|
162752
162770
|
const [parameterName, isFirstVariadicArgument] = identifierNameInfo;
|
|
162753
162771
|
const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
|
|
@@ -162758,17 +162776,6 @@ function provideInlayHints(context) {
|
|
|
162758
162776
|
if (leadingCommentsContainsParameterName(arg, name)) {
|
|
162759
162777
|
continue;
|
|
162760
162778
|
}
|
|
162761
|
-
if (isSpreadElement(arg)) {
|
|
162762
|
-
const spreadType = checker.getTypeAtLocation(arg.expression);
|
|
162763
|
-
if (checker.isTupleType(spreadType)) {
|
|
162764
|
-
const { fixedLength, elementFlags } = spreadType.target;
|
|
162765
|
-
for (let i = pos; i < fixedLength; i++) {
|
|
162766
|
-
if (elementFlags[i] & 1 /* Required */) {
|
|
162767
|
-
pos++;
|
|
162768
|
-
}
|
|
162769
|
-
}
|
|
162770
|
-
}
|
|
162771
|
-
}
|
|
162772
162779
|
addParameterHints(name, originalArg.getStart(), isFirstVariadicArgument);
|
|
162773
162780
|
}
|
|
162774
162781
|
}
|
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.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230605`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -45382,9 +45382,9 @@ ${lanes.join("\n")}
|
|
|
45382
45382
|
candidatesOutArray,
|
|
45383
45383
|
/*argumentCount*/
|
|
45384
45384
|
void 0,
|
|
45385
|
-
|
|
45385
|
+
64 /* IsForStringLiteralArgumentCompletions */
|
|
45386
45386
|
)),
|
|
45387
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount,
|
|
45387
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
|
|
45388
45388
|
getExpandedParameters,
|
|
45389
45389
|
hasEffectiveRestParameter,
|
|
45390
45390
|
containsArgumentsReference,
|
|
@@ -53339,7 +53339,7 @@ ${lanes.join("\n")}
|
|
|
53339
53339
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
53340
53340
|
}
|
|
53341
53341
|
function getTypeForBindingElement(declaration) {
|
|
53342
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
53342
|
+
const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
53343
53343
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
53344
53344
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
53345
53345
|
}
|
|
@@ -55096,19 +55096,13 @@ ${lanes.join("\n")}
|
|
|
55096
55096
|
if (getObjectFlags(type) & 4 /* Reference */) {
|
|
55097
55097
|
const target = type.target;
|
|
55098
55098
|
const typeArguments = getTypeArguments(type);
|
|
55099
|
-
|
|
55100
|
-
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
|
|
55101
|
-
return needApparentType ? getApparentType(ref) : ref;
|
|
55102
|
-
}
|
|
55099
|
+
return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
|
|
55103
55100
|
} else if (type.flags & 2097152 /* Intersection */) {
|
|
55104
55101
|
const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
|
|
55105
55102
|
return types !== type.types ? getIntersectionType(types) : type;
|
|
55106
55103
|
}
|
|
55107
55104
|
return needApparentType ? getApparentType(type) : type;
|
|
55108
55105
|
}
|
|
55109
|
-
function getThisArgument(type) {
|
|
55110
|
-
return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
|
|
55111
|
-
}
|
|
55112
55106
|
function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
|
|
55113
55107
|
let mapper;
|
|
55114
55108
|
let members;
|
|
@@ -56174,7 +56168,7 @@ ${lanes.join("\n")}
|
|
|
56174
56168
|
return type.resolvedBaseConstraint;
|
|
56175
56169
|
}
|
|
56176
56170
|
const stack = [];
|
|
56177
|
-
return type.resolvedBaseConstraint =
|
|
56171
|
+
return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
|
|
56178
56172
|
function getImmediateBaseConstraint(t) {
|
|
56179
56173
|
if (!t.immediateBaseConstraint) {
|
|
56180
56174
|
if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
|
|
@@ -56266,18 +56260,18 @@ ${lanes.join("\n")}
|
|
|
56266
56260
|
}
|
|
56267
56261
|
if (isGenericTupleType(t)) {
|
|
56268
56262
|
const newElements = map(getElementTypes(t), (v, i) => {
|
|
56269
|
-
const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
56270
|
-
return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
56263
|
+
const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
56264
|
+
return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
56271
56265
|
});
|
|
56272
56266
|
return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
|
|
56273
56267
|
}
|
|
56274
56268
|
return t;
|
|
56275
56269
|
}
|
|
56276
56270
|
}
|
|
56277
|
-
function getApparentTypeOfIntersectionType(type) {
|
|
56271
|
+
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
56278
56272
|
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
56279
56273
|
type,
|
|
56280
|
-
|
|
56274
|
+
thisArgument,
|
|
56281
56275
|
/*needApparentType*/
|
|
56282
56276
|
true
|
|
56283
56277
|
));
|
|
@@ -56328,8 +56322,9 @@ ${lanes.join("\n")}
|
|
|
56328
56322
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
56329
56323
|
}
|
|
56330
56324
|
function getApparentType(type) {
|
|
56331
|
-
const t =
|
|
56332
|
-
|
|
56325
|
+
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
56326
|
+
const objectFlags = getObjectFlags(t);
|
|
56327
|
+
return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
56333
56328
|
}
|
|
56334
56329
|
function getReducedApparentType(type) {
|
|
56335
56330
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
@@ -63150,7 +63145,7 @@ ${lanes.join("\n")}
|
|
|
63150
63145
|
return 3 /* Maybe */;
|
|
63151
63146
|
}
|
|
63152
63147
|
const c = target2;
|
|
63153
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
63148
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
|
|
63154
63149
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
63155
63150
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
63156
63151
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -68236,7 +68231,7 @@ ${lanes.join("\n")}
|
|
|
68236
68231
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
68237
68232
|
}
|
|
68238
68233
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
68239
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
68234
|
+
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(
|
|
68240
68235
|
node,
|
|
68241
68236
|
/*contextFlags*/
|
|
68242
68237
|
void 0
|
|
@@ -68993,7 +68988,7 @@ ${lanes.join("\n")}
|
|
|
68993
68988
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
68994
68989
|
const parent2 = declaration.parent.parent;
|
|
68995
68990
|
const name = declaration.propertyName || declaration.name;
|
|
68996
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ?
|
|
68991
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
|
|
68997
68992
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
68998
68993
|
return void 0;
|
|
68999
68994
|
if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -70042,7 +70037,9 @@ ${lanes.join("\n")}
|
|
|
70042
70037
|
elementTypes.push(undefinedOrMissingType);
|
|
70043
70038
|
elementFlags.push(2 /* Optional */);
|
|
70044
70039
|
} else {
|
|
70045
|
-
const
|
|
70040
|
+
const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
|
|
70041
|
+
const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70042
|
+
const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
|
|
70046
70043
|
elementTypes.push(addOptionality(
|
|
70047
70044
|
type,
|
|
70048
70045
|
/*isProperty*/
|
|
@@ -70050,7 +70047,7 @@ ${lanes.join("\n")}
|
|
|
70050
70047
|
hasOmittedExpression
|
|
70051
70048
|
));
|
|
70052
70049
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
70053
|
-
if (
|
|
70050
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70054
70051
|
const inferenceContext = getInferenceContext(node);
|
|
70055
70052
|
Debug.assert(inferenceContext);
|
|
70056
70053
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -70191,11 +70188,13 @@ ${lanes.join("\n")}
|
|
|
70191
70188
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
70192
70189
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
70193
70190
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
70194
|
-
|
|
70191
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
|
|
70192
|
+
const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70193
|
+
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
|
|
70195
70194
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
70196
70195
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
70197
70196
|
// we don't want to say "could not find 'a'".
|
|
70198
|
-
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name,
|
|
70197
|
+
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
|
|
70199
70198
|
);
|
|
70200
70199
|
if (isInJavascript) {
|
|
70201
70200
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -70239,7 +70238,7 @@ ${lanes.join("\n")}
|
|
|
70239
70238
|
prop.links.target = member;
|
|
70240
70239
|
member = prop;
|
|
70241
70240
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
70242
|
-
if (
|
|
70241
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70243
70242
|
const inferenceContext = getInferenceContext(node);
|
|
70244
70243
|
Debug.assert(inferenceContext);
|
|
70245
70244
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -70412,7 +70411,9 @@ ${lanes.join("\n")}
|
|
|
70412
70411
|
for (const attributeDecl of attributes.properties) {
|
|
70413
70412
|
const member = attributeDecl.symbol;
|
|
70414
70413
|
if (isJsxAttribute(attributeDecl)) {
|
|
70415
|
-
const
|
|
70414
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
|
|
70415
|
+
const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70416
|
+
const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
|
|
70416
70417
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
70417
70418
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
70418
70419
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -70433,7 +70434,7 @@ ${lanes.join("\n")}
|
|
|
70433
70434
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
70434
70435
|
}
|
|
70435
70436
|
}
|
|
70436
|
-
if (
|
|
70437
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70437
70438
|
const inferenceContext = getInferenceContext(attributes);
|
|
70438
70439
|
Debug.assert(inferenceContext);
|
|
70439
70440
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -72051,7 +72052,7 @@ ${lanes.join("\n")}
|
|
|
72051
72052
|
}
|
|
72052
72053
|
for (let i = 0; i < argCount; i++) {
|
|
72053
72054
|
const arg = args[i];
|
|
72054
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
72055
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
72055
72056
|
const paramType = getTypeAtPosition(signature, i);
|
|
72056
72057
|
if (couldContainTypeVariables(paramType)) {
|
|
72057
72058
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -72664,12 +72665,12 @@ ${lanes.join("\n")}
|
|
|
72664
72665
|
const args = getEffectiveCallArguments(node);
|
|
72665
72666
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
72666
72667
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
72667
|
-
argCheckMode |= checkMode &
|
|
72668
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72668
72669
|
let candidatesForArgumentError;
|
|
72669
72670
|
let candidateForArgumentArityError;
|
|
72670
72671
|
let candidateForTypeArgumentError;
|
|
72671
72672
|
let result;
|
|
72672
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
72673
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
72673
72674
|
if (candidates.length > 1) {
|
|
72674
72675
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
72675
72676
|
}
|
|
@@ -72888,7 +72889,7 @@ ${lanes.join("\n")}
|
|
|
72888
72889
|
continue;
|
|
72889
72890
|
}
|
|
72890
72891
|
if (argCheckMode) {
|
|
72891
|
-
argCheckMode = checkMode &
|
|
72892
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72892
72893
|
if (inferenceContext) {
|
|
72893
72894
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72894
72895
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -75966,7 +75967,7 @@ ${lanes.join("\n")}
|
|
|
75966
75967
|
case 36 /* ExclamationEqualsToken */:
|
|
75967
75968
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
75968
75969
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
75969
|
-
if (!(checkMode && checkMode &
|
|
75970
|
+
if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
|
|
75970
75971
|
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
75971
75972
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
75972
75973
|
error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
@@ -76625,7 +76626,7 @@ ${lanes.join("\n")}
|
|
|
76625
76626
|
}
|
|
76626
76627
|
}
|
|
76627
76628
|
const startInvocationCount = flowInvocationCount;
|
|
76628
|
-
const type = checkExpression(node,
|
|
76629
|
+
const type = checkExpression(node, 256 /* TypeOnly */);
|
|
76629
76630
|
if (flowInvocationCount !== startInvocationCount) {
|
|
76630
76631
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
76631
76632
|
cache[getNodeId(node)] = type;
|
|
@@ -79096,7 +79097,7 @@ ${lanes.join("\n")}
|
|
|
79096
79097
|
checkComputedPropertyName(node.propertyName);
|
|
79097
79098
|
}
|
|
79098
79099
|
const parent2 = node.parent.parent;
|
|
79099
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
79100
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
79100
79101
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
79101
79102
|
const name = node.propertyName || node.name;
|
|
79102
79103
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -85832,10 +85833,11 @@ ${lanes.join("\n")}
|
|
|
85832
85833
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
85833
85834
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
85834
85835
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
85835
|
-
CheckMode3[CheckMode3["
|
|
85836
|
-
CheckMode3[CheckMode3["
|
|
85837
|
-
CheckMode3[CheckMode3["
|
|
85838
|
-
CheckMode3[CheckMode3["
|
|
85836
|
+
CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
|
|
85837
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
|
|
85838
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
|
|
85839
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
|
|
85840
|
+
CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
|
|
85839
85841
|
return CheckMode3;
|
|
85840
85842
|
})(CheckMode || {});
|
|
85841
85843
|
SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -162092,13 +162094,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162092
162094
|
if (!signature || !candidates.length) {
|
|
162093
162095
|
return;
|
|
162094
162096
|
}
|
|
162095
|
-
let
|
|
162097
|
+
let signatureParamPos = 0;
|
|
162096
162098
|
for (const originalArg of args) {
|
|
162097
162099
|
const arg = skipParentheses(originalArg);
|
|
162098
162100
|
if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
|
|
162099
162101
|
continue;
|
|
162100
162102
|
}
|
|
162101
|
-
|
|
162103
|
+
let spreadArgs = 0;
|
|
162104
|
+
if (isSpreadElement(arg)) {
|
|
162105
|
+
const spreadType = checker.getTypeAtLocation(arg.expression);
|
|
162106
|
+
if (checker.isTupleType(spreadType)) {
|
|
162107
|
+
const { elementFlags, fixedLength } = spreadType.target;
|
|
162108
|
+
if (fixedLength === 0) {
|
|
162109
|
+
continue;
|
|
162110
|
+
}
|
|
162111
|
+
const firstOptionalIndex = findIndex(elementFlags, (f) => !(f & 1 /* Required */));
|
|
162112
|
+
const requiredArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
|
|
162113
|
+
if (requiredArgs > 0) {
|
|
162114
|
+
spreadArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
|
|
162115
|
+
}
|
|
162116
|
+
}
|
|
162117
|
+
}
|
|
162118
|
+
const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, signatureParamPos);
|
|
162119
|
+
signatureParamPos = signatureParamPos + (spreadArgs || 1);
|
|
162102
162120
|
if (identifierNameInfo) {
|
|
162103
162121
|
const [parameterName, isFirstVariadicArgument] = identifierNameInfo;
|
|
162104
162122
|
const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
|
|
@@ -162109,17 +162127,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162109
162127
|
if (leadingCommentsContainsParameterName(arg, name)) {
|
|
162110
162128
|
continue;
|
|
162111
162129
|
}
|
|
162112
|
-
if (isSpreadElement(arg)) {
|
|
162113
|
-
const spreadType = checker.getTypeAtLocation(arg.expression);
|
|
162114
|
-
if (checker.isTupleType(spreadType)) {
|
|
162115
|
-
const { fixedLength, elementFlags } = spreadType.target;
|
|
162116
|
-
for (let i = pos; i < fixedLength; i++) {
|
|
162117
|
-
if (elementFlags[i] & 1 /* Required */) {
|
|
162118
|
-
pos++;
|
|
162119
|
-
}
|
|
162120
|
-
}
|
|
162121
|
-
}
|
|
162122
|
-
}
|
|
162123
162130
|
addParameterHints(name, originalArg.getStart(), isFirstVariadicArgument);
|
|
162124
162131
|
}
|
|
162125
162132
|
}
|
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.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230605`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -45382,9 +45382,9 @@ ${lanes.join("\n")}
|
|
|
45382
45382
|
candidatesOutArray,
|
|
45383
45383
|
/*argumentCount*/
|
|
45384
45384
|
void 0,
|
|
45385
|
-
|
|
45385
|
+
64 /* IsForStringLiteralArgumentCompletions */
|
|
45386
45386
|
)),
|
|
45387
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount,
|
|
45387
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
|
|
45388
45388
|
getExpandedParameters,
|
|
45389
45389
|
hasEffectiveRestParameter,
|
|
45390
45390
|
containsArgumentsReference,
|
|
@@ -53339,7 +53339,7 @@ ${lanes.join("\n")}
|
|
|
53339
53339
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
53340
53340
|
}
|
|
53341
53341
|
function getTypeForBindingElement(declaration) {
|
|
53342
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
53342
|
+
const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
53343
53343
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
53344
53344
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
53345
53345
|
}
|
|
@@ -55096,19 +55096,13 @@ ${lanes.join("\n")}
|
|
|
55096
55096
|
if (getObjectFlags(type) & 4 /* Reference */) {
|
|
55097
55097
|
const target = type.target;
|
|
55098
55098
|
const typeArguments = getTypeArguments(type);
|
|
55099
|
-
|
|
55100
|
-
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
|
|
55101
|
-
return needApparentType ? getApparentType(ref) : ref;
|
|
55102
|
-
}
|
|
55099
|
+
return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
|
|
55103
55100
|
} else if (type.flags & 2097152 /* Intersection */) {
|
|
55104
55101
|
const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
|
|
55105
55102
|
return types !== type.types ? getIntersectionType(types) : type;
|
|
55106
55103
|
}
|
|
55107
55104
|
return needApparentType ? getApparentType(type) : type;
|
|
55108
55105
|
}
|
|
55109
|
-
function getThisArgument(type) {
|
|
55110
|
-
return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
|
|
55111
|
-
}
|
|
55112
55106
|
function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
|
|
55113
55107
|
let mapper;
|
|
55114
55108
|
let members;
|
|
@@ -56174,7 +56168,7 @@ ${lanes.join("\n")}
|
|
|
56174
56168
|
return type.resolvedBaseConstraint;
|
|
56175
56169
|
}
|
|
56176
56170
|
const stack = [];
|
|
56177
|
-
return type.resolvedBaseConstraint =
|
|
56171
|
+
return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
|
|
56178
56172
|
function getImmediateBaseConstraint(t) {
|
|
56179
56173
|
if (!t.immediateBaseConstraint) {
|
|
56180
56174
|
if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
|
|
@@ -56266,18 +56260,18 @@ ${lanes.join("\n")}
|
|
|
56266
56260
|
}
|
|
56267
56261
|
if (isGenericTupleType(t)) {
|
|
56268
56262
|
const newElements = map(getElementTypes(t), (v, i) => {
|
|
56269
|
-
const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
56270
|
-
return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
56263
|
+
const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
56264
|
+
return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
56271
56265
|
});
|
|
56272
56266
|
return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
|
|
56273
56267
|
}
|
|
56274
56268
|
return t;
|
|
56275
56269
|
}
|
|
56276
56270
|
}
|
|
56277
|
-
function getApparentTypeOfIntersectionType(type) {
|
|
56271
|
+
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
56278
56272
|
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
56279
56273
|
type,
|
|
56280
|
-
|
|
56274
|
+
thisArgument,
|
|
56281
56275
|
/*needApparentType*/
|
|
56282
56276
|
true
|
|
56283
56277
|
));
|
|
@@ -56328,8 +56322,9 @@ ${lanes.join("\n")}
|
|
|
56328
56322
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
56329
56323
|
}
|
|
56330
56324
|
function getApparentType(type) {
|
|
56331
|
-
const t =
|
|
56332
|
-
|
|
56325
|
+
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
56326
|
+
const objectFlags = getObjectFlags(t);
|
|
56327
|
+
return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
56333
56328
|
}
|
|
56334
56329
|
function getReducedApparentType(type) {
|
|
56335
56330
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
@@ -63150,7 +63145,7 @@ ${lanes.join("\n")}
|
|
|
63150
63145
|
return 3 /* Maybe */;
|
|
63151
63146
|
}
|
|
63152
63147
|
const c = target2;
|
|
63153
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
63148
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
|
|
63154
63149
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
63155
63150
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
63156
63151
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -68236,7 +68231,7 @@ ${lanes.join("\n")}
|
|
|
68236
68231
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
68237
68232
|
}
|
|
68238
68233
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
68239
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
68234
|
+
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(
|
|
68240
68235
|
node,
|
|
68241
68236
|
/*contextFlags*/
|
|
68242
68237
|
void 0
|
|
@@ -68993,7 +68988,7 @@ ${lanes.join("\n")}
|
|
|
68993
68988
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
68994
68989
|
const parent2 = declaration.parent.parent;
|
|
68995
68990
|
const name = declaration.propertyName || declaration.name;
|
|
68996
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ?
|
|
68991
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
|
|
68997
68992
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
68998
68993
|
return void 0;
|
|
68999
68994
|
if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -70042,7 +70037,9 @@ ${lanes.join("\n")}
|
|
|
70042
70037
|
elementTypes.push(undefinedOrMissingType);
|
|
70043
70038
|
elementFlags.push(2 /* Optional */);
|
|
70044
70039
|
} else {
|
|
70045
|
-
const
|
|
70040
|
+
const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
|
|
70041
|
+
const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70042
|
+
const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
|
|
70046
70043
|
elementTypes.push(addOptionality(
|
|
70047
70044
|
type,
|
|
70048
70045
|
/*isProperty*/
|
|
@@ -70050,7 +70047,7 @@ ${lanes.join("\n")}
|
|
|
70050
70047
|
hasOmittedExpression
|
|
70051
70048
|
));
|
|
70052
70049
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
70053
|
-
if (
|
|
70050
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70054
70051
|
const inferenceContext = getInferenceContext(node);
|
|
70055
70052
|
Debug.assert(inferenceContext);
|
|
70056
70053
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -70191,11 +70188,13 @@ ${lanes.join("\n")}
|
|
|
70191
70188
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
70192
70189
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
70193
70190
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
70194
|
-
|
|
70191
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
|
|
70192
|
+
const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70193
|
+
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
|
|
70195
70194
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
70196
70195
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
70197
70196
|
// we don't want to say "could not find 'a'".
|
|
70198
|
-
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name,
|
|
70197
|
+
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
|
|
70199
70198
|
);
|
|
70200
70199
|
if (isInJavascript) {
|
|
70201
70200
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -70239,7 +70238,7 @@ ${lanes.join("\n")}
|
|
|
70239
70238
|
prop.links.target = member;
|
|
70240
70239
|
member = prop;
|
|
70241
70240
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
70242
|
-
if (
|
|
70241
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70243
70242
|
const inferenceContext = getInferenceContext(node);
|
|
70244
70243
|
Debug.assert(inferenceContext);
|
|
70245
70244
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -70412,7 +70411,9 @@ ${lanes.join("\n")}
|
|
|
70412
70411
|
for (const attributeDecl of attributes.properties) {
|
|
70413
70412
|
const member = attributeDecl.symbol;
|
|
70414
70413
|
if (isJsxAttribute(attributeDecl)) {
|
|
70415
|
-
const
|
|
70414
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
|
|
70415
|
+
const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70416
|
+
const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
|
|
70416
70417
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
70417
70418
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
70418
70419
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -70433,7 +70434,7 @@ ${lanes.join("\n")}
|
|
|
70433
70434
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
70434
70435
|
}
|
|
70435
70436
|
}
|
|
70436
|
-
if (
|
|
70437
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70437
70438
|
const inferenceContext = getInferenceContext(attributes);
|
|
70438
70439
|
Debug.assert(inferenceContext);
|
|
70439
70440
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -72051,7 +72052,7 @@ ${lanes.join("\n")}
|
|
|
72051
72052
|
}
|
|
72052
72053
|
for (let i = 0; i < argCount; i++) {
|
|
72053
72054
|
const arg = args[i];
|
|
72054
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
72055
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
72055
72056
|
const paramType = getTypeAtPosition(signature, i);
|
|
72056
72057
|
if (couldContainTypeVariables(paramType)) {
|
|
72057
72058
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -72664,12 +72665,12 @@ ${lanes.join("\n")}
|
|
|
72664
72665
|
const args = getEffectiveCallArguments(node);
|
|
72665
72666
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
72666
72667
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
72667
|
-
argCheckMode |= checkMode &
|
|
72668
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72668
72669
|
let candidatesForArgumentError;
|
|
72669
72670
|
let candidateForArgumentArityError;
|
|
72670
72671
|
let candidateForTypeArgumentError;
|
|
72671
72672
|
let result;
|
|
72672
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
72673
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
72673
72674
|
if (candidates.length > 1) {
|
|
72674
72675
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
72675
72676
|
}
|
|
@@ -72888,7 +72889,7 @@ ${lanes.join("\n")}
|
|
|
72888
72889
|
continue;
|
|
72889
72890
|
}
|
|
72890
72891
|
if (argCheckMode) {
|
|
72891
|
-
argCheckMode = checkMode &
|
|
72892
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72892
72893
|
if (inferenceContext) {
|
|
72893
72894
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72894
72895
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -75966,7 +75967,7 @@ ${lanes.join("\n")}
|
|
|
75966
75967
|
case 36 /* ExclamationEqualsToken */:
|
|
75967
75968
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
75968
75969
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
75969
|
-
if (!(checkMode && checkMode &
|
|
75970
|
+
if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
|
|
75970
75971
|
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
75971
75972
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
75972
75973
|
error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
@@ -76625,7 +76626,7 @@ ${lanes.join("\n")}
|
|
|
76625
76626
|
}
|
|
76626
76627
|
}
|
|
76627
76628
|
const startInvocationCount = flowInvocationCount;
|
|
76628
|
-
const type = checkExpression(node,
|
|
76629
|
+
const type = checkExpression(node, 256 /* TypeOnly */);
|
|
76629
76630
|
if (flowInvocationCount !== startInvocationCount) {
|
|
76630
76631
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
76631
76632
|
cache[getNodeId(node)] = type;
|
|
@@ -79096,7 +79097,7 @@ ${lanes.join("\n")}
|
|
|
79096
79097
|
checkComputedPropertyName(node.propertyName);
|
|
79097
79098
|
}
|
|
79098
79099
|
const parent2 = node.parent.parent;
|
|
79099
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
79100
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
79100
79101
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
79101
79102
|
const name = node.propertyName || node.name;
|
|
79102
79103
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -85832,10 +85833,11 @@ ${lanes.join("\n")}
|
|
|
85832
85833
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
85833
85834
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
85834
85835
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
85835
|
-
CheckMode3[CheckMode3["
|
|
85836
|
-
CheckMode3[CheckMode3["
|
|
85837
|
-
CheckMode3[CheckMode3["
|
|
85838
|
-
CheckMode3[CheckMode3["
|
|
85836
|
+
CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
|
|
85837
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
|
|
85838
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
|
|
85839
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
|
|
85840
|
+
CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
|
|
85839
85841
|
return CheckMode3;
|
|
85840
85842
|
})(CheckMode || {});
|
|
85841
85843
|
SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -162107,13 +162109,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162107
162109
|
if (!signature || !candidates.length) {
|
|
162108
162110
|
return;
|
|
162109
162111
|
}
|
|
162110
|
-
let
|
|
162112
|
+
let signatureParamPos = 0;
|
|
162111
162113
|
for (const originalArg of args) {
|
|
162112
162114
|
const arg = skipParentheses(originalArg);
|
|
162113
162115
|
if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
|
|
162114
162116
|
continue;
|
|
162115
162117
|
}
|
|
162116
|
-
|
|
162118
|
+
let spreadArgs = 0;
|
|
162119
|
+
if (isSpreadElement(arg)) {
|
|
162120
|
+
const spreadType = checker.getTypeAtLocation(arg.expression);
|
|
162121
|
+
if (checker.isTupleType(spreadType)) {
|
|
162122
|
+
const { elementFlags, fixedLength } = spreadType.target;
|
|
162123
|
+
if (fixedLength === 0) {
|
|
162124
|
+
continue;
|
|
162125
|
+
}
|
|
162126
|
+
const firstOptionalIndex = findIndex(elementFlags, (f) => !(f & 1 /* Required */));
|
|
162127
|
+
const requiredArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
|
|
162128
|
+
if (requiredArgs > 0) {
|
|
162129
|
+
spreadArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
|
|
162130
|
+
}
|
|
162131
|
+
}
|
|
162132
|
+
}
|
|
162133
|
+
const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, signatureParamPos);
|
|
162134
|
+
signatureParamPos = signatureParamPos + (spreadArgs || 1);
|
|
162117
162135
|
if (identifierNameInfo) {
|
|
162118
162136
|
const [parameterName, isFirstVariadicArgument] = identifierNameInfo;
|
|
162119
162137
|
const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
|
|
@@ -162124,17 +162142,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162124
162142
|
if (leadingCommentsContainsParameterName(arg, name)) {
|
|
162125
162143
|
continue;
|
|
162126
162144
|
}
|
|
162127
|
-
if (isSpreadElement(arg)) {
|
|
162128
|
-
const spreadType = checker.getTypeAtLocation(arg.expression);
|
|
162129
|
-
if (checker.isTupleType(spreadType)) {
|
|
162130
|
-
const { fixedLength, elementFlags } = spreadType.target;
|
|
162131
|
-
for (let i = pos; i < fixedLength; i++) {
|
|
162132
|
-
if (elementFlags[i] & 1 /* Required */) {
|
|
162133
|
-
pos++;
|
|
162134
|
-
}
|
|
162135
|
-
}
|
|
162136
|
-
}
|
|
162137
|
-
}
|
|
162138
162145
|
addParameterHints(name, originalArg.getStart(), isFirstVariadicArgument);
|
|
162139
162146
|
}
|
|
162140
162147
|
}
|
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.2";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20230605`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -28918,10 +28918,11 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
28918
28918
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
28919
28919
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
28920
28920
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
28921
|
-
CheckMode3[CheckMode3["
|
|
28922
|
-
CheckMode3[CheckMode3["
|
|
28923
|
-
CheckMode3[CheckMode3["
|
|
28924
|
-
CheckMode3[CheckMode3["
|
|
28921
|
+
CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
|
|
28922
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
|
|
28923
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
|
|
28924
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
|
|
28925
|
+
CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
|
|
28925
28926
|
return CheckMode3;
|
|
28926
28927
|
})(CheckMode || {});
|
|
28927
28928
|
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.2.0-pr-
|
|
5
|
+
"version": "5.2.0-pr-54536-13",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"node": "20.1.0",
|
|
116
116
|
"npm": "8.19.4"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "014d2271f382640d52e637d4b56b59776ff166fa"
|
|
119
119
|
}
|