@typescript-deploys/pr-build 5.2.0-pr-55052-3 → 5.2.0-pr-55028-5
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 +40 -105
- package/lib/tsserver.js +45 -103
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +45 -103
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +45 -103
- package/lib/typingsInstaller.js +3 -6
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -2327,7 +2327,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2327
2327
|
|
|
2328
2328
|
// src/compiler/corePublic.ts
|
|
2329
2329
|
var versionMajorMinor = "5.2";
|
|
2330
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2330
|
+
var version = `${versionMajorMinor}.0-insiders.20230720`;
|
|
2331
2331
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2332
2332
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2333
2333
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6810,7 +6810,8 @@ var SignatureFlags = /* @__PURE__ */ ((SignatureFlags5) => {
|
|
|
6810
6810
|
SignatureFlags5[SignatureFlags5["IsOuterCallChain"] = 16] = "IsOuterCallChain";
|
|
6811
6811
|
SignatureFlags5[SignatureFlags5["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile";
|
|
6812
6812
|
SignatureFlags5[SignatureFlags5["IsNonInferrable"] = 64] = "IsNonInferrable";
|
|
6813
|
-
SignatureFlags5[SignatureFlags5["
|
|
6813
|
+
SignatureFlags5[SignatureFlags5["IsSignatureCandidateForOverloadFailure"] = 128] = "IsSignatureCandidateForOverloadFailure";
|
|
6814
|
+
SignatureFlags5[SignatureFlags5["PropagatingFlags"] = 167] = "PropagatingFlags";
|
|
6814
6815
|
SignatureFlags5[SignatureFlags5["CallChainFlags"] = 24] = "CallChainFlags";
|
|
6815
6816
|
return SignatureFlags5;
|
|
6816
6817
|
})(SignatureFlags || {});
|
|
@@ -10189,9 +10190,6 @@ var Diagnostics = {
|
|
|
10189
10190
|
await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(2852, 1 /* Error */, "await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_2852", "'await using' statements are only allowed within async functions and at the top levels of modules."),
|
|
10190
10191
|
await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
10191
10192
|
Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
10192
|
-
The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method: diag(2855, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_2855", "The left-hand side of an 'instanceof' expression must be assignable to the first argument of the right-hand side's '[Symbol.hasInstance]' method."),
|
|
10193
|
-
An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression: diag(2856, 1 /* Error */, "An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_han_2856", "An object's '[Symbol.hasInstance]' method must return a boolean value for it to be used on the right-hand side of an 'instanceof' expression."),
|
|
10194
|
-
The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_an_object_type_with_a_Symbol_hasInstance_method_or_a_type_assignable_to_the_Function_interface_type: diag(2857, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_an_object_type_with_a_Sym_2857", "The right-hand side of an 'instanceof' expression must be either of type 'any', an object type with a '[Symbol.hasInstance]()' method, or a type assignable to the 'Function' interface type."),
|
|
10195
10193
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
10196
10194
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
10197
10195
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -14665,7 +14663,6 @@ function isLeftHandSideExpressionKind(kind) {
|
|
|
14665
14663
|
case 236 /* MetaProperty */:
|
|
14666
14664
|
case 102 /* ImportKeyword */:
|
|
14667
14665
|
case 282 /* MissingDeclaration */:
|
|
14668
|
-
case 237 /* SyntheticExpression */:
|
|
14669
14666
|
return true;
|
|
14670
14667
|
default:
|
|
14671
14668
|
return false;
|
|
@@ -48574,7 +48571,6 @@ function createTypeChecker(host) {
|
|
|
48574
48571
|
var potentialReflectCollisions = [];
|
|
48575
48572
|
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
48576
48573
|
var awaitedTypeStack = [];
|
|
48577
|
-
var hasGlobalSymbolHasInstanceProperty;
|
|
48578
48574
|
var diagnostics = createDiagnosticCollection();
|
|
48579
48575
|
var suggestionDiagnostics = createDiagnosticCollection();
|
|
48580
48576
|
var typeofType = createTypeofType();
|
|
@@ -49086,7 +49082,7 @@ function createTypeChecker(host) {
|
|
|
49086
49082
|
false
|
|
49087
49083
|
);
|
|
49088
49084
|
} else if (isParameterPropertyDeclaration(declaration, declaration.parent)) {
|
|
49089
|
-
return !(
|
|
49085
|
+
return !(useDefineForClassFields && getContainingClass(declaration) === getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration));
|
|
49090
49086
|
}
|
|
49091
49087
|
return true;
|
|
49092
49088
|
}
|
|
@@ -49100,7 +49096,7 @@ function createTypeChecker(host) {
|
|
|
49100
49096
|
return true;
|
|
49101
49097
|
}
|
|
49102
49098
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
49103
|
-
if (
|
|
49099
|
+
if (useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
49104
49100
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
49105
49101
|
declaration,
|
|
49106
49102
|
usage,
|
|
@@ -49224,7 +49220,7 @@ function createTypeChecker(host) {
|
|
|
49224
49220
|
return requiresScopeChangeWorker(node.name);
|
|
49225
49221
|
case 172 /* PropertyDeclaration */:
|
|
49226
49222
|
if (hasStaticModifier(node)) {
|
|
49227
|
-
return
|
|
49223
|
+
return !useDefineForClassFields;
|
|
49228
49224
|
}
|
|
49229
49225
|
return requiresScopeChangeWorker(node.name);
|
|
49230
49226
|
default:
|
|
@@ -49263,7 +49259,7 @@ function createTypeChecker(host) {
|
|
|
49263
49259
|
if (name === "const" && isConstAssertion(location)) {
|
|
49264
49260
|
return void 0;
|
|
49265
49261
|
}
|
|
49266
|
-
if (
|
|
49262
|
+
if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
|
|
49267
49263
|
lastLocation = location;
|
|
49268
49264
|
location = location.parent;
|
|
49269
49265
|
}
|
|
@@ -49495,7 +49491,7 @@ function createTypeChecker(host) {
|
|
|
49495
49491
|
}
|
|
49496
49492
|
}
|
|
49497
49493
|
function checkAndReportErrorForInvalidInitializer() {
|
|
49498
|
-
if (propertyWithInvalidInitializer && !
|
|
49494
|
+
if (propertyWithInvalidInitializer && !useDefineForClassFields) {
|
|
49499
49495
|
error2(
|
|
49500
49496
|
errorLocation,
|
|
49501
49497
|
errorLocation && propertyWithInvalidInitializer.type && textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,
|
|
@@ -56285,7 +56281,7 @@ function createTypeChecker(host) {
|
|
|
56285
56281
|
false,
|
|
56286
56282
|
definedInMethod && !definedInConstructor
|
|
56287
56283
|
));
|
|
56288
|
-
if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
56284
|
+
if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
56289
56285
|
reportImplicitAny(symbol.valueDeclaration, anyType);
|
|
56290
56286
|
return anyType;
|
|
56291
56287
|
}
|
|
@@ -57645,6 +57641,7 @@ function createTypeChecker(host) {
|
|
|
57645
57641
|
return links.resolvedSymbol;
|
|
57646
57642
|
}
|
|
57647
57643
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
57644
|
+
var _a, _b, _c;
|
|
57648
57645
|
const links = getSymbolLinks(symbol);
|
|
57649
57646
|
if (!links[resolutionKind]) {
|
|
57650
57647
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -57663,7 +57660,7 @@ function createTypeChecker(host) {
|
|
|
57663
57660
|
}
|
|
57664
57661
|
}
|
|
57665
57662
|
}
|
|
57666
|
-
const assignments = symbol.assignmentDeclarationMembers;
|
|
57663
|
+
const assignments = (((_a = symbol.valueDeclaration) == null ? void 0 : _a.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */) && ((_c = getSymbolOfNode(symbol.valueDeclaration.parent)) == null ? void 0 : _c.assignmentDeclarationMembers) || symbol.assignmentDeclarationMembers;
|
|
57667
57664
|
if (assignments) {
|
|
57668
57665
|
const decls = arrayFrom(assignments.values());
|
|
57669
57666
|
for (const member of decls) {
|
|
@@ -57792,7 +57789,7 @@ function createTypeChecker(host) {
|
|
|
57792
57789
|
/*resolvedTypePredicate*/
|
|
57793
57790
|
void 0,
|
|
57794
57791
|
sig.minArgumentCount,
|
|
57795
|
-
sig.flags &
|
|
57792
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
57796
57793
|
);
|
|
57797
57794
|
result.target = sig.target;
|
|
57798
57795
|
result.mapper = sig.mapper;
|
|
@@ -58093,7 +58090,7 @@ function createTypeChecker(host) {
|
|
|
58093
58090
|
/*resolvedTypePredicate*/
|
|
58094
58091
|
void 0,
|
|
58095
58092
|
minArgCount,
|
|
58096
|
-
(left.flags | right.flags) &
|
|
58093
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
58097
58094
|
);
|
|
58098
58095
|
result.compositeKind = 1048576 /* Union */;
|
|
58099
58096
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -58303,7 +58300,7 @@ function createTypeChecker(host) {
|
|
|
58303
58300
|
/*resolvedTypePredicate*/
|
|
58304
58301
|
void 0,
|
|
58305
58302
|
sig.minArgumentCount,
|
|
58306
|
-
sig.flags &
|
|
58303
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
58307
58304
|
) : void 0
|
|
58308
58305
|
));
|
|
58309
58306
|
}
|
|
@@ -63086,7 +63083,7 @@ function createTypeChecker(host) {
|
|
|
63086
63083
|
/*resolvedTypePredicate*/
|
|
63087
63084
|
void 0,
|
|
63088
63085
|
signature.minArgumentCount,
|
|
63089
|
-
signature.flags &
|
|
63086
|
+
signature.flags & 167 /* PropagatingFlags */
|
|
63090
63087
|
);
|
|
63091
63088
|
result.target = signature;
|
|
63092
63089
|
result.mapper = mapper;
|
|
@@ -70347,12 +70344,15 @@ function createTypeChecker(host) {
|
|
|
70347
70344
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
70348
70345
|
}
|
|
70349
70346
|
const target = getReferenceCandidate(expr.right);
|
|
70350
|
-
|
|
70351
|
-
|
|
70352
|
-
if (
|
|
70347
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target)) {
|
|
70348
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
70349
|
+
if (isTypeUsableAsPropertyName(leftType) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
70353
70350
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
70354
70351
|
}
|
|
70355
|
-
|
|
70352
|
+
}
|
|
70353
|
+
if (isMatchingReference(reference, target)) {
|
|
70354
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
70355
|
+
if (isTypeUsableAsPropertyName(leftType)) {
|
|
70356
70356
|
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
70357
70357
|
}
|
|
70358
70358
|
}
|
|
@@ -70617,15 +70617,6 @@ function createTypeChecker(host) {
|
|
|
70617
70617
|
return type;
|
|
70618
70618
|
}
|
|
70619
70619
|
const rightType = getTypeOfExpression(expr.right);
|
|
70620
|
-
const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(rightType);
|
|
70621
|
-
if (hasInstanceMethodType) {
|
|
70622
|
-
const syntheticCall = createSyntheticHasInstanceMethodCall(left, expr.right, type, hasInstanceMethodType);
|
|
70623
|
-
const signature = getEffectsSignature(syntheticCall);
|
|
70624
|
-
const predicate = signature && getTypePredicateOfSignature(signature);
|
|
70625
|
-
if (predicate && (predicate.kind === 0 /* This */ || predicate.kind === 1 /* Identifier */)) {
|
|
70626
|
-
return narrowTypeByTypePredicate(type, predicate, syntheticCall, assumeTrue);
|
|
70627
|
-
}
|
|
70628
|
-
}
|
|
70629
70620
|
if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
|
|
70630
70621
|
return type;
|
|
70631
70622
|
}
|
|
@@ -70705,12 +70696,8 @@ function createTypeChecker(host) {
|
|
|
70705
70696
|
}
|
|
70706
70697
|
function narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue) {
|
|
70707
70698
|
if (predicate.type && !(isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType))) {
|
|
70708
|
-
|
|
70699
|
+
const predicateArgument = getTypePredicateArgument(predicate, callExpression);
|
|
70709
70700
|
if (predicateArgument) {
|
|
70710
|
-
if (isSyntheticExpression(predicateArgument) && predicate.parameterIndex === 0 && isSyntheticHasInstanceMethodCall(callExpression)) {
|
|
70711
|
-
Debug.assertNode(predicateArgument.parent, isExpression);
|
|
70712
|
-
predicateArgument = predicateArgument.parent;
|
|
70713
|
-
}
|
|
70714
70701
|
if (isMatchingReference(reference, predicateArgument)) {
|
|
70715
70702
|
return getNarrowedType(
|
|
70716
70703
|
type,
|
|
@@ -72548,7 +72535,7 @@ function createTypeChecker(host) {
|
|
|
72548
72535
|
/*resolvedTypePredicate*/
|
|
72549
72536
|
void 0,
|
|
72550
72537
|
minArgCount,
|
|
72551
|
-
(left.flags | right.flags) &
|
|
72538
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
72552
72539
|
);
|
|
72553
72540
|
result.compositeKind = 2097152 /* Intersection */;
|
|
72554
72541
|
result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -74082,7 +74069,7 @@ function createTypeChecker(host) {
|
|
|
74082
74069
|
}
|
|
74083
74070
|
let diagnosticMessage;
|
|
74084
74071
|
const declarationName = idText(right);
|
|
74085
|
-
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (
|
|
74072
|
+
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
74086
74073
|
diagnosticMessage = error2(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
74087
74074
|
} else if (valueDeclaration.kind === 263 /* ClassDeclaration */ && node.parent.kind !== 183 /* TypeReference */ && !(valueDeclaration.flags & 33554432 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
|
|
74088
74075
|
diagnosticMessage = error2(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
@@ -75287,7 +75274,7 @@ function createTypeChecker(host) {
|
|
|
75287
75274
|
}
|
|
75288
75275
|
return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
|
|
75289
75276
|
}
|
|
75290
|
-
function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags,
|
|
75277
|
+
function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, headMessage) {
|
|
75291
75278
|
const isTaggedTemplate = node.kind === 215 /* TaggedTemplateExpression */;
|
|
75292
75279
|
const isDecorator2 = node.kind === 170 /* Decorator */;
|
|
75293
75280
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
@@ -75330,7 +75317,6 @@ function createTypeChecker(host) {
|
|
|
75330
75317
|
chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error);
|
|
75331
75318
|
chain = chainDiagnosticMessages(chain, Diagnostics.No_overload_matches_this_call);
|
|
75332
75319
|
}
|
|
75333
|
-
const headMessage = headMessageCallback == null ? void 0 : headMessageCallback();
|
|
75334
75320
|
if (headMessage) {
|
|
75335
75321
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
75336
75322
|
}
|
|
@@ -75398,7 +75384,6 @@ function createTypeChecker(host) {
|
|
|
75398
75384
|
map(diags, createDiagnosticMessageChainFromDiagnostic),
|
|
75399
75385
|
Diagnostics.No_overload_matches_this_call
|
|
75400
75386
|
);
|
|
75401
|
-
const headMessage = headMessageCallback == null ? void 0 : headMessageCallback();
|
|
75402
75387
|
if (headMessage) {
|
|
75403
75388
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
75404
75389
|
}
|
|
@@ -75414,21 +75399,21 @@ function createTypeChecker(host) {
|
|
|
75414
75399
|
diagnostics.add(diag2);
|
|
75415
75400
|
}
|
|
75416
75401
|
} else if (candidateForArgumentArityError) {
|
|
75417
|
-
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args,
|
|
75402
|
+
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args, headMessage));
|
|
75418
75403
|
} else if (candidateForTypeArgumentError) {
|
|
75419
75404
|
checkTypeArguments(
|
|
75420
75405
|
candidateForTypeArgumentError,
|
|
75421
75406
|
node.typeArguments,
|
|
75422
75407
|
/*reportErrors*/
|
|
75423
75408
|
true,
|
|
75424
|
-
|
|
75409
|
+
headMessage
|
|
75425
75410
|
);
|
|
75426
75411
|
} else {
|
|
75427
75412
|
const signaturesWithCorrectTypeArgumentArity = filter(signatures, (s) => hasCorrectTypeArgumentArity(s, typeArguments));
|
|
75428
75413
|
if (signaturesWithCorrectTypeArgumentArity.length === 0) {
|
|
75429
|
-
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments,
|
|
75414
|
+
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments, headMessage));
|
|
75430
75415
|
} else {
|
|
75431
|
-
diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args,
|
|
75416
|
+
diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args, headMessage));
|
|
75432
75417
|
}
|
|
75433
75418
|
}
|
|
75434
75419
|
}
|
|
@@ -75579,7 +75564,7 @@ function createTypeChecker(host) {
|
|
|
75579
75564
|
parameters.push(createCombinedSymbolFromTypes(symbols, mapDefined(candidates, (candidate) => tryGetTypeAtPosition(candidate, i))));
|
|
75580
75565
|
}
|
|
75581
75566
|
const restParameterSymbols = mapDefined(candidates, (c) => signatureHasRestParameter(c) ? last(c.parameters) : void 0);
|
|
75582
|
-
let flags =
|
|
75567
|
+
let flags = 128 /* IsSignatureCandidateForOverloadFailure */;
|
|
75583
75568
|
if (restParameterSymbols.length !== 0) {
|
|
75584
75569
|
const type = createArrayType(getUnionType(mapDefined(candidates, tryGetRestTypeOfSignature), 2 /* Subtype */));
|
|
75585
75570
|
parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type));
|
|
@@ -75736,7 +75721,7 @@ function createTypeChecker(host) {
|
|
|
75736
75721
|
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
75737
75722
|
return resolveErrorCall(node);
|
|
75738
75723
|
}
|
|
75739
|
-
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags
|
|
75724
|
+
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
75740
75725
|
}
|
|
75741
75726
|
function isGenericFunctionReturningFunction(signature) {
|
|
75742
75727
|
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
@@ -76033,7 +76018,7 @@ function createTypeChecker(host) {
|
|
|
76033
76018
|
invocationErrorRecovery(apparentType, 0 /* Call */, diag2);
|
|
76034
76019
|
return resolveErrorCall(node);
|
|
76035
76020
|
}
|
|
76036
|
-
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */,
|
|
76021
|
+
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */, headMessage);
|
|
76037
76022
|
}
|
|
76038
76023
|
function createSignatureForJSXIntrinsic(node, result) {
|
|
76039
76024
|
const namespace = getJsxNamespaceAt(node);
|
|
@@ -76303,6 +76288,8 @@ function createTypeChecker(host) {
|
|
|
76303
76288
|
return returnType;
|
|
76304
76289
|
}
|
|
76305
76290
|
function checkDeprecatedSignature(signature, node) {
|
|
76291
|
+
if (signature.flags & 128 /* IsSignatureCandidateForOverloadFailure */)
|
|
76292
|
+
return;
|
|
76306
76293
|
if (signature.declaration && signature.declaration.flags & 536870912 /* Deprecated */) {
|
|
76307
76294
|
const suggestionNode = getDeprecatedSuggestionNode(node);
|
|
76308
76295
|
const name = tryGetPropertyAccessOrIdentifierToString(getInvokedExpression(node));
|
|
@@ -78066,32 +78053,6 @@ function createTypeChecker(host) {
|
|
|
78066
78053
|
function isConstEnumSymbol(symbol) {
|
|
78067
78054
|
return (symbol.flags & 128 /* ConstEnum */) !== 0;
|
|
78068
78055
|
}
|
|
78069
|
-
function getSymbolHasInstanceMethodOfObjectType(type) {
|
|
78070
|
-
const hasInstancePropertyName = getPropertyNameForKnownSymbolName("hasInstance");
|
|
78071
|
-
const hasInstanceProperty = getPropertyOfObjectType(type, hasInstancePropertyName);
|
|
78072
|
-
if (hasInstanceProperty) {
|
|
78073
|
-
const hasInstancePropertyType = getTypeOfSymbol(hasInstanceProperty);
|
|
78074
|
-
if (hasInstancePropertyType && getSignaturesOfType(hasInstancePropertyType, 0 /* Call */).length !== 0) {
|
|
78075
|
-
return hasInstancePropertyType;
|
|
78076
|
-
}
|
|
78077
|
-
}
|
|
78078
|
-
}
|
|
78079
|
-
function createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType) {
|
|
78080
|
-
const syntheticExpression = createSyntheticExpression(right, hasInstanceMethodType);
|
|
78081
|
-
const syntheticArgument = createSyntheticExpression(left, leftType);
|
|
78082
|
-
const syntheticCall = parseNodeFactory.createCallExpression(
|
|
78083
|
-
syntheticExpression,
|
|
78084
|
-
/*typeArguments*/
|
|
78085
|
-
void 0,
|
|
78086
|
-
[syntheticArgument]
|
|
78087
|
-
);
|
|
78088
|
-
setParent(syntheticCall, left.parent);
|
|
78089
|
-
setTextRange(syntheticCall, left.parent);
|
|
78090
|
-
return syntheticCall;
|
|
78091
|
-
}
|
|
78092
|
-
function isSyntheticHasInstanceMethodCall(node) {
|
|
78093
|
-
return isSyntheticExpression(node.expression) && node.arguments.length === 1 && isSyntheticExpression(node.arguments[0]) && isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 104 /* InstanceOfKeyword */ && node.parent.right === node.expression.parent && node.parent.left === node.arguments[0].parent;
|
|
78094
|
-
}
|
|
78095
78056
|
function checkInstanceOfExpression(left, right, leftType, rightType) {
|
|
78096
78057
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
78097
78058
|
return silentNeverType;
|
|
@@ -78099,31 +78060,8 @@ function createTypeChecker(host) {
|
|
|
78099
78060
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
|
|
78100
78061
|
error2(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
78101
78062
|
}
|
|
78102
|
-
if (!isTypeAny(rightType)) {
|
|
78103
|
-
|
|
78104
|
-
if (hasInstanceMethodType) {
|
|
78105
|
-
const cache = hasInstanceMethodType;
|
|
78106
|
-
if (cache.hasSimpleUnrestrictedSingleCallSignature === void 0) {
|
|
78107
|
-
const signature = getSingleCallSignature(hasInstanceMethodType);
|
|
78108
|
-
cache.hasSimpleUnrestrictedSingleCallSignature = !!signature && signature.parameters.length === 1 && !!(getTypeOfSymbol(signature.parameters[0]).flags & 3 /* AnyOrUnknown */) && !!signature.resolvedReturnType && !!(signature.resolvedReturnType.flags & 16 /* Boolean */);
|
|
78109
|
-
}
|
|
78110
|
-
if (!cache.hasSimpleUnrestrictedSingleCallSignature) {
|
|
78111
|
-
const syntheticCall = createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType);
|
|
78112
|
-
const returnType = getReturnTypeOfSignature(getResolvedSignature(syntheticCall));
|
|
78113
|
-
checkTypeAssignableTo(returnType, booleanType, right, Diagnostics.An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression);
|
|
78114
|
-
}
|
|
78115
|
-
}
|
|
78116
|
-
if (!(hasInstanceMethodType || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
78117
|
-
if (hasGlobalSymbolHasInstanceProperty === void 0) {
|
|
78118
|
-
const globalESSymbolConstructorSymbol = getGlobalESSymbolConstructorTypeSymbol(
|
|
78119
|
-
/*reportErrors*/
|
|
78120
|
-
false
|
|
78121
|
-
);
|
|
78122
|
-
hasGlobalSymbolHasInstanceProperty = !!globalESSymbolConstructorSymbol && getMembersOfSymbol(globalESSymbolConstructorSymbol).has("hasInstance");
|
|
78123
|
-
}
|
|
78124
|
-
const message = hasGlobalSymbolHasInstanceProperty ? Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_an_object_type_with_a_Symbol_hasInstance_method_or_a_type_assignable_to_the_Function_interface_type : Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type;
|
|
78125
|
-
error2(right, message);
|
|
78126
|
-
}
|
|
78063
|
+
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
78064
|
+
error2(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
|
|
78127
78065
|
}
|
|
78128
78066
|
return booleanType;
|
|
78129
78067
|
}
|
|
@@ -79825,7 +79763,7 @@ function createTypeChecker(host) {
|
|
|
79825
79763
|
case "length":
|
|
79826
79764
|
case "caller":
|
|
79827
79765
|
case "arguments":
|
|
79828
|
-
if (
|
|
79766
|
+
if (useDefineForClassFields) {
|
|
79829
79767
|
break;
|
|
79830
79768
|
}
|
|
79831
79769
|
case "prototype":
|
|
@@ -79973,7 +79911,7 @@ function createTypeChecker(host) {
|
|
|
79973
79911
|
if (classExtendsNull) {
|
|
79974
79912
|
error2(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
79975
79913
|
}
|
|
79976
|
-
const superCallShouldBeRootLevel =
|
|
79914
|
+
const superCallShouldBeRootLevel = !useDefineForClassFields && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
|
|
79977
79915
|
if (superCallShouldBeRootLevel) {
|
|
79978
79916
|
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
79979
79917
|
error2(superCall, Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
@@ -83243,7 +83181,7 @@ function createTypeChecker(host) {
|
|
|
83243
83181
|
node
|
|
83244
83182
|
);
|
|
83245
83183
|
const willTransformPrivateElementsOrClassStaticBlocks = languageVersion <= 9 /* ES2022 */;
|
|
83246
|
-
const willTransformInitializers = !useDefineForClassFields
|
|
83184
|
+
const willTransformInitializers = !useDefineForClassFields;
|
|
83247
83185
|
if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) {
|
|
83248
83186
|
for (const member of node.members) {
|
|
83249
83187
|
if (willTransformStaticElementsOfDecoratedClass && classElementOrClassElementParameterIsDecorated(
|
|
@@ -159202,7 +159140,8 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159202
159140
|
const leftMostName = getLeftMostName(computedPropertyName.expression);
|
|
159203
159141
|
const nameSymbol = leftMostName && typeChecker.getSymbolAtLocation(leftMostName);
|
|
159204
159142
|
const firstAccessibleSymbol = nameSymbol && getFirstSymbolInChain(nameSymbol, contextToken, typeChecker);
|
|
159205
|
-
|
|
159143
|
+
const firstAccessibleSymbolId = firstAccessibleSymbol && getSymbolId(firstAccessibleSymbol);
|
|
159144
|
+
if (firstAccessibleSymbolId && addToSeen(seenPropertySymbols, firstAccessibleSymbolId)) {
|
|
159206
159145
|
const index = symbols.length;
|
|
159207
159146
|
symbols.push(firstAccessibleSymbol);
|
|
159208
159147
|
const moduleSymbol = firstAccessibleSymbol.parent;
|
|
@@ -159232,6 +159171,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159232
159171
|
}
|
|
159233
159172
|
}
|
|
159234
159173
|
} else if (preferences.includeCompletionsWithInsertText) {
|
|
159174
|
+
if (firstAccessibleSymbolId && seenPropertySymbols.has(firstAccessibleSymbolId)) {
|
|
159175
|
+
return;
|
|
159176
|
+
}
|
|
159235
159177
|
addSymbolOriginInfo(symbol);
|
|
159236
159178
|
addSymbolSortInfo(symbol);
|
|
159237
159179
|
symbols.push(symbol);
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -5139,7 +5139,7 @@ declare namespace ts {
|
|
|
5139
5139
|
readonly asteriskToken?: AsteriskToken;
|
|
5140
5140
|
readonly expression?: Expression;
|
|
5141
5141
|
}
|
|
5142
|
-
interface SyntheticExpression extends
|
|
5142
|
+
interface SyntheticExpression extends Expression {
|
|
5143
5143
|
readonly kind: SyntaxKind.SyntheticExpression;
|
|
5144
5144
|
readonly isSpread: boolean;
|
|
5145
5145
|
readonly type: Type;
|