@typescript-deploys/pr-build 5.3.0-pr-55887-24 → 5.3.0-pr-55924-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.3";
21
- var version = `${versionMajorMinor}.0-insiders.20230928`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230930`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6202,7 +6202,7 @@ var Diagnostics = {
6202
6202
  An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2356, 1 /* Error */, "An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type_2356", "An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type."),
6203
6203
  The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, 1 /* Error */, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
6204
6204
  The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
6205
- The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),
6205
+ The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_a_class_function_or_other_type_assignable_to_the_Function_interface_type_or_an_object_type_with_a_Symbol_hasInstance_method: diag(2359, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_a_class_function_or_other_2359", "The right-hand side of an 'instanceof' expression must be either of type 'any', a class, function, or other type assignable to the 'Function' interface type, or an object type with a 'Symbol.hasInstance' method."),
6206
6206
  The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, 1 /* Error */, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
6207
6207
  The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, 1 /* Error */, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
6208
6208
  The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, 1 /* Error */, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."),
@@ -6651,6 +6651,8 @@ var Diagnostics = {
6651
6651
  Import_attributes_cannot_be_used_with_type_only_imports_or_exports: diag(2857, 1 /* Error */, "Import_attributes_cannot_be_used_with_type_only_imports_or_exports_2857", "Import attributes cannot be used with type-only imports or exports."),
6652
6652
  Import_attribute_values_must_be_string_literal_expressions: diag(2858, 1 /* Error */, "Import_attribute_values_must_be_string_literal_expressions_2858", "Import attribute values must be string literal expressions."),
6653
6653
  Excessive_complexity_comparing_types_0_and_1: diag(2859, 1 /* Error */, "Excessive_complexity_comparing_types_0_and_1_2859", "Excessive complexity comparing types '{0}' and '{1}'."),
6654
+ 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(2860, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_2860", "The left-hand side of an 'instanceof' expression must be assignable to the first argument of the right-hand side's '[Symbol.hasInstance]' method."),
6655
+ 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(2861, 1 /* Error */, "An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_han_2861", "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."),
6654
6656
  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}'."),
6655
6657
  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}'."),
6656
6658
  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}'."),
@@ -6759,6 +6761,7 @@ var Diagnostics = {
6759
6761
  This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
6760
6762
  This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
6761
6763
  Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, 1 /* Error */, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
6764
+ The_values_of_0_1_differ_in_their_declarations_where_2_was_expected_but_3_was_given: diag(4125, 1 /* Error */, "The_values_of_0_1_differ_in_their_declarations_where_2_was_expected_but_3_was_given_4125", "The values of '{0}.{1}' differ in their declarations, where '{2}' was expected but '{3}' was given."),
6762
6765
  The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
6763
6766
  Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
6764
6767
  File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -10813,7 +10816,14 @@ function isAccessor(node) {
10813
10816
  function isAutoAccessorPropertyDeclaration(node) {
10814
10817
  return isPropertyDeclaration(node) && hasAccessorModifier(node);
10815
10818
  }
10816
- function isClassFieldAndNotAutoAccessor(node) {
10819
+ function isClassInstanceProperty(node) {
10820
+ if (isInJSFile(node) && isExpandoPropertyDeclaration(node)) {
10821
+ return (!isBindableStaticAccessExpression(node) || !isPrototypeAccess(node.expression)) && !isBindableStaticNameExpression(
10822
+ node,
10823
+ /*excludeThisKeyword*/
10824
+ true
10825
+ );
10826
+ }
10817
10827
  return node.parent && isClassLike(node.parent) && isPropertyDeclaration(node) && !hasAccessorModifier(node);
10818
10828
  }
10819
10829
  function isMethodOrAccessor(node) {
@@ -13076,6 +13086,8 @@ function getInvokedExpression(node) {
13076
13086
  case 286 /* JsxOpeningElement */:
13077
13087
  case 285 /* JsxSelfClosingElement */:
13078
13088
  return node.tagName;
13089
+ case 226 /* BinaryExpression */:
13090
+ return node.right;
13079
13091
  default:
13080
13092
  return node.expression;
13081
13093
  }
@@ -15582,6 +15594,12 @@ function isRightSideOfAccessExpression(node) {
15582
15594
  function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
15583
15595
  return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node || isJSDocMemberName(node.parent) && node.parent.right === node;
15584
15596
  }
15597
+ function isInstanceOfExpression(node) {
15598
+ return isBinaryExpression(node) && node.operatorToken.kind === 104 /* InstanceOfKeyword */;
15599
+ }
15600
+ function isRightSideOfInstanceofExpression(node) {
15601
+ return isInstanceOfExpression(node.parent) && node === node.parent.right;
15602
+ }
15585
15603
  function isEmptyObjectLiteral(expression) {
15586
15604
  return expression.kind === 210 /* ObjectLiteralExpression */ && expression.properties.length === 0;
15587
15605
  }
@@ -15861,9 +15879,6 @@ function accessKind(node) {
15861
15879
  return node === parent.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent.parent);
15862
15880
  case 209 /* ArrayLiteralExpression */:
15863
15881
  return accessKind(parent);
15864
- case 249 /* ForInStatement */:
15865
- case 250 /* ForOfStatement */:
15866
- return node === parent.initializer ? 1 /* Write */ : 0 /* Read */;
15867
15882
  default:
15868
15883
  return 0 /* Read */;
15869
15884
  }
@@ -43072,9 +43087,8 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
43072
43087
  CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
43073
43088
  CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
43074
43089
  CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
43075
- CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
43076
- CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
43077
- CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
43090
+ CheckMode3[CheckMode3["RestBindingElement"] = 32] = "RestBindingElement";
43091
+ CheckMode3[CheckMode3["TypeOnly"] = 64] = "TypeOnly";
43078
43092
  return CheckMode3;
43079
43093
  })(CheckMode || {});
43080
43094
  var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
@@ -43527,16 +43541,11 @@ function createTypeChecker(host) {
43527
43541
  checkSourceFileWithEagerDiagnostics(file);
43528
43542
  Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
43529
43543
  diagnostics2 = addRange(diagnostics2, suggestionDiagnostics.getDiagnostics(file.fileName));
43530
- checkUnusedOrUninitializedIdentifiers(
43531
- getPotentiallyUnusedOrUninitializedIdentifiers(file),
43532
- (containingNode, kind, diag2) => {
43533
- if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
43534
- (diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ });
43535
- }
43536
- },
43537
- /*checkUnused*/
43538
- true
43539
- );
43544
+ checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), (containingNode, kind, diag2) => {
43545
+ if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
43546
+ (diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ });
43547
+ }
43548
+ });
43540
43549
  return diagnostics2 || emptyArray;
43541
43550
  } finally {
43542
43551
  cancellationToken = void 0;
@@ -43566,7 +43575,7 @@ function createTypeChecker(host) {
43566
43575
  candidates,
43567
43576
  /*argumentCount*/
43568
43577
  void 0,
43569
- 32 /* IsForStringLiteralArgumentCompletions */
43578
+ 0 /* Normal */
43570
43579
  ));
43571
43580
  for (const candidate of candidates) {
43572
43581
  candidatesSet.add(candidate);
@@ -44033,7 +44042,7 @@ function createTypeChecker(host) {
44033
44042
  var deferredGlobalClassAccessorDecoratorTargetType;
44034
44043
  var deferredGlobalClassAccessorDecoratorResultType;
44035
44044
  var deferredGlobalClassFieldDecoratorContextType;
44036
- var allPotentiallyUnusedOrUninitializedIdentifiers = /* @__PURE__ */ new Map();
44045
+ var allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
44037
44046
  var flowLoopStart = 0;
44038
44047
  var flowLoopCount = 0;
44039
44048
  var sharedFlowCount = 0;
@@ -44744,10 +44753,10 @@ function createTypeChecker(host) {
44744
44753
  function isConstAssertion(location) {
44745
44754
  return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
44746
44755
  }
44747
- function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true, isWritten = false) {
44748
- return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, isWritten, getSymbol);
44756
+ function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true) {
44757
+ return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
44749
44758
  }
44750
- function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, isWritten, lookup) {
44759
+ function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
44751
44760
  var _a, _b, _c;
44752
44761
  const originalLocation = location;
44753
44762
  let result;
@@ -44973,9 +44982,6 @@ function createTypeChecker(host) {
44973
44982
  if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
44974
44983
  result.isReferenced |= meaning;
44975
44984
  }
44976
- if (isWritten && result) {
44977
- result.isAssigned = true;
44978
- }
44979
44985
  if (!result) {
44980
44986
  if (lastLocation) {
44981
44987
  Debug.assertNode(lastLocation, isSourceFile);
@@ -51604,7 +51610,7 @@ function createTypeChecker(host) {
51604
51610
  return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
51605
51611
  }
51606
51612
  function getTypeForBindingElement(declaration) {
51607
- const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
51613
+ const checkMode = declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
51608
51614
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
51609
51615
  return parentType && getBindingElementTypeFromParentType(
51610
51616
  declaration,
@@ -59945,12 +59951,12 @@ function createTypeChecker(host) {
59945
59951
  return !!(entry & 1 /* Succeeded */);
59946
59952
  }
59947
59953
  const targetEnumType = getTypeOfSymbol(targetSymbol);
59948
- for (const property of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) {
59949
- if (property.flags & 8 /* EnumMember */) {
59950
- const targetProperty = getPropertyOfType(targetEnumType, property.escapedName);
59954
+ for (const sourceProperty of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) {
59955
+ if (sourceProperty.flags & 8 /* EnumMember */) {
59956
+ const targetProperty = getPropertyOfType(targetEnumType, sourceProperty.escapedName);
59951
59957
  if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) {
59952
59958
  if (errorReporter) {
59953
- errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(property), typeToString(
59959
+ errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(sourceProperty), typeToString(
59954
59960
  getDeclaredTypeOfSymbol(targetSymbol),
59955
59961
  /*enclosingDeclaration*/
59956
59962
  void 0,
@@ -59962,6 +59968,19 @@ function createTypeChecker(host) {
59962
59968
  }
59963
59969
  return false;
59964
59970
  }
59971
+ const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, 306 /* EnumMember */));
59972
+ const targetValue = getEnumMemberValue(getDeclarationOfKind(targetProperty, 306 /* EnumMember */));
59973
+ if (sourceValue !== void 0 && targetValue !== void 0 && sourceValue !== targetValue) {
59974
+ if (errorReporter) {
59975
+ const escapedSource = typeof sourceValue === "string" ? `"${escapeString(sourceValue)}"` : sourceValue;
59976
+ const escapedTarget = typeof targetValue === "string" ? `"${escapeString(targetValue)}"` : targetValue;
59977
+ errorReporter(Diagnostics.The_values_of_0_1_differ_in_their_declarations_where_2_was_expected_but_3_was_given, symbolName(targetSymbol), symbolName(targetProperty), escapedTarget, escapedSource);
59978
+ enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
59979
+ } else {
59980
+ enumRelation.set(id, 2 /* Failed */);
59981
+ }
59982
+ return false;
59983
+ }
59965
59984
  }
59966
59985
  }
59967
59986
  enumRelation.set(id, 1 /* Succeeded */);
@@ -63771,7 +63790,7 @@ function createTypeChecker(host) {
63771
63790
  if (!couldContainTypeVariables(target)) {
63772
63791
  return;
63773
63792
  }
63774
- if (source === wildcardType) {
63793
+ if (source === wildcardType || source === blockedStringType) {
63775
63794
  const savePropagationType = propagationType;
63776
63795
  propagationType = source;
63777
63796
  inferFromTypes(target, target);
@@ -63828,6 +63847,10 @@ function createTypeChecker(host) {
63828
63847
  return;
63829
63848
  }
63830
63849
  if (!inference.isFixed) {
63850
+ const candidate = propagationType || source;
63851
+ if (candidate === blockedStringType) {
63852
+ return;
63853
+ }
63831
63854
  if (inference.priority === void 0 || priority < inference.priority) {
63832
63855
  inference.candidates = void 0;
63833
63856
  inference.contraCandidates = void 0;
@@ -63835,7 +63858,6 @@ function createTypeChecker(host) {
63835
63858
  inference.priority = priority;
63836
63859
  }
63837
63860
  if (priority === inference.priority) {
63838
- const candidate = propagationType || source;
63839
63861
  if (contravariant && !bivariant) {
63840
63862
  if (!contains(inference.contraCandidates, candidate)) {
63841
63863
  inference.contraCandidates = append(inference.contraCandidates, candidate);
@@ -64407,7 +64429,7 @@ function createTypeChecker(host) {
64407
64429
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
64408
64430
  if (constraint) {
64409
64431
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
64410
- if (!inferredType || inferredType === blockedStringType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
64432
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
64411
64433
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
64412
64434
  }
64413
64435
  }
@@ -64483,10 +64505,7 @@ function createTypeChecker(host) {
64483
64505
  node,
64484
64506
  !isWriteOnlyAccess(node),
64485
64507
  /*excludeGlobals*/
64486
- false,
64487
- /*getSpellingSuggestions*/
64488
- void 0,
64489
- isWriteAccess(node)
64508
+ false
64490
64509
  ) || unknownSymbol;
64491
64510
  }
64492
64511
  return links.resolvedSymbol;
@@ -65261,7 +65280,10 @@ function createTypeChecker(host) {
65261
65280
  let signature = links.effectsSignature;
65262
65281
  if (signature === void 0) {
65263
65282
  let funcType;
65264
- if (node.parent.kind === 244 /* ExpressionStatement */) {
65283
+ if (isBinaryExpression(node)) {
65284
+ const rightType = checkNonNullExpression(node.right);
65285
+ funcType = getSymbolHasInstanceMethodOfObjectType(rightType);
65286
+ } else if (node.parent.kind === 244 /* ExpressionStatement */) {
65265
65287
  funcType = getTypeOfDottedName(
65266
65288
  node.expression,
65267
65289
  /*diagnostic*/
@@ -66285,7 +66307,22 @@ function createTypeChecker(host) {
66285
66307
  }
66286
66308
  return type;
66287
66309
  }
66288
- const rightType = getTypeOfExpression(expr.right);
66310
+ const right = expr.right;
66311
+ const rightType = getTypeOfExpression(right);
66312
+ if (!isTypeDerivedFrom(rightType, globalObjectType)) {
66313
+ return type;
66314
+ }
66315
+ const signature = getEffectsSignature(expr);
66316
+ const predicate = signature && getTypePredicateOfSignature(signature);
66317
+ if (predicate && predicate.kind === 1 /* Identifier */ && predicate.parameterIndex === 0) {
66318
+ return getNarrowedType(
66319
+ type,
66320
+ predicate.type,
66321
+ assumeTrue,
66322
+ /*checkDerived*/
66323
+ true
66324
+ );
66325
+ }
66289
66326
  if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
66290
66327
  return type;
66291
66328
  }
@@ -66537,7 +66574,7 @@ function createTypeChecker(host) {
66537
66574
  return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
66538
66575
  }
66539
66576
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
66540
- 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(
66577
+ const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 32 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
66541
66578
  node,
66542
66579
  /*contextFlags*/
66543
66580
  void 0
@@ -67297,7 +67334,7 @@ function createTypeChecker(host) {
67297
67334
  function getContextualTypeForBindingElement(declaration, contextFlags) {
67298
67335
  const parent = declaration.parent.parent;
67299
67336
  const name = declaration.propertyName || declaration.name;
67300
- const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 208 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
67337
+ const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 208 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */);
67301
67338
  if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
67302
67339
  return void 0;
67303
67340
  if (parent.name.kind === 207 /* ArrayBindingPattern */) {
@@ -69280,7 +69317,7 @@ function createTypeChecker(host) {
69280
69317
  }
69281
69318
  return false;
69282
69319
  }
69283
- if (!(flags & 32 /* Static */) && ((_a = prop.declarations) == null ? void 0 : _a.some(isClassFieldAndNotAutoAccessor))) {
69320
+ if (!(flags & 32 /* Static */) && ((_a = prop.declarations) == null ? void 0 : _a.some(isClassInstanceProperty))) {
69284
69321
  if (errorNode) {
69285
69322
  error(errorNode, Diagnostics.Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super, symbolToString(prop));
69286
69323
  }
@@ -69920,8 +69957,6 @@ function createTypeChecker(host) {
69920
69957
  false,
69921
69958
  /*getSpellingSuggestions*/
69922
69959
  true,
69923
- /*isWritten*/
69924
- false,
69925
69960
  (symbols, name, meaning2) => {
69926
69961
  Debug.assertEqual(outerName, name, "name should equal outerName");
69927
69962
  const symbol = getSymbol(symbols, name, meaning2);
@@ -70145,7 +70180,9 @@ function createTypeChecker(host) {
70145
70180
  checkExpression(node.template);
70146
70181
  } else if (isJsxOpeningLikeElement(node)) {
70147
70182
  checkExpression(node.attributes);
70148
- } else if (node.kind !== 170 /* Decorator */) {
70183
+ } else if (isBinaryExpression(node)) {
70184
+ checkExpression(node.left);
70185
+ } else if (isCallOrNewExpression(node)) {
70149
70186
  forEach(node.arguments, (argument) => {
70150
70187
  checkExpression(argument);
70151
70188
  });
@@ -70218,6 +70255,8 @@ function createTypeChecker(host) {
70218
70255
  }
70219
70256
  } else if (node.kind === 170 /* Decorator */) {
70220
70257
  argCount = getDecoratorArgumentCount(node, signature);
70258
+ } else if (node.kind === 226 /* BinaryExpression */) {
70259
+ argCount = 1;
70221
70260
  } else if (isJsxOpeningLikeElement(node)) {
70222
70261
  callIsIncomplete = node.attributes.end === node.end;
70223
70262
  if (callIsIncomplete) {
@@ -70317,13 +70356,13 @@ function createTypeChecker(host) {
70317
70356
  return voidType;
70318
70357
  }
70319
70358
  const thisArgumentType = checkExpression(thisArgumentNode);
70320
- return isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) : isOptionalChain(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) : thisArgumentType;
70359
+ return isRightSideOfInstanceofExpression(thisArgumentNode) ? thisArgumentType : isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) : isOptionalChain(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) : thisArgumentType;
70321
70360
  }
70322
70361
  function inferTypeArguments(node, signature, args, checkMode, context) {
70323
70362
  if (isJsxOpeningLikeElement(node)) {
70324
70363
  return inferJsxTypeArguments(node, signature, checkMode, context);
70325
70364
  }
70326
- if (node.kind !== 170 /* Decorator */) {
70365
+ if (node.kind !== 170 /* Decorator */ && node.kind !== 226 /* BinaryExpression */) {
70327
70366
  const skipBindingPatterns = every(signature.typeParameters, (p) => !!getDefaultFromTypeParameter(p));
70328
70367
  const contextualType = getContextualType(node, skipBindingPatterns ? 8 /* SkipBindingPatterns */ : 0 /* None */);
70329
70368
  if (contextualType) {
@@ -70360,7 +70399,7 @@ function createTypeChecker(host) {
70360
70399
  }
70361
70400
  for (let i = 0; i < argCount; i++) {
70362
70401
  const arg = args[i];
70363
- if (arg.kind !== 232 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
70402
+ if (arg.kind !== 232 /* OmittedExpression */) {
70364
70403
  const paramType = getTypeAtPosition(signature, i);
70365
70404
  if (couldContainTypeVariables(paramType)) {
70366
70405
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -70652,6 +70691,9 @@ function createTypeChecker(host) {
70652
70691
  }
70653
70692
  }
70654
70693
  function getThisArgumentOfCall(node) {
70694
+ if (node.kind === 226 /* BinaryExpression */) {
70695
+ return node.right;
70696
+ }
70655
70697
  const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : node.kind === 170 /* Decorator */ && !legacyDecorators ? node.expression : void 0;
70656
70698
  if (expression) {
70657
70699
  const callee = skipOuterExpressions(expression);
@@ -70680,6 +70722,9 @@ function createTypeChecker(host) {
70680
70722
  if (node.kind === 170 /* Decorator */) {
70681
70723
  return getEffectiveDecoratorArguments(node);
70682
70724
  }
70725
+ if (node.kind === 226 /* BinaryExpression */) {
70726
+ return [node.left];
70727
+ }
70683
70728
  if (isJsxOpeningLikeElement(node)) {
70684
70729
  return node.attributes.properties.length > 0 || isJsxOpeningElement(node) && node.parent.children.length > 0 ? [node.attributes] : emptyArray;
70685
70730
  }
@@ -70949,9 +70994,10 @@ function createTypeChecker(host) {
70949
70994
  const isTaggedTemplate = node.kind === 215 /* TaggedTemplateExpression */;
70950
70995
  const isDecorator2 = node.kind === 170 /* Decorator */;
70951
70996
  const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
70997
+ const isInstanceof = node.kind === 226 /* BinaryExpression */;
70952
70998
  const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
70953
70999
  let typeArguments;
70954
- if (!isDecorator2 && !isSuperCall(node)) {
71000
+ if (!isDecorator2 && !isInstanceof && !isSuperCall(node)) {
70955
71001
  typeArguments = node.typeArguments;
70956
71002
  if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 108 /* SuperKeyword */) {
70957
71003
  forEach(typeArguments, checkSourceElement);
@@ -70963,7 +71009,6 @@ function createTypeChecker(host) {
70963
71009
  const args = getEffectiveCallArguments(node);
70964
71010
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
70965
71011
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
70966
- argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
70967
71012
  let candidatesForArgumentError;
70968
71013
  let candidateForArgumentArityError;
70969
71014
  let candidateForTypeArgumentError;
@@ -70981,6 +71026,9 @@ function createTypeChecker(host) {
70981
71026
  result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
70982
71027
  getNodeLinks(node).resolvedSignature = result;
70983
71028
  if (reportErrors2) {
71029
+ if (!headMessage && isInstanceof) {
71030
+ headMessage = 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;
71031
+ }
70984
71032
  if (candidatesForArgumentError) {
70985
71033
  if (candidatesForArgumentError.length === 1 || candidatesForArgumentError.length > 3) {
70986
71034
  const last2 = candidatesForArgumentError[candidatesForArgumentError.length - 1];
@@ -71767,6 +71815,30 @@ function createTypeChecker(host) {
71767
71815
  }
71768
71816
  return resolveCall(node, signatures, candidatesOutArray, checkMode, 0 /* None */);
71769
71817
  }
71818
+ function resolveInstanceofExpression(node, candidatesOutArray, checkMode) {
71819
+ const rightType = checkExpression(node.right);
71820
+ if (!isTypeAny(rightType)) {
71821
+ const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(rightType);
71822
+ if (hasInstanceMethodType) {
71823
+ const apparentType = getApparentType(hasInstanceMethodType);
71824
+ if (isErrorType(apparentType)) {
71825
+ return resolveErrorCall(node);
71826
+ }
71827
+ const callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);
71828
+ const constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */);
71829
+ if (isUntypedFunctionCall(hasInstanceMethodType, apparentType, callSignatures.length, constructSignatures.length)) {
71830
+ return resolveUntypedCall(node);
71831
+ }
71832
+ if (callSignatures.length) {
71833
+ return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */);
71834
+ }
71835
+ } else if (!(typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
71836
+ error(node.right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_a_class_function_or_other_type_assignable_to_the_Function_interface_type_or_an_object_type_with_a_Symbol_hasInstance_method);
71837
+ return resolveErrorCall(node);
71838
+ }
71839
+ }
71840
+ return anySignature;
71841
+ }
71770
71842
  function isPotentiallyUncalledDecorator(decorator, signatures) {
71771
71843
  return signatures.length && every(signatures, (signature) => signature.minArgumentCount === 0 && !signatureHasRestParameter(signature) && signature.parameters.length < getDecoratorArgumentCount(decorator, signature));
71772
71844
  }
@@ -71783,6 +71855,8 @@ function createTypeChecker(host) {
71783
71855
  case 286 /* JsxOpeningElement */:
71784
71856
  case 285 /* JsxSelfClosingElement */:
71785
71857
  return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
71858
+ case 226 /* BinaryExpression */:
71859
+ return resolveInstanceofExpression(node, candidatesOutArray, checkMode);
71786
71860
  }
71787
71861
  Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
71788
71862
  }
@@ -73741,16 +73815,35 @@ function createTypeChecker(host) {
73741
73815
  function isConstEnumSymbol(symbol) {
73742
73816
  return (symbol.flags & 128 /* ConstEnum */) !== 0;
73743
73817
  }
73744
- function checkInstanceOfExpression(left, right, leftType, rightType) {
73818
+ function getSymbolHasInstanceMethodOfObjectType(type) {
73819
+ const hasInstancePropertyName = getPropertyNameForKnownSymbolName("hasInstance");
73820
+ const hasInstanceProperty = getPropertyOfObjectType(type, hasInstancePropertyName);
73821
+ if (hasInstanceProperty) {
73822
+ const hasInstancePropertyType = getTypeOfSymbol(hasInstanceProperty);
73823
+ if (hasInstancePropertyType && getSignaturesOfType(hasInstancePropertyType, 0 /* Call */).length !== 0) {
73824
+ return hasInstancePropertyType;
73825
+ }
73826
+ }
73827
+ }
73828
+ function checkInstanceOfExpression(left, right, leftType, rightType, checkMode) {
73745
73829
  if (leftType === silentNeverType || rightType === silentNeverType) {
73746
73830
  return silentNeverType;
73747
73831
  }
73748
73832
  if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
73749
73833
  error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
73750
73834
  }
73751
- if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
73752
- 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);
73835
+ Debug.assert(isInstanceOfExpression(left.parent));
73836
+ const signature = getResolvedSignature(
73837
+ left.parent,
73838
+ /*candidatesOutArray*/
73839
+ void 0,
73840
+ checkMode
73841
+ );
73842
+ if (signature === resolvingSignature) {
73843
+ return silentNeverType;
73753
73844
  }
73845
+ const returnType = getReturnTypeOfSignature(signature);
73846
+ 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);
73754
73847
  return booleanType;
73755
73848
  }
73756
73849
  function hasEmptyObjectIntersection(type) {
@@ -74288,7 +74381,7 @@ function createTypeChecker(host) {
74288
74381
  case 36 /* ExclamationEqualsToken */:
74289
74382
  case 37 /* EqualsEqualsEqualsToken */:
74290
74383
  case 38 /* ExclamationEqualsEqualsToken */:
74291
- if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
74384
+ if (!(checkMode && checkMode & 64 /* TypeOnly */)) {
74292
74385
  if ((isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) && // only report for === and !== in JS, not == or !=
74293
74386
  (!isInJSFile(left) || (operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */))) {
74294
74387
  const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
@@ -74299,7 +74392,7 @@ function createTypeChecker(host) {
74299
74392
  }
74300
74393
  return booleanType;
74301
74394
  case 104 /* InstanceOfKeyword */:
74302
- return checkInstanceOfExpression(left, right, leftType, rightType);
74395
+ return checkInstanceOfExpression(left, right, leftType, rightType, checkMode);
74303
74396
  case 103 /* InKeyword */:
74304
74397
  return checkInExpression(left, right, leftType, rightType);
74305
74398
  case 56 /* AmpersandAmpersandToken */:
@@ -74936,7 +75029,7 @@ function createTypeChecker(host) {
74936
75029
  }
74937
75030
  }
74938
75031
  const startInvocationCount = flowInvocationCount;
74939
- const type = checkExpression(node, 128 /* TypeOnly */);
75032
+ const type = checkExpression(node, 64 /* TypeOnly */);
74940
75033
  if (flowInvocationCount !== startInvocationCount) {
74941
75034
  const cache = flowTypeCache || (flowTypeCache = []);
74942
75035
  cache[getNodeId(node)] = type;
@@ -75376,7 +75469,7 @@ function createTypeChecker(host) {
75376
75469
  }
75377
75470
  }
75378
75471
  if (node.kind !== 181 /* IndexSignature */ && node.kind !== 324 /* JSDocFunctionType */) {
75379
- registerForUnusedOrUninitializedIdentifiersCheck(node);
75472
+ registerForUnusedIdentifiersCheck(node);
75380
75473
  }
75381
75474
  }
75382
75475
  }
@@ -75921,7 +76014,7 @@ function createTypeChecker(host) {
75921
76014
  }
75922
76015
  }
75923
76016
  }
75924
- registerForUnusedOrUninitializedIdentifiersCheck(node);
76017
+ registerForUnusedIdentifiersCheck(node);
75925
76018
  }
75926
76019
  function checkTemplateLiteralType(node) {
75927
76020
  for (const span of node.templateSpans) {
@@ -76907,27 +77000,25 @@ function createTypeChecker(host) {
76907
77000
  }
76908
77001
  }
76909
77002
  }
76910
- function registerForUnusedOrUninitializedIdentifiersCheck(node) {
76911
- addLazyDiagnostic(registerForUnusedOrUninitializedIdentifiersCheckDiagnostics);
76912
- function registerForUnusedOrUninitializedIdentifiersCheckDiagnostics() {
77003
+ function registerForUnusedIdentifiersCheck(node) {
77004
+ addLazyDiagnostic(registerForUnusedIdentifiersCheckDiagnostics);
77005
+ function registerForUnusedIdentifiersCheckDiagnostics() {
76913
77006
  const sourceFile = getSourceFileOfNode(node);
76914
- let potentiallyUnusedOrUninitializedIdentifiers = allPotentiallyUnusedOrUninitializedIdentifiers.get(sourceFile.path);
76915
- if (!potentiallyUnusedOrUninitializedIdentifiers) {
76916
- potentiallyUnusedOrUninitializedIdentifiers = [];
76917
- allPotentiallyUnusedOrUninitializedIdentifiers.set(sourceFile.path, potentiallyUnusedOrUninitializedIdentifiers);
77007
+ let potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path);
77008
+ if (!potentiallyUnusedIdentifiers) {
77009
+ potentiallyUnusedIdentifiers = [];
77010
+ allPotentiallyUnusedIdentifiers.set(sourceFile.path, potentiallyUnusedIdentifiers);
76918
77011
  }
76919
- potentiallyUnusedOrUninitializedIdentifiers.push(node);
77012
+ potentiallyUnusedIdentifiers.push(node);
76920
77013
  }
76921
77014
  }
76922
- function checkUnusedOrUninitializedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic, checkUnused, checkUninitialized) {
77015
+ function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) {
76923
77016
  for (const node of potentiallyUnusedIdentifiers) {
76924
77017
  switch (node.kind) {
76925
77018
  case 263 /* ClassDeclaration */:
76926
77019
  case 231 /* ClassExpression */:
76927
- if (checkUnused) {
76928
- checkUnusedClassMembers(node, addDiagnostic);
76929
- checkUnusedTypeParameters(node, addDiagnostic);
76930
- }
77020
+ checkUnusedClassMembers(node, addDiagnostic);
77021
+ checkUnusedTypeParameters(node, addDiagnostic);
76931
77022
  break;
76932
77023
  case 312 /* SourceFile */:
76933
77024
  case 267 /* ModuleDeclaration */:
@@ -76936,12 +77027,7 @@ function createTypeChecker(host) {
76936
77027
  case 248 /* ForStatement */:
76937
77028
  case 249 /* ForInStatement */:
76938
77029
  case 250 /* ForOfStatement */:
76939
- if (checkUnused) {
76940
- checkUnusedLocalsAndParameters(node, addDiagnostic);
76941
- }
76942
- if (checkUninitialized) {
76943
- checkUninitializedLocals(node);
76944
- }
77030
+ checkUnusedLocalsAndParameters(node, addDiagnostic);
76945
77031
  break;
76946
77032
  case 176 /* Constructor */:
76947
77033
  case 218 /* FunctionExpression */:
@@ -76950,15 +77036,10 @@ function createTypeChecker(host) {
76950
77036
  case 174 /* MethodDeclaration */:
76951
77037
  case 177 /* GetAccessor */:
76952
77038
  case 178 /* SetAccessor */:
76953
- if (checkUnused) {
76954
- if (node.body) {
76955
- checkUnusedLocalsAndParameters(node, addDiagnostic);
76956
- }
76957
- checkUnusedTypeParameters(node, addDiagnostic);
76958
- }
76959
- if (checkUninitialized) {
76960
- checkUninitializedLocals(node);
77039
+ if (node.body) {
77040
+ checkUnusedLocalsAndParameters(node, addDiagnostic);
76961
77041
  }
77042
+ checkUnusedTypeParameters(node, addDiagnostic);
76962
77043
  break;
76963
77044
  case 173 /* MethodSignature */:
76964
77045
  case 179 /* CallSignature */:
@@ -76967,14 +77048,10 @@ function createTypeChecker(host) {
76967
77048
  case 185 /* ConstructorType */:
76968
77049
  case 265 /* TypeAliasDeclaration */:
76969
77050
  case 264 /* InterfaceDeclaration */:
76970
- if (checkUnused) {
76971
- checkUnusedTypeParameters(node, addDiagnostic);
76972
- }
77051
+ checkUnusedTypeParameters(node, addDiagnostic);
76973
77052
  break;
76974
77053
  case 195 /* InferType */:
76975
- if (checkUnused) {
76976
- checkUnusedInferTypeParameter(node, addDiagnostic);
76977
- }
77054
+ checkUnusedInferTypeParameter(node, addDiagnostic);
76978
77055
  break;
76979
77056
  default:
76980
77057
  Debug.assertNever(node, "Node should not have been registered for unused identifiers check");
@@ -77164,26 +77241,6 @@ function createTypeChecker(host) {
77164
77241
  }
77165
77242
  });
77166
77243
  }
77167
- function checkUninitializedLocals(nodeWithLocals) {
77168
- nodeWithLocals.locals.forEach((local) => {
77169
- if (!(local.flags & 3 /* Variable */) || local.isAssigned || !local.isReferenced) {
77170
- return;
77171
- }
77172
- const declaration = local.valueDeclaration;
77173
- if (!declaration) {
77174
- return;
77175
- }
77176
- if (isVariableDeclaration(declaration)) {
77177
- if (getCombinedNodeFlagsCached(declaration) & 33554432 /* Ambient */ || declaration.exclamationToken || declaration.initializer || !declaration.type) {
77178
- return;
77179
- }
77180
- const type = getTypeFromTypeNode(declaration.type);
77181
- if (!(type.flags & 3 /* AnyOrUnknown */) && !containsUndefinedType(type)) {
77182
- error(declaration, Diagnostics.Variable_0_is_used_before_being_assigned, idText(declaration.name));
77183
- }
77184
- }
77185
- });
77186
- }
77187
77244
  function checkPotentialUncheckedRenamedBindingElementsInTypes() {
77188
77245
  var _a;
77189
77246
  for (const node of potentialUnusedRenamedBindingElementsInTypes) {
@@ -77230,7 +77287,7 @@ function createTypeChecker(host) {
77230
77287
  forEach(node.statements, checkSourceElement);
77231
77288
  }
77232
77289
  if (node.locals) {
77233
- registerForUnusedOrUninitializedIdentifiersCheck(node);
77290
+ registerForUnusedIdentifiersCheck(node);
77234
77291
  }
77235
77292
  }
77236
77293
  function checkCollisionWithArgumentsInGeneratedCode(node) {
@@ -77438,7 +77495,7 @@ function createTypeChecker(host) {
77438
77495
  checkComputedPropertyName(node.propertyName);
77439
77496
  }
77440
77497
  const parent = node.parent.parent;
77441
- const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
77498
+ const parentCheckMode = node.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
77442
77499
  const parentType = getTypeForBindingElementParent(parent, parentCheckMode);
77443
77500
  const name = node.propertyName || node.name;
77444
77501
  if (parentType && !isBindingPattern(name)) {
@@ -77780,7 +77837,7 @@ function createTypeChecker(host) {
77780
77837
  checkExpression(node.incrementor);
77781
77838
  checkSourceElement(node.statement);
77782
77839
  if (node.locals) {
77783
- registerForUnusedOrUninitializedIdentifiersCheck(node);
77840
+ registerForUnusedIdentifiersCheck(node);
77784
77841
  }
77785
77842
  }
77786
77843
  function checkForOfStatement(node) {
@@ -77819,7 +77876,7 @@ function createTypeChecker(host) {
77819
77876
  }
77820
77877
  checkSourceElement(node.statement);
77821
77878
  if (node.locals) {
77822
- registerForUnusedOrUninitializedIdentifiersCheck(node);
77879
+ registerForUnusedIdentifiersCheck(node);
77823
77880
  }
77824
77881
  }
77825
77882
  function checkForInStatement(node) {
@@ -77851,7 +77908,7 @@ function createTypeChecker(host) {
77851
77908
  }
77852
77909
  checkSourceElement(node.statement);
77853
77910
  if (node.locals) {
77854
- registerForUnusedOrUninitializedIdentifiersCheck(node);
77911
+ registerForUnusedIdentifiersCheck(node);
77855
77912
  }
77856
77913
  }
77857
77914
  function checkRightHandSideOfForOf(statement) {
@@ -78583,7 +78640,7 @@ function createTypeChecker(host) {
78583
78640
  }
78584
78641
  });
78585
78642
  if (node.caseBlock.locals) {
78586
- registerForUnusedOrUninitializedIdentifiersCheck(node.caseBlock);
78643
+ registerForUnusedIdentifiersCheck(node.caseBlock);
78587
78644
  }
78588
78645
  }
78589
78646
  function checkLabeledStatement(node) {
@@ -78923,7 +78980,7 @@ function createTypeChecker(host) {
78923
78980
  }
78924
78981
  function checkClassExpressionDeferred(node) {
78925
78982
  forEach(node.members, checkSourceElement);
78926
- registerForUnusedOrUninitializedIdentifiersCheck(node);
78983
+ registerForUnusedIdentifiersCheck(node);
78927
78984
  }
78928
78985
  function checkClassDeclaration(node) {
78929
78986
  const firstDecorator = find(node.modifiers, isDecorator);
@@ -78935,7 +78992,7 @@ function createTypeChecker(host) {
78935
78992
  }
78936
78993
  checkClassLikeDeclaration(node);
78937
78994
  forEach(node.members, checkSourceElement);
78938
- registerForUnusedOrUninitializedIdentifiersCheck(node);
78995
+ registerForUnusedIdentifiersCheck(node);
78939
78996
  }
78940
78997
  function checkClassLikeDeclaration(node) {
78941
78998
  checkGrammarClassLikeDeclaration(node);
@@ -79496,7 +79553,7 @@ function createTypeChecker(host) {
79496
79553
  forEach(node.members, checkSourceElement);
79497
79554
  addLazyDiagnostic(() => {
79498
79555
  checkTypeForDuplicateIndexSignatures(node);
79499
- registerForUnusedOrUninitializedIdentifiersCheck(node);
79556
+ registerForUnusedIdentifiersCheck(node);
79500
79557
  });
79501
79558
  }
79502
79559
  function checkTypeAliasDeclaration(node) {
@@ -79510,7 +79567,7 @@ function createTypeChecker(host) {
79510
79567
  }
79511
79568
  } else {
79512
79569
  checkSourceElement(node.type);
79513
- registerForUnusedOrUninitializedIdentifiersCheck(node);
79570
+ registerForUnusedIdentifiersCheck(node);
79514
79571
  }
79515
79572
  }
79516
79573
  function computeEnumMemberValues(node) {
@@ -79655,7 +79712,7 @@ function createTypeChecker(host) {
79655
79712
  }
79656
79713
  if (isConstantVariable(symbol)) {
79657
79714
  const declaration = symbol.valueDeclaration;
79658
- if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
79715
+ if (declaration && isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
79659
79716
  return evaluate(declaration.initializer, declaration);
79660
79717
  }
79661
79718
  }
@@ -79781,7 +79838,7 @@ function createTypeChecker(host) {
79781
79838
  if (node.body) {
79782
79839
  checkSourceElement(node.body);
79783
79840
  if (!isGlobalScopeAugmentation(node)) {
79784
- registerForUnusedOrUninitializedIdentifiersCheck(node);
79841
+ registerForUnusedIdentifiersCheck(node);
79785
79842
  }
79786
79843
  }
79787
79844
  addLazyDiagnostic(checkModuleDeclarationDiagnostics);
@@ -80747,6 +80804,12 @@ function createTypeChecker(host) {
80747
80804
  case 234 /* AsExpression */:
80748
80805
  case 217 /* ParenthesizedExpression */:
80749
80806
  checkAssertionDeferred(node);
80807
+ break;
80808
+ case 226 /* BinaryExpression */:
80809
+ if (isInstanceOfExpression(node)) {
80810
+ resolveUntypedCall(node);
80811
+ }
80812
+ break;
80750
80813
  }
80751
80814
  currentNode = saveCurrentNode;
80752
80815
  (_b = tracing) == null ? void 0 : _b.pop();
@@ -80779,8 +80842,8 @@ function createTypeChecker(host) {
80779
80842
  return Debug.assertNever(kind);
80780
80843
  }
80781
80844
  }
80782
- function getPotentiallyUnusedOrUninitializedIdentifiers(sourceFile) {
80783
- return allPotentiallyUnusedOrUninitializedIdentifiers.get(sourceFile.path) || emptyArray;
80845
+ function getPotentiallyUnusedIdentifiers(sourceFile) {
80846
+ return allPotentiallyUnusedIdentifiers.get(sourceFile.path) || emptyArray;
80784
80847
  }
80785
80848
  function checkSourceFileWorker(node) {
80786
80849
  const links = getNodeLinks(node);
@@ -80798,21 +80861,15 @@ function createTypeChecker(host) {
80798
80861
  checkSourceElement(node.endOfFileToken);
80799
80862
  checkDeferredNodes(node);
80800
80863
  if (isExternalOrCommonJsModule(node)) {
80801
- registerForUnusedOrUninitializedIdentifiersCheck(node);
80864
+ registerForUnusedIdentifiersCheck(node);
80802
80865
  }
80803
80866
  addLazyDiagnostic(() => {
80804
- const checkUnused = !node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters);
80805
- if (checkUnused || strictNullChecks) {
80806
- checkUnusedOrUninitializedIdentifiers(
80807
- getPotentiallyUnusedOrUninitializedIdentifiers(node),
80808
- (containingNode, kind, diag2) => {
80809
- if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
80810
- diagnostics.add(diag2);
80811
- }
80812
- },
80813
- checkUnused,
80814
- strictNullChecks
80815
- );
80867
+ if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
80868
+ checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), (containingNode, kind, diag2) => {
80869
+ if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
80870
+ diagnostics.add(diag2);
80871
+ }
80872
+ });
80816
80873
  }
80817
80874
  if (!node.isDeclarationFile) {
80818
80875
  checkPotentialUncheckedRenamedBindingElementsInTypes();
@@ -81369,6 +81426,13 @@ function createTypeChecker(host) {
81369
81426
  case 102 /* ImportKeyword */:
81370
81427
  case 105 /* NewKeyword */:
81371
81428
  return isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : void 0;
81429
+ case 104 /* InstanceOfKeyword */:
81430
+ if (isBinaryExpression(node.parent)) {
81431
+ const type = getTypeOfExpression(node.parent.right);
81432
+ const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(type);
81433
+ return (hasInstanceMethodType == null ? void 0 : hasInstanceMethodType.symbol) ?? type.symbol;
81434
+ }
81435
+ return void 0;
81372
81436
  case 236 /* MetaProperty */:
81373
81437
  return checkExpression(node).symbol;
81374
81438
  case 295 /* JsxNamespacedName */: