@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 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.20230718`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230720`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -3762,7 +3762,8 @@ var SignatureFlags = /* @__PURE__ */ ((SignatureFlags4) => {
3762
3762
  SignatureFlags4[SignatureFlags4["IsOuterCallChain"] = 16] = "IsOuterCallChain";
3763
3763
  SignatureFlags4[SignatureFlags4["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile";
3764
3764
  SignatureFlags4[SignatureFlags4["IsNonInferrable"] = 64] = "IsNonInferrable";
3765
- SignatureFlags4[SignatureFlags4["PropagatingFlags"] = 39] = "PropagatingFlags";
3765
+ SignatureFlags4[SignatureFlags4["IsSignatureCandidateForOverloadFailure"] = 128] = "IsSignatureCandidateForOverloadFailure";
3766
+ SignatureFlags4[SignatureFlags4["PropagatingFlags"] = 167] = "PropagatingFlags";
3766
3767
  SignatureFlags4[SignatureFlags4["CallChainFlags"] = 24] = "CallChainFlags";
3767
3768
  return SignatureFlags4;
3768
3769
  })(SignatureFlags || {});
@@ -6668,9 +6669,6 @@ var Diagnostics = {
6668
6669
  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."),
6669
6670
  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."),
6670
6671
  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."),
6671
- 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."),
6672
- 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."),
6673
- 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."),
6674
6672
  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}'."),
6675
6673
  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}'."),
6676
6674
  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}'."),
@@ -10994,7 +10992,6 @@ function isLeftHandSideExpressionKind(kind) {
10994
10992
  case 236 /* MetaProperty */:
10995
10993
  case 102 /* ImportKeyword */:
10996
10994
  case 282 /* MissingDeclaration */:
10997
- case 237 /* SyntheticExpression */:
10998
10995
  return true;
10999
10996
  default:
11000
10997
  return false;
@@ -24275,9 +24272,6 @@ function isNonNullExpression(node) {
24275
24272
  function isMetaProperty(node) {
24276
24273
  return node.kind === 236 /* MetaProperty */;
24277
24274
  }
24278
- function isSyntheticExpression(node) {
24279
- return node.kind === 237 /* SyntheticExpression */;
24280
- }
24281
24275
  function isPartiallyEmittedExpression(node) {
24282
24276
  return node.kind === 360 /* PartiallyEmittedExpression */;
24283
24277
  }
@@ -43870,7 +43864,6 @@ function createTypeChecker(host) {
43870
43864
  var potentialReflectCollisions = [];
43871
43865
  var potentialUnusedRenamedBindingElementsInTypes = [];
43872
43866
  var awaitedTypeStack = [];
43873
- var hasGlobalSymbolHasInstanceProperty;
43874
43867
  var diagnostics = createDiagnosticCollection();
43875
43868
  var suggestionDiagnostics = createDiagnosticCollection();
43876
43869
  var typeofType = createTypeofType();
@@ -44382,7 +44375,7 @@ function createTypeChecker(host) {
44382
44375
  false
44383
44376
  );
44384
44377
  } else if (isParameterPropertyDeclaration(declaration, declaration.parent)) {
44385
- return !(getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ && useDefineForClassFields && getContainingClass(declaration) === getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration));
44378
+ return !(useDefineForClassFields && getContainingClass(declaration) === getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration));
44386
44379
  }
44387
44380
  return true;
44388
44381
  }
@@ -44396,7 +44389,7 @@ function createTypeChecker(host) {
44396
44389
  return true;
44397
44390
  }
