@typescript-deploys/pr-build 5.2.0-pr-54507-7 → 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 +42 -43
- package/lib/tsserver.js +61 -46
- package/lib/tsserverlibrary.js +61 -46
- package/lib/typescript.js +61 -46
- 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)));
|
|
@@ -58096,10 +58092,7 @@ function createTypeChecker(host) {
|
|
|
58096
58092
|
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
|
58097
58093
|
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
|
|
58098
58094
|
if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
58099
|
-
|
|
58100
|
-
if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
58101
|
-
result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
58102
|
-
}
|
|
58095
|
+
result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
58103
58096
|
}
|
|
58104
58097
|
target.instantiations.set(id, result);
|
|
58105
58098
|
}
|
|
@@ -60712,7 +60705,7 @@ function createTypeChecker(host) {
|
|
|
60712
60705
|
return 3 /* Maybe */;
|
|
60713
60706
|
}
|
|
60714
60707
|
const c = target2;
|
|
60715
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
60708
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
|
|
60716
60709
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
60717
60710
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
60718
60711
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -65798,7 +65791,7 @@ function createTypeChecker(host) {
|
|
|
65798
65791
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
65799
65792
|
}
|
|
65800
65793
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
65801
|
-
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(
|
|
65802
65795
|
node,
|
|
65803
65796
|
/*contextFlags*/
|
|
65804
65797
|
void 0
|
|
@@ -66555,7 +66548,7 @@ function createTypeChecker(host) {
|
|
|
66555
66548
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
66556
66549
|
const parent = declaration.parent.parent;
|
|
66557
66550
|
const name = declaration.propertyName || declaration.name;
|
|
66558
|
-
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 */);
|
|
66559
66552
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
66560
66553
|
return void 0;
|
|
66561
66554
|
if (parent.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -67604,7 +67597,9 @@ function createTypeChecker(host) {
|
|
|
67604
67597
|
elementTypes.push(undefinedOrMissingType);
|
|
67605
67598
|
elementFlags.push(2 /* Optional */);
|
|
67606
67599
|
} else {
|
|
67607
|
-
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);
|
|
67608
67603
|
elementTypes.push(addOptionality(
|
|
67609
67604
|
type,
|
|
67610
67605
|
/*isProperty*/
|
|
@@ -67612,7 +67607,7 @@ function createTypeChecker(host) {
|
|
|
67612
67607
|
hasOmittedExpression
|
|
67613
67608
|
));
|
|
67614
67609
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
67615
|
-
if (
|
|
67610
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
67616
67611
|
const inferenceContext = getInferenceContext(node);
|
|
67617
67612
|
Debug.assert(inferenceContext);
|
|
67618
67613
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -67753,11 +67748,13 @@ function createTypeChecker(host) {
|
|
|
67753
67748
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
67754
67749
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
67755
67750
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
67756
|
-
|
|
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) : (
|
|
67757
67754
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
67758
67755
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
67759
67756
|
// we don't want to say "could not find 'a'".
|
|
67760
|
-
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)
|
|
67761
67758
|
);
|
|
67762
67759
|
if (isInJavascript) {
|
|
67763
67760
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -67801,7 +67798,7 @@ function createTypeChecker(host) {
|
|
|
67801
67798
|
prop.links.target = member;
|
|
67802
67799
|
member = prop;
|
|
67803
67800
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
67804
|
-
if (
|
|
67801
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
67805
67802
|
const inferenceContext = getInferenceContext(node);
|
|
67806
67803
|
Debug.assert(inferenceContext);
|
|
67807
67804
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -67974,7 +67971,9 @@ function createTypeChecker(host) {
|
|
|
67974
67971
|
for (const attributeDecl of attributes.properties) {
|
|
67975
67972
|
const member = attributeDecl.symbol;
|
|
67976
67973
|
if (isJsxAttribute(attributeDecl)) {
|
|
67977
|
-
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);
|
|
67978
67977
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
67979
67978
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
67980
67979
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -67995,7 +67994,7 @@ function createTypeChecker(host) {
|
|
|
67995
67994
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
67996
67995
|
}
|
|
67997
67996
|
}
|
|
67998
|
-
if (
|
|
67997
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
67999
67998
|
const inferenceContext = getInferenceContext(attributes);
|
|
68000
67999
|
Debug.assert(inferenceContext);
|
|
68001
68000
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -69613,7 +69612,7 @@ function createTypeChecker(host) {
|
|
|
69613
69612
|
}
|
|
69614
69613
|
for (let i = 0; i < argCount; i++) {
|
|
69615
69614
|
const arg = args[i];
|
|
69616
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
69615
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
69617
69616
|
const paramType = getTypeAtPosition(signature, i);
|
|
69618
69617
|
if (couldContainTypeVariables(paramType)) {
|
|
69619
69618
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -70226,12 +70225,12 @@ function createTypeChecker(host) {
|
|
|
70226
70225
|
const args = getEffectiveCallArguments(node);
|
|
70227
70226
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
70228
70227
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
70229
|
-
argCheckMode |= checkMode &
|
|
70228
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
70230
70229
|
let candidatesForArgumentError;
|
|
70231
70230
|
let candidateForArgumentArityError;
|
|
70232
70231
|
let candidateForTypeArgumentError;
|
|
70233
70232
|
let result;
|
|
70234
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
70233
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
70235
70234
|
if (candidates.length > 1) {
|
|
70236
70235
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
70237
70236
|
}
|
|
@@ -70450,7 +70449,7 @@ function createTypeChecker(host) {
|
|
|
70450
70449
|
continue;
|
|
70451
70450
|
}
|
|
70452
70451
|
if (argCheckMode) {
|
|
70453
|
-
argCheckMode = checkMode &
|
|
70452
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
70454
70453
|
if (inferenceContext) {
|
|
70455
70454
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
70456
70455
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -73528,7 +73527,7 @@ function createTypeChecker(host) {
|
|
|
73528
73527
|
case 36 /* ExclamationEqualsToken */:
|
|
73529
73528
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
73530
73529
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
73531
|
-
if (!(checkMode && checkMode &
|
|
73530
|
+
if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
|
|
73532
73531
|
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
73533
73532
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
73534
73533
|
error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
@@ -74187,7 +74186,7 @@ function createTypeChecker(host) {
|
|
|
74187
74186
|
}
|
|
74188
74187
|
}
|
|
74189
74188
|
const startInvocationCount = flowInvocationCount;
|
|
74190
|
-
const type = checkExpression(node,
|
|
74189
|
+
const type = checkExpression(node, 256 /* TypeOnly */);
|
|
74191
74190
|
if (flowInvocationCount !== startInvocationCount) {
|
|
74192
74191
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
74193
74192
|
cache[getNodeId(node)] = type;
|
|
@@ -76658,7 +76657,7 @@ function createTypeChecker(host) {
|
|
|
76658
76657
|
checkComputedPropertyName(node.propertyName);
|
|
76659
76658
|
}
|
|
76660
76659
|
const parent = node.parent.parent;
|
|
76661
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
76660
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
76662
76661
|
const parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
76663
76662
|
const name = node.propertyName || node.name;
|
|
76664
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)));
|
|
@@ -62747,10 +62743,7 @@ function createTypeChecker(host) {
|
|
|
62747
62743
|
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
|
62748
62744
|
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
|
|
62749
62745
|
if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
62750
|
-
|
|
62751
|
-
if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
62752
|
-
result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
62753
|
-
}
|
|
62746
|
+
result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
62754
62747
|
}
|
|
62755
62748
|
target.instantiations.set(id, result);
|
|
62756
62749
|
}
|
|
@@ -65363,7 +65356,7 @@ function createTypeChecker(host) {
|
|
|
65363
65356
|
return 3 /* Maybe */;
|
|
65364
65357
|
}
|
|
65365
65358
|
const c = target2;
|
|
65366
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
65359
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
|
|
65367
65360
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
65368
65361
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
65369
65362
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -70449,7 +70442,7 @@ function createTypeChecker(host) {
|
|
|
70449
70442
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
70450
70443
|
}
|
|
70451
70444
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
70452
|
-
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(
|
|
70453
70446
|
node,
|
|
70454
70447
|
/*contextFlags*/
|
|
70455
70448
|
void 0
|
|
@@ -71206,7 +71199,7 @@ function createTypeChecker(host) {
|
|
|
71206
71199
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
71207
71200
|
const parent2 = declaration.parent.parent;
|
|
71208
71201
|
const name = declaration.propertyName || declaration.name;
|
|
71209
|
-
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 */);
|
|
71210
71203
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
71211
71204
|
return void 0;
|
|
71212
71205
|
if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -72255,7 +72248,9 @@ function createTypeChecker(host) {
|
|
|
72255
72248
|
elementTypes.push(undefinedOrMissingType);
|
|
72256
72249
|
elementFlags.push(2 /* Optional */);
|
|
72257
72250
|
} else {
|
|
72258
|
-
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);
|
|
72259
72254
|
elementTypes.push(addOptionality(
|
|
72260
72255
|
type,
|
|
72261
72256
|
/*isProperty*/
|
|
@@ -72263,7 +72258,7 @@ function createTypeChecker(host) {
|
|
|
72263
72258
|
hasOmittedExpression
|
|
72264
72259
|
));
|
|
72265
72260
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
72266
|
-
if (
|
|
72261
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
72267
72262
|
const inferenceContext = getInferenceContext(node);
|
|
72268
72263
|
Debug.assert(inferenceContext);
|
|
72269
72264
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -72404,11 +72399,13 @@ function createTypeChecker(host) {
|
|
|
72404
72399
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
72405
72400
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
72406
72401
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
72407
|
-
|
|
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) : (
|
|
72408
72405
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
72409
72406
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
72410
72407
|
// we don't want to say "could not find 'a'".
|
|
72411
|
-
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)
|
|
72412
72409
|
);
|
|
72413
72410
|
if (isInJavascript) {
|
|
72414
72411
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -72452,7 +72449,7 @@ function createTypeChecker(host) {
|
|
|
72452
72449
|
prop.links.target = member;
|
|
72453
72450
|
member = prop;
|
|
72454
72451
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
72455
|
-
if (
|
|
72452
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
72456
72453
|
const inferenceContext = getInferenceContext(node);
|
|
72457
72454
|
Debug.assert(inferenceContext);
|
|
72458
72455
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -72625,7 +72622,9 @@ function createTypeChecker(host) {
|
|
|
72625
72622
|
for (const attributeDecl of attributes.properties) {
|
|
72626
72623
|
const member = attributeDecl.symbol;
|
|
72627
72624
|
if (isJsxAttribute(attributeDecl)) {
|
|
72628
|
-
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);
|
|
72629
72628
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
72630
72629
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
72631
72630
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -72646,7 +72645,7 @@ function createTypeChecker(host) {
|
|
|
72646
72645
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
72647
72646
|
}
|
|
72648
72647
|
}
|
|
72649
|
-
if (
|
|
72648
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
72650
72649
|
const inferenceContext = getInferenceContext(attributes);
|
|
72651
72650
|
Debug.assert(inferenceContext);
|
|
72652
72651
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -74264,7 +74263,7 @@ function createTypeChecker(host) {
|
|
|
74264
74263
|
}
|
|
74265
74264
|
for (let i = 0; i < argCount; i++) {
|
|
74266
74265
|
const arg = args[i];
|
|
74267
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
74266
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
74268
74267
|
const paramType = getTypeAtPosition(signature, i);
|
|
74269
74268
|
if (couldContainTypeVariables(paramType)) {
|
|
74270
74269
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -74877,12 +74876,12 @@ function createTypeChecker(host) {
|
|
|
74877
74876
|
const args = getEffectiveCallArguments(node);
|
|
74878
74877
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
74879
74878
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
74880
|
-
argCheckMode |= checkMode &
|
|
74879
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
74881
74880
|
let candidatesForArgumentError;
|
|
74882
74881
|
let candidateForArgumentArityError;
|
|
74883
74882
|
let candidateForTypeArgumentError;
|
|
74884
74883
|
let result;
|
|
74885
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
74884
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
74886
74885
|
if (candidates.length > 1) {
|
|
74887
74886
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
74888
74887
|
}
|
|
@@ -75101,7 +75100,7 @@ function createTypeChecker(host) {
|
|
|
75101
75100
|
continue;
|
|
75102
75101
|
}
|
|
75103
75102
|
if (argCheckMode) {
|
|
75104
|
-
argCheckMode = checkMode &
|
|
75103
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
75105
75104
|
if (inferenceContext) {
|
|
75106
75105
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
75107
75106
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -78179,7 +78178,7 @@ function createTypeChecker(host) {
|
|
|
78179
78178
|
case 36 /* ExclamationEqualsToken */:
|
|
78180
78179
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
78181
78180
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
78182
|
-
if (!(checkMode && checkMode &
|
|
78181
|
+
if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
|
|
78183
78182
|
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
78184
78183
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
78185
78184
|
error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
@@ -78838,7 +78837,7 @@ function createTypeChecker(host) {
|
|
|
78838
78837
|
}
|
|
78839
78838
|
}
|
|
78840
78839
|
const startInvocationCount = flowInvocationCount;
|
|
78841
|
-
const type = checkExpression(node,
|
|
78840
|
+
const type = checkExpression(node, 256 /* TypeOnly */);
|
|
78842
78841
|
if (flowInvocationCount !== startInvocationCount) {
|
|
78843
78842
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
78844
78843
|
cache[getNodeId(node)] = type;
|
|
@@ -81309,7 +81308,7 @@ function createTypeChecker(host) {
|
|
|
81309
81308
|
checkComputedPropertyName(node.propertyName);
|
|
81310
81309
|
}
|
|
81311
81310
|
const parent2 = node.parent.parent;
|
|
81312
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
81311
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
81313
81312
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
81314
81313
|
const name = node.propertyName || node.name;
|
|
81315
81314
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -162744,13 +162743,29 @@ function provideInlayHints(context) {
|
|
|
162744
162743
|
if (!signature || !candidates.length) {
|
|
162745
162744
|
return;
|
|
162746
162745
|
}
|
|
162747
|
-
|
|
162748
|
-
|
|
162746
|
+
let signatureParamPos = 0;
|
|
162747
|
+
for (const originalArg of args) {
|
|
162749
162748
|
const arg = skipParentheses(originalArg);
|
|
162750
162749
|
if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
|
|
162751
162750
|
continue;
|
|
162752
162751
|
}
|
|
162753
|
-
|
|
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);
|
|
162754
162769
|
if (identifierNameInfo) {
|
|
162755
162770
|
const [parameterName, isFirstVariadicArgument] = identifierNameInfo;
|
|
162756
162771
|
const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
|