typescript 5.2.0-dev.20230611 → 5.2.0-dev.20230613
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 +65 -65
- package/lib/tsserver.js +279 -137
- package/lib/tsserverlibrary.js +297 -146
- package/lib/typescript.js +297 -146
- package/lib/typingsInstaller.js +11 -7
- package/package.json +3 -3
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-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230613`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -7729,6 +7729,9 @@ var Diagnostics = {
|
|
|
7729
7729
|
Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
|
|
7730
7730
|
Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
|
|
7731
7731
|
Cannot_move_statements_to_the_selected_file: diag(95183, 3 /* Message */, "Cannot_move_statements_to_the_selected_file_95183", "Cannot move statements to the selected file"),
|
|
7732
|
+
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
7733
|
+
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
7734
|
+
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
7732
7735
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7733
7736
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7734
7737
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -42681,11 +42684,10 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
42681
42684
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
42682
42685
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
42683
42686
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
42684
|
-
CheckMode3[CheckMode3["
|
|
42685
|
-
CheckMode3[CheckMode3["
|
|
42686
|
-
CheckMode3[CheckMode3["
|
|
42687
|
-
CheckMode3[CheckMode3["
|
|
42688
|
-
CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
|
|
42687
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
|
|
42688
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
|
|
42689
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
|
|
42690
|
+
CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
|
|
42689
42691
|
return CheckMode3;
|
|
42690
42692
|
})(CheckMode || {});
|
|
42691
42693
|
var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -42965,9 +42967,9 @@ function createTypeChecker(host) {
|
|
|
42965
42967
|
candidatesOutArray,
|
|
42966
42968
|
/*argumentCount*/
|
|
42967
42969
|
void 0,
|
|
42968
|
-
|
|
42970
|
+
32 /* IsForStringLiteralArgumentCompletions */
|
|
42969
42971
|
)),
|
|
42970
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount,
|
|
42972
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
42971
42973
|
getExpandedParameters,
|
|
42972
42974
|
hasEffectiveRestParameter,
|
|
42973
42975
|
containsArgumentsReference,
|
|
@@ -50922,7 +50924,7 @@ function createTypeChecker(host) {
|
|
|
50922
50924
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
50923
50925
|
}
|
|
50924
50926
|
function getTypeForBindingElement(declaration) {
|
|
50925
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
50927
|
+
const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
|
|
50926
50928
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
50927
50929
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
50928
50930
|
}
|
|
@@ -52679,19 +52681,13 @@ function createTypeChecker(host) {
|
|
|
52679
52681
|
if (getObjectFlags(type) & 4 /* Reference */) {
|
|
52680
52682
|
const target = type.target;
|
|
52681
52683
|
const typeArguments = getTypeArguments(type);
|
|
52682
|
-
|
|
52683
|
-
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
|
|
52684
|
-
return needApparentType ? getApparentType(ref) : ref;
|
|
52685
|
-
}
|
|
52684
|
+
return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
|
|
52686
52685
|
} else if (type.flags & 2097152 /* Intersection */) {
|
|
52687
52686
|
const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
|
|
52688
52687
|
return types !== type.types ? getIntersectionType(types) : type;
|
|
52689
52688
|
}
|
|
52690
52689
|
return needApparentType ? getApparentType(type) : type;
|
|
52691
52690
|
}
|
|
52692
|
-
function getThisArgument(type) {
|
|
52693
|
-
return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
|
|
52694
|
-
}
|
|
52695
52691
|
function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
|
|
52696
52692
|
let mapper;
|
|
52697
52693
|
let members;
|
|
@@ -53757,7 +53753,7 @@ function createTypeChecker(host) {
|
|
|
53757
53753
|
return type.resolvedBaseConstraint;
|
|
53758
53754
|
}
|
|
53759
53755
|
const stack = [];
|
|
53760
|
-
return type.resolvedBaseConstraint =
|
|
53756
|
+
return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
|
|
53761
53757
|
function getImmediateBaseConstraint(t) {
|
|
53762
53758
|
if (!t.immediateBaseConstraint) {
|
|
53763
53759
|
if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
|
|
@@ -53849,18 +53845,18 @@ function createTypeChecker(host) {
|
|
|
53849
53845
|
}
|
|
53850
53846
|
if (isGenericTupleType(t)) {
|
|
53851
53847
|
const newElements = map(getElementTypes(t), (v, i) => {
|
|
53852
|
-
const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
53853
|
-
return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
53848
|
+
const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
53849
|
+
return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
53854
53850
|
});
|
|
53855
53851
|
return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
|
|
53856
53852
|
}
|
|
53857
53853
|
return t;
|
|
53858
53854
|
}
|
|
53859
53855
|
}
|
|
53860
|
-
function getApparentTypeOfIntersectionType(type) {
|
|
53856
|
+
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
53861
53857
|
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
53862
53858
|
type,
|
|
53863
|
-
|
|
53859
|
+
thisArgument,
|
|
53864
53860
|
/*needApparentType*/
|
|
53865
53861
|
true
|
|
53866
53862
|
));
|
|
@@ -53911,8 +53907,9 @@ function createTypeChecker(host) {
|
|
|
53911
53907
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
53912
53908
|
}
|
|
53913
53909
|
function getApparentType(type) {
|
|
53914
|
-
const t =
|
|
53915
|
-
|
|
53910
|
+
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
53911
|
+
const objectFlags = getObjectFlags(t);
|
|
53912
|
+
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;
|
|
53916
53913
|
}
|
|
53917
53914
|
function getReducedApparentType(type) {
|
|
53918
53915
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
@@ -60741,7 +60738,7 @@ function createTypeChecker(host) {
|
|
|
60741
60738
|
return 3 /* Maybe */;
|
|
60742
60739
|
}
|
|
60743
60740
|
const c = target2;
|
|
60744
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
60741
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
|
|
60745
60742
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
60746
60743
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
60747
60744
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -65827,7 +65824,7 @@ function createTypeChecker(host) {
|
|
|
65827
65824
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
65828
65825
|
}
|
|
65829
65826
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
65830
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
65827
|
+
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 64 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
|
|
65831
65828
|
node,
|
|
65832
65829
|
/*contextFlags*/
|
|
65833
65830
|
void 0
|
|
@@ -66474,6 +66471,25 @@ function createTypeChecker(host) {
|
|
|
66474
66471
|
return t.flags & 2097152 /* Intersection */ ? forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t);
|
|
66475
66472
|
});
|
|
66476
66473
|
}
|
|
66474
|
+
function getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType) {
|
|
66475
|
+
let literal = containingLiteral;
|
|
66476
|
+
let type = contextualType;
|
|
66477
|
+
while (type) {
|
|
66478
|
+
const thisType = getThisTypeFromContextualType(type);
|
|
66479
|
+
if (thisType) {
|
|
66480
|
+
return thisType;
|
|
66481
|
+
}
|
|
66482
|
+
if (literal.parent.kind !== 302 /* PropertyAssignment */) {
|
|
66483
|
+
break;
|
|
66484
|
+
}
|
|
66485
|
+
literal = literal.parent.parent;
|
|
66486
|
+
type = getApparentTypeOfContextualType(
|
|
66487
|
+
literal,
|
|
66488
|
+
/*contextFlags*/
|
|
66489
|
+
void 0
|
|
66490
|
+
);
|
|
66491
|
+
}
|
|
66492
|
+
}
|
|
66477
66493
|
function getContextualThisParameterType(func) {
|
|
66478
66494
|
if (func.kind === 218 /* ArrowFunction */) {
|
|
66479
66495
|
return void 0;
|
|
@@ -66496,22 +66512,9 @@ function createTypeChecker(host) {
|
|
|
66496
66512
|
/*contextFlags*/
|
|
66497
66513
|
void 0
|
|
66498
66514
|
);
|
|
66499
|
-
|
|
66500
|
-
|
|
66501
|
-
|
|
66502
|
-
const thisType = getThisTypeFromContextualType(type);
|
|
66503
|
-
if (thisType) {
|
|
66504
|
-
return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
|
|
66505
|
-
}
|
|
66506
|
-
if (literal.parent.kind !== 302 /* PropertyAssignment */) {
|
|
66507
|
-
break;
|
|
66508
|
-
}
|
|
66509
|
-
literal = literal.parent.parent;
|
|
66510
|
-
type = getApparentTypeOfContextualType(
|
|
66511
|
-
literal,
|
|
66512
|
-
/*contextFlags*/
|
|
66513
|
-
void 0
|
|
66514
|
-
);
|
|
66515
|
+
const thisType = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType);
|
|
66516
|
+
if (thisType) {
|
|
66517
|
+
return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
|
|
66515
66518
|
}
|
|
66516
66519
|
return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral));
|
|
66517
66520
|
}
|
|
@@ -66584,7 +66587,7 @@ function createTypeChecker(host) {
|
|
|
66584
66587
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
66585
66588
|
const parent = declaration.parent.parent;
|
|
66586
66589
|
const name = declaration.propertyName || declaration.name;
|
|
66587
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 207 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ?
|
|
66590
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 207 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
|
|
66588
66591
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
66589
66592
|
return void 0;
|
|
66590
66593
|
if (parent.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -67633,9 +67636,7 @@ function createTypeChecker(host) {
|
|
|
67633
67636
|
elementTypes.push(undefinedOrMissingType);
|
|
67634
67637
|
elementFlags.push(2 /* Optional */);
|
|
67635
67638
|
} else {
|
|
67636
|
-
const
|
|
67637
|
-
const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
67638
|
-
const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
|
|
67639
|
+
const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
|
|
67639
67640
|
elementTypes.push(addOptionality(
|
|
67640
67641
|
type,
|
|
67641
67642
|
/*isProperty*/
|
|
@@ -67643,7 +67644,7 @@ function createTypeChecker(host) {
|
|
|
67643
67644
|
hasOmittedExpression
|
|
67644
67645
|
));
|
|
67645
67646
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
67646
|
-
if (
|
|
67647
|
+
if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
|
|
67647
67648
|
const inferenceContext = getInferenceContext(node);
|
|
67648
67649
|
Debug.assert(inferenceContext);
|
|
67649
67650
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -67784,13 +67785,11 @@ function createTypeChecker(host) {
|
|
|
67784
67785
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
67785
67786
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
67786
67787
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
67787
|
-
|
|
67788
|
-
const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
67789
|
-
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
|
|
67788
|
+
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : (
|
|
67790
67789
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
67791
67790
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
67792
67791
|
// we don't want to say "could not find 'a'".
|
|
67793
|
-
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name,
|
|
67792
|
+
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode)
|
|
67794
67793
|
);
|
|
67795
67794
|
if (isInJavascript) {
|
|
67796
67795
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -67834,7 +67833,7 @@ function createTypeChecker(host) {
|
|
|
67834
67833
|
prop.links.target = member;
|
|
67835
67834
|
member = prop;
|
|
67836
67835
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
67837
|
-
if (
|
|
67836
|
+
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
|
|
67838
67837
|
const inferenceContext = getInferenceContext(node);
|
|
67839
67838
|
Debug.assert(inferenceContext);
|
|
67840
67839
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -68007,9 +68006,7 @@ function createTypeChecker(host) {
|
|
|
68007
68006
|
for (const attributeDecl of attributes.properties) {
|
|
68008
68007
|
const member = attributeDecl.symbol;
|
|
68009
68008
|
if (isJsxAttribute(attributeDecl)) {
|
|
68010
|
-
const
|
|
68011
|
-
const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
68012
|
-
const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
|
|
68009
|
+
const exprType = checkJsxAttribute(attributeDecl, checkMode);
|
|
68013
68010
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
68014
68011
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
68015
68012
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -68030,7 +68027,7 @@ function createTypeChecker(host) {
|
|
|
68030
68027
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
68031
68028
|
}
|
|
68032
68029
|
}
|
|
68033
|
-
if (
|
|
68030
|
+
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
|
|
68034
68031
|
const inferenceContext = getInferenceContext(attributes);
|
|
68035
68032
|
Debug.assert(inferenceContext);
|
|
68036
68033
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -69648,7 +69645,7 @@ function createTypeChecker(host) {
|
|
|
69648
69645
|
}
|
|
69649
69646
|
for (let i = 0; i < argCount; i++) {
|
|
69650
69647
|
const arg = args[i];
|
|
69651
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
69648
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
69652
69649
|
const paramType = getTypeAtPosition(signature, i);
|
|
69653
69650
|
if (couldContainTypeVariables(paramType)) {
|
|
69654
69651
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -70261,12 +70258,12 @@ function createTypeChecker(host) {
|
|
|
70261
70258
|
const args = getEffectiveCallArguments(node);
|
|
70262
70259
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
70263
70260
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
70264
|
-
argCheckMode |= checkMode &
|
|
70261
|
+
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
70265
70262
|
let candidatesForArgumentError;
|
|
70266
70263
|
let candidateForArgumentArityError;
|
|
70267
70264
|
let candidateForTypeArgumentError;
|
|
70268
70265
|
let result;
|
|
70269
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
70266
|
+
const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
70270
70267
|
if (candidates.length > 1) {
|
|
70271
70268
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
70272
70269
|
}
|
|
@@ -70485,7 +70482,7 @@ function createTypeChecker(host) {
|
|
|
70485
70482
|
continue;
|
|
70486
70483
|
}
|
|
70487
70484
|
if (argCheckMode) {
|
|
70488
|
-
argCheckMode = checkMode &
|
|
70485
|
+
argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
70489
70486
|
if (inferenceContext) {
|
|
70490
70487
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
70491
70488
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -73563,8 +73560,9 @@ function createTypeChecker(host) {
|
|
|
73563
73560
|
case 36 /* ExclamationEqualsToken */:
|
|
73564
73561
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
73565
73562
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
73566
|
-
if (!(checkMode && checkMode &
|
|
73567
|
-
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right))
|
|
73563
|
+
if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
|
|
73564
|
+
if ((isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) && // only report for === and !== in JS, not == or !=
|
|
73565
|
+
(!isInJSFile(left) || (operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */))) {
|
|
73568
73566
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
73569
73567
|
error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
73570
73568
|
}
|
|
@@ -74222,7 +74220,7 @@ function createTypeChecker(host) {
|
|
|
74222
74220
|
}
|
|
74223
74221
|
}
|
|
74224
74222
|
const startInvocationCount = flowInvocationCount;
|
|
74225
|
-
const type = checkExpression(node,
|
|
74223
|
+
const type = checkExpression(node, 128 /* TypeOnly */);
|
|
74226
74224
|
if (flowInvocationCount !== startInvocationCount) {
|
|
74227
74225
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
74228
74226
|
cache[getNodeId(node)] = type;
|
|
@@ -76693,7 +76691,7 @@ function createTypeChecker(host) {
|
|
|
76693
76691
|
checkComputedPropertyName(node.propertyName);
|
|
76694
76692
|
}
|
|
76695
76693
|
const parent = node.parent.parent;
|
|
76696
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
76694
|
+
const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
|
|
76697
76695
|
const parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
76698
76696
|
const name = node.propertyName || node.name;
|
|
76699
76697
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -80283,7 +80281,7 @@ function createTypeChecker(host) {
|
|
|
80283
80281
|
/*contextFlags*/
|
|
80284
80282
|
void 0
|
|
80285
80283
|
);
|
|
80286
|
-
const type =
|
|
80284
|
+
const type = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType);
|
|
80287
80285
|
return type && !isTypeAny(type);
|
|
80288
80286
|
}
|
|
80289
80287
|
}
|
|
@@ -113766,7 +113764,9 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
113766
113764
|
Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
113767
113765
|
Diagnostics.Class_constructor_may_not_be_a_generator.code,
|
|
113768
113766
|
Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
113769
|
-
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code
|
|
113767
|
+
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
113768
|
+
// Type errors
|
|
113769
|
+
Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
|
|
113770
113770
|
]);
|
|
113771
113771
|
function shouldProgramCreateNewSourceFiles(program, newOptions) {
|
|
113772
113772
|
if (!program)
|