44398
44391
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
44399
- if (getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */ && useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
44392
+ if (useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
44400
44393
  return !isPropertyImmediatelyReferencedWithinDeclaration(
44401
44394
  declaration,
44402
44395
  usage,
@@ -44520,7 +44513,7 @@ function createTypeChecker(host) {
44520
44513
  return requiresScopeChangeWorker(node.name);
44521
44514
  case 172 /* PropertyDeclaration */:
44522
44515
  if (hasStaticModifier(node)) {
44523
- return target < 99 /* ESNext */ || !useDefineForClassFields;
44516
+ return !useDefineForClassFields;
44524
44517
  }
44525
44518
  return requiresScopeChangeWorker(node.name);
44526
44519
  default:
@@ -44559,7 +44552,7 @@ function createTypeChecker(host) {
44559
44552
  if (name === "const" && isConstAssertion(location)) {
44560
44553
  return void 0;
44561
44554
  }
44562
- if (isModuleDeclaration(location) && lastLocation && location.name === lastLocation) {
44555
+ if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
44563
44556
  lastLocation = location;
44564
44557
  location = location.parent;
44565
44558
  }
@@ -44791,7 +44784,7 @@ function createTypeChecker(host) {
44791
44784
  }
44792
44785
  }
44793
44786
  function checkAndReportErrorForInvalidInitializer() {
44794
- if (propertyWithInvalidInitializer && !(useDefineForClassFields && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */)) {
44787
+ if (propertyWithInvalidInitializer && !useDefineForClassFields) {
44795
44788
  error(
44796
44789
  errorLocation,
44797
44790
  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,
@@ -51581,7 +51574,7 @@ function createTypeChecker(host) {
51581
51574
  false,
51582
51575
  definedInMethod && !definedInConstructor
51583
51576
  ));
51584
- if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
51577
+ if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
51585
51578
  reportImplicitAny(symbol.valueDeclaration, anyType);
51586
51579
  return anyType;
51587
51580
  }
@@ -52941,6 +52934,7 @@ function createTypeChecker(host) {
52941
52934
  return links.resolvedSymbol;
52942
52935
  }
52943
52936
  function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
52937
+ var _a, _b, _c;
52944
52938
  const links = getSymbolLinks(symbol);
52945
52939
  if (!links[resolutionKind]) {
52946
52940
  const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
@@ -52959,7 +52953,7 @@ function createTypeChecker(host) {
52959
52953
  }
52960
52954
  }
52961
52955
  }
52962
- const assignments = symbol.assignmentDeclarationMembers;
52956
+ 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;
52963
52957
  if (assignments) {
52964
52958
  const decls = arrayFrom(assignments.values());
52965
52959
  for (const member of decls) {
@@ -53088,7 +53082,7 @@ function createTypeChecker(host) {
53088
53082
  /*resolvedTypePredicate*/
53089
53083
  void 0,
53090
53084
  sig.minArgumentCount,
53091
- sig.flags & 39 /* PropagatingFlags */
53085
+ sig.flags & 167 /* PropagatingFlags */
53092
53086
  );
53093
53087
  result.target = sig.target;
53094
53088
  result.mapper = sig.mapper;
@@ -53389,7 +53383,7 @@ function createTypeChecker(host) {
53389
53383
  /*resolvedTypePredicate*/
53390
53384
  void 0,
53391
53385
  minArgCount,
53392
- (left.flags | right.flags) & 39 /* PropagatingFlags */
53386
+ (left.flags | right.flags) & 167 /* PropagatingFlags */
53393
53387
  );
53394
53388
  result.compositeKind = 1048576 /* Union */;
53395
53389
  result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
@@ -53599,7 +53593,7 @@ function createTypeChecker(host) {
53599
53593
  /*resolvedTypePredicate*/
53600
53594
  void 0,
53601
53595
  sig.minArgumentCount,
53602
- sig.flags & 39 /* PropagatingFlags */
53596
+ sig.flags & 167 /* PropagatingFlags */
53603
53597
  ) : void 0
53604
53598
  ));
53605
53599
  }
@@ -58382,7 +58376,7 @@ function createTypeChecker(host) {
58382
58376
  /*resolvedTypePredicate*/
58383
58377
  void 0,
58384
58378
  signature.minArgumentCount,
58385
- signature.flags & 39 /* PropagatingFlags */
58379
+ signature.flags & 167 /* PropagatingFlags */
58386
58380
  );
58387
58381
  result.target = signature;
58388
58382
  result.mapper = mapper;
@@ -65643,12 +65637,15 @@ function createTypeChecker(host) {
65643
65637
  return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
65644
65638
  }
65645
65639
  const target = getReferenceCandidate(expr.right);
65646
- const leftType = getTypeOfExpression(expr.left);
65647
- if (leftType.flags & 8576 /* StringOrNumberLiteralOrUnique */) {
65648
- if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
65640
+ if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target)) {
65641
+ const leftType = getTypeOfExpression(expr.left);
65642
+ if (isTypeUsableAsPropertyName(leftType) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
65649
65643
  return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
65650
65644
  }
65651
- if (isMatchingReference(reference, target)) {
65645
+ }
65646
+ if (isMatchingReference(reference, target)) {
65647
+ const leftType = getTypeOfExpression(expr.left);
65648
+ if (isTypeUsableAsPropertyName(leftType)) {
65652
65649
  return narrowTypeByInKeyword(type, leftType, assumeTrue);
65653
65650
  }
65654
65651
  }
@@ -65913,15 +65910,6 @@ function createTypeChecker(host) {
65913
65910
  return type;
65914
65911
  }
65915
65912
  const rightType = getTypeOfExpression(expr.right);
65916
- const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(rightType);
65917
- if (hasInstanceMethodType) {
65918
- const syntheticCall = createSyntheticHasInstanceMethodCall(left, expr.right, type, hasInstanceMethodType);
65919
- const signature = getEffectsSignature(syntheticCall);
65920
- const predicate = signature && getTypePredicateOfSignature(signature);
65921
- if (predicate && (predicate.kind === 0 /* This */ || predicate.kind === 1 /* Identifier */)) {
65922
- return narrowTypeByTypePredicate(type, predicate, syntheticCall, assumeTrue);
65923
- }
65924
- }
65925
65913
  if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
65926
65914
  return type;
65927
65915
  }
@@ -66001,12 +65989,8 @@ function createTypeChecker(host) {
66001
65989
  }
66002
65990
  function narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue) {
66003
65991
  if (predicate.type && !(isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType))) {
66004
- let predicateArgument = getTypePredicateArgument(predicate, callExpression);
65992
+ const predicateArgument = getTypePredicateArgument(predicate, callExpression);
66005
65993
  if (predicateArgument) {
66006
- if (isSyntheticExpression(predicateArgument) && predicate.parameterIndex === 0 && isSyntheticHasInstanceMethodCall(callExpression)) {
66007
- Debug.assertNode(predicateArgument.parent, isExpression);
66008
- predicateArgument = predicateArgument.parent;
66009
- }
66010
65994
  if (isMatchingReference(reference, predicateArgument)) {
66011
65995
  return getNarrowedType(
66012
65996
  type,
@@ -67844,7 +67828,7 @@ function createTypeChecker(host) {
67844
67828
  /*resolvedTypePredicate*/
67845
67829
  void 0,
67846
67830
  minArgCount,
67847
- (left.flags | right.flags) & 39 /* PropagatingFlags */
67831
+ (left.flags | right.flags) & 167 /* PropagatingFlags */
67848
67832
  );
67849
67833
  result.compositeKind = 2097152 /* Intersection */;
67850
67834
  result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
@@ -69378,7 +69362,7 @@ function createTypeChecker(host) {
69378
69362
  }
69379
69363
  let diagnosticMessage;
69380
69364
  const declarationName = idText(right);
69381
- if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
69365
+ if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
69382
69366
  diagnosticMessage = error(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
69383
69367
  } else if (valueDeclaration.kind === 263 /* ClassDeclaration */ && node.parent.kind !== 183 /* TypeReference */ && !(valueDeclaration.flags & 33554432 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
69384
69368
  diagnosticMessage = error(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
@@ -70583,7 +70567,7 @@ function createTypeChecker(host) {
70583
70567
  }
70584
70568
  return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
70585
70569
  }
70586
- function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, headMessageCallback) {
70570
+ function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, headMessage) {
70587
70571
  const isTaggedTemplate = node.kind === 215 /* TaggedTemplateExpression */;
70588
70572
  const isDecorator2 = node.kind === 170 /* Decorator */;
70589
70573
  const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
@@ -70626,7 +70610,6 @@ function createTypeChecker(host) {
70626
70610
  chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error);
70627
70611
  chain = chainDiagnosticMessages(chain, Diagnostics.No_overload_matches_this_call);
70628
70612
  }
70629
- const headMessage = headMessageCallback == null ? void 0 : headMessageCallback();
70630
70613
  if (headMessage) {
70631
70614
  chain = chainDiagnosticMessages(chain, headMessage);
70632
70615
  }
@@ -70694,7 +70677,6 @@ function createTypeChecker(host) {
70694
70677
  map(diags, createDiagnosticMessageChainFromDiagnostic),
70695
70678
  Diagnostics.No_overload_matches_this_call
70696
70679
  );
70697
- const headMessage = headMessageCallback == null ? void 0 : headMessageCallback();
70698
70680
  if (headMessage) {
70699
70681
  chain = chainDiagnosticMessages(chain, headMessage);
70700
70682
  }
@@ -70710,21 +70692,21 @@ function createTypeChecker(host) {
70710
70692
  diagnostics.add(diag2);
70711
70693
  }
70712
70694
  } else if (candidateForArgumentArityError) {
70713
- diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args, headMessageCallback == null ? void 0 : headMessageCallback()));
70695
+ diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args, headMessage));
70714
70696
  } else if (candidateForTypeArgumentError) {
70715
70697
  checkTypeArguments(
70716
70698
  candidateForTypeArgumentError,
70717
70699
  node.typeArguments,
70718
70700
  /*reportErrors*/
70719
70701
  true,
70720
- headMessageCallback == null ? void 0 : headMessageCallback()
70702
+ headMessage
70721
70703
  );
70722
70704
  } else {
70723
70705
  const signaturesWithCorrectTypeArgumentArity = filter(signatures, (s) => hasCorrectTypeArgumentArity(s, typeArguments));
70724
70706
  if (signaturesWithCorrectTypeArgumentArity.length === 0) {
70725
- diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments, headMessageCallback == null ? void 0 : headMessageCallback()));
70707
+ diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments, headMessage));
70726
70708
  } else {
70727
- diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args, headMessageCallback == null ? void 0 : headMessageCallback()));
70709
+ diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args, headMessage));
70728
70710
  }
70729
70711
  }
70730
70712
  }
@@ -70875,7 +70857,7 @@ function createTypeChecker(host) {
70875
70857
  parameters.push(createCombinedSymbolFromTypes(symbols, mapDefined(candidates, (candidate) => tryGetTypeAtPosition(candidate, i))));
70876
70858
  }
70877
70859
  const restParameterSymbols = mapDefined(candidates, (c) => signatureHasRestParameter(c) ? last(c.parameters) : void 0);
70878
- let flags = 0 /* None */;
70860
+ let flags = 128 /* IsSignatureCandidateForOverloadFailure */;
70879
70861
  if (restParameterSymbols.length !== 0) {
70880
70862
  const type = createArrayType(getUnionType(mapDefined(candidates, tryGetRestTypeOfSignature), 2 /* Subtype */));
70881
70863
  parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type));
@@ -71032,7 +71014,7 @@ function createTypeChecker(host) {
71032
71014
  error(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
71033
71015
  return resolveErrorCall(node);
71034
71016
  }
71035
- return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags, () => isSyntheticHasInstanceMethodCall(node) ? Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method : void 0);
71017
+ return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
71036
71018
  }
71037
71019
  function isGenericFunctionReturningFunction(signature) {
71038
71020
  return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
@@ -71329,7 +71311,7 @@ function createTypeChecker(host) {
71329
71311
  invocationErrorRecovery(apparentType, 0 /* Call */, diag2);
71330
71312
  return resolveErrorCall(node);
71331
71313
  }
71332
- return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */, () => headMessage);
71314
+ return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */, headMessage);
71333
71315
  }
71334
71316
  function createSignatureForJSXIntrinsic(node, result) {
71335
71317
  const namespace = getJsxNamespaceAt(node);
@@ -71599,6 +71581,8 @@ function createTypeChecker(host) {
71599
71581
  return returnType;
71600
71582
  }
71601
71583
  function checkDeprecatedSignature(signature, node) {
71584
+ if (signature.flags & 128 /* IsSignatureCandidateForOverloadFailure */)
71585
+ return;
71602
71586
  if (signature.declaration && signature.declaration.flags & 536870912 /* Deprecated */) {
71603
71587
  const suggestionNode = getDeprecatedSuggestionNode(node);
71604
71588
  const name = tryGetPropertyAccessOrIdentifierToString(getInvokedExpression(node));
@@ -73362,32 +73346,6 @@ function createTypeChecker(host) {
73362
73346
  function isConstEnumSymbol(symbol) {
73363
73347
  return (symbol.flags & 128 /* ConstEnum */) !== 0;
73364
73348
  }
73365
- function getSymbolHasInstanceMethodOfObjectType(type) {
73366
- const hasInstancePropertyName = getPropertyNameForKnownSymbolName("hasInstance");
73367
- const hasInstanceProperty = getPropertyOfObjectType(type, hasInstancePropertyName);
73368
- if (hasInstanceProperty) {
73369
- const hasInstancePropertyType = getTypeOfSymbol(hasInstanceProperty);
73370
- if (hasInstancePropertyType && getSignaturesOfType(hasInstancePropertyType, 0 /* Call */).length !== 0) {
73371
- return hasInstancePropertyType;
73372
- }
73373
- }
73374
- }
73375
- function createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType) {
73376
- const syntheticExpression = createSyntheticExpression(right, hasInstanceMethodType);
73377
- const syntheticArgument = createSyntheticExpression(left, leftType);
73378
- const syntheticCall = parseNodeFactory.createCallExpression(
73379
- syntheticExpression,
73380
- /*typeArguments*/
73381
- void 0,
73382
- [syntheticArgument]
73383
- );
73384
- setParent(syntheticCall, left.parent);
73385
- setTextRange(syntheticCall, left.parent);
73386
- return syntheticCall;
73387
- }
73388
- function isSyntheticHasInstanceMethodCall(node) {
73389
- 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;
73390
- }
73391
73349
  function checkInstanceOfExpression(left, right, leftType, rightType) {
73392
73350
  if (leftType === silentNeverType || rightType === silentNeverType) {
73393
73351
  return silentNeverType;
@@ -73395,31 +73353,8 @@ function createTypeChecker(host) {
73395
73353
  if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
73396
73354
  error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
73397
73355
  }
73398
- if (!isTypeAny(rightType)) {
73399
- const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(rightType);
73400
- if (hasInstanceMethodType) {
73401
- const cache = hasInstanceMethodType;
73402
- if (cache.hasSimpleUnrestrictedSingleCallSignature === void 0) {
73403
- const signature = getSingleCallSignature(hasInstanceMethodType);
73404
- cache.hasSimpleUnrestrictedSingleCallSignature = !!signature && signature.parameters.length === 1 && !!(getTypeOfSymbol(signature.parameters[0]).flags & 3 /* AnyOrUnknown */) && !!signature.resolvedReturnType && !!(signature.resolvedReturnType.flags & 16 /* Boolean */);
73405
- }
73406
- if (!cache.hasSimpleUnrestrictedSingleCallSignature) {
73407
- const syntheticCall = createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType);
73408
- const returnType = getReturnTypeOfSignature(getResolvedSignature(syntheticCall));
73409
- 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);
73410
- }
73411
- }
73412
- if (!(hasInstanceMethodType || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
73413
- if (hasGlobalSymbolHasInstanceProperty === void 0) {
73414
- const globalESSymbolConstructorSymbol = getGlobalESSymbolConstructorTypeSymbol(
73415
- /*reportErrors*/
73416
- false
73417
- );
73418
- hasGlobalSymbolHasInstanceProperty = !!globalESSymbolConstructorSymbol && getMembersOfSymbol(globalESSymbolConstructorSymbol).has("hasInstance");
73419
- }
73420
- 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;
73421
- error(right, message);
73422
- }
73356
+ if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
73357
+ error(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);
73423
73358
  }
73424
73359
  return booleanType;
73425
73360
  }
@@ -75121,7 +75056,7 @@ function createTypeChecker(host) {
75121
75056
  case "length":
75122
75057
  case "caller":
75123
75058
  case "arguments":
75124
- if (compilerOptions.useDefineForClassFields) {
75059
+ if (useDefineForClassFields) {
75125
75060
  break;
75126
75061
  }
75127
75062
  case "prototype":
@@ -75269,7 +75204,7 @@ function createTypeChecker(host) {
75269
75204
  if (classExtendsNull) {
75270
75205
  error(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
75271
75206
  }
75272
- const superCallShouldBeRootLevel = (getEmitScriptTarget(compilerOptions) !== 99 /* ESNext */ || !useDefineForClassFields) && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
75207
+ const superCallShouldBeRootLevel = !useDefineForClassFields && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
75273
75208
  if (superCallShouldBeRootLevel) {
75274
75209
  if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
75275
75210
  error(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);
@@ -78539,7 +78474,7 @@ function createTypeChecker(host) {
78539
78474
  node
78540
78475
  );
78541
78476
  const willTransformPrivateElementsOrClassStaticBlocks = languageVersion <= 9 /* ES2022 */;
78542
- const willTransformInitializers = !useDefineForClassFields || languageVersion < 9 /* ES2022 */;
78477
+ const willTransformInitializers = !useDefineForClassFields;
78543
78478
  if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) {
78544
78479
  for (const member of node.members) {
78545
78480
  if (willTransformStaticElementsOfDecoratedClass && classElementOrClassElementParameterIsDecorated(