@typescript-deploys/pr-build 4.9.0-pr-49929-7 → 4.9.0-pr-50776-2

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/typescript.js CHANGED
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220919");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220922");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -288,6 +288,11 @@ var ts;
288
288
  return result;
289
289
  }
290
290
  ts.intersperse = intersperse;
291
+ /**
292
+ * Iterates through `array` by index and performs the callback on each element of array until the callback
293
+ * returns a falsey value, then returns false.
294
+ * If no such value is found, the callback is applied to each element of array and `true` is returned.
295
+ */
291
296
  function every(array, callback) {
292
297
  if (array) {
293
298
  for (var i = 0; i < array.length; i++) {
@@ -299,10 +304,6 @@ var ts;
299
304
  return true;
300
305
  }
301
306
  ts.every = every;
302
- function isArrayOf(array, callback) {
303
- return every(array, callback);
304
- }
305
- ts.isArrayOf = isArrayOf;
306
307
  function find(array, predicate, startIndex) {
307
308
  if (array === undefined)
308
309
  return undefined;
@@ -979,7 +980,6 @@ var ts;
979
980
  }
980
981
  ts.sum = sum;
981
982
  function append(to, value) {
982
- // If to is Push<T>, return value is void, so safe to cast to T[].
983
983
  if (value === undefined)
984
984
  return to;
985
985
  if (to === undefined)
@@ -2683,7 +2683,7 @@ var ts;
2683
2683
  if (typeof func !== "function") {
2684
2684
  return "";
2685
2685
  }
2686
- else if (func.hasOwnProperty("name")) {
2686
+ else if (ts.hasProperty(func, "name")) {
2687
2687
  return func.name;
2688
2688
  }
2689
2689
  else {
@@ -3008,7 +3008,7 @@ var ts;
3008
3008
  ];
3009
3009
  for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
3010
3010
  var ctor = nodeConstructors_1[_i];
3011
- if (!ctor.prototype.hasOwnProperty("__debugKind")) {
3011
+ if (!ts.hasProperty(ctor.prototype, "__debugKind")) {
3012
3012
  Object.defineProperties(ctor.prototype, {
3013
3013
  // for use with vscode-js-debug's new customDescriptionGenerator in launch.json
3014
3014
  __tsDebuggerDisplay: {
@@ -3863,7 +3863,6 @@ var ts;
3863
3863
  var typeCatalog = []; // NB: id is index + 1
3864
3864
  var legendPath;
3865
3865
  var legend = [];
3866
- ;
3867
3866
  /** Starts tracing for the given project. */
3868
3867
  function startTracing(tracingMode, traceDir, configFilePath) {
3869
3868
  ts.Debug.assert(!ts.tracing, "Tracing already started");
@@ -8695,8 +8694,6 @@ var ts;
8695
8694
  The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.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."),
8696
8695
  The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.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."),
8697
8696
  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, ts.DiagnosticCategory.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."),
8698
- The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),
8699
- The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."),
8700
8697
  The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.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."),
8701
8698
  The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.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."),
8702
8699
  The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.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."),
@@ -8945,6 +8942,7 @@ var ts;
8945
8942
  Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
8946
8943
  Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."),
8947
8944
  Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."),
8945
+ Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."),
8948
8946
  Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
8949
8947
  A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
8950
8948
  Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
@@ -9125,6 +9123,7 @@ var ts;
9125
9123
  _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),
9126
9124
  We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."),
9127
9125
  Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
9126
+ This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."),
9128
9127
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
9129
9128
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.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}'."),
9130
9129
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.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}'."),
@@ -10067,6 +10066,8 @@ var ts;
10067
10066
  Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
10068
10067
  Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
10069
10068
  Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"),
10069
+ Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."),
10070
+ Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
10070
10071
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
10071
10072
  Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
10072
10073
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -10328,7 +10329,7 @@ var ts;
10328
10329
  ts.stringToToken = stringToToken;
10329
10330
  /* @internal */
10330
10331
  function computeLineStarts(text) {
10331
- var result = new Array();
10332
+ var result = [];
10332
10333
  var pos = 0;
10333
10334
  var lineStart = 0;
10334
10335
  while (pos < text.length) {
@@ -10805,7 +10806,9 @@ var ts;
10805
10806
  }
10806
10807
  ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange;
10807
10808
  function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) {
10808
- if (comments === void 0) { comments = []; }
10809
+ if (!comments) {
10810
+ comments = [];
10811
+ }
10809
10812
  comments.push({ kind: kind, pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine });
10810
10813
  return comments;
10811
10814
  }
@@ -11887,12 +11890,36 @@ var ts;
11887
11890
  pos++;
11888
11891
  return token = 0 /* SyntaxKind.Unknown */;
11889
11892
  }
11890
- if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) {
11893
+ var charAfterHash = codePointAt(text, pos + 1);
11894
+ if (charAfterHash === 92 /* CharacterCodes.backslash */) {
11895
+ pos++;
11896
+ var extendedCookedChar_1 = peekExtendedUnicodeEscape();
11897
+ if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) {
11898
+ pos += 3;
11899
+ tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */;
11900
+ tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts();
11901
+ return token = 80 /* SyntaxKind.PrivateIdentifier */;
11902
+ }
11903
+ var cookedChar_1 = peekUnicodeEscape();
11904
+ if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) {
11905
+ pos += 6;
11906
+ tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */;
11907
+ tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts();
11908
+ return token = 80 /* SyntaxKind.PrivateIdentifier */;
11909
+ }
11910
+ pos--;
11911
+ }
11912
+ if (isIdentifierStart(charAfterHash, languageVersion)) {
11891
11913
  pos++;
11892
- scanIdentifier(codePointAt(text, pos), languageVersion);
11914
+ // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact.
11915
+ // Notably absent from this block is the fact that calling a function named "scanIdentifier",
11916
+ // but identifiers don't include '#', and that function doesn't deal with it at all.
11917
+ // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings;
11918
+ // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us.
11919
+ scanIdentifier(charAfterHash, languageVersion);
11893
11920
  }
11894
11921
  else {
11895
- tokenValue = String.fromCharCode(codePointAt(text, pos));
11922
+ tokenValue = "#";
11896
11923
  error(ts.Diagnostics.Invalid_character, pos++, charSize(ch));
11897
11924
  }
11898
11925
  return token = 80 /* SyntaxKind.PrivateIdentifier */;
@@ -12663,8 +12690,6 @@ var ts;
12663
12690
  return false;
12664
12691
  }
12665
12692
  ts.isEmptyBindingPattern = isEmptyBindingPattern;
12666
- // TODO(jakebailey): It is very weird that we have BindingElement and ArrayBindingElement;
12667
- // we should have ObjectBindingElement and ArrayBindingElement, which are both BindingElement.
12668
12693
  function isEmptyBindingElement(node) {
12669
12694
  if (ts.isOmittedExpression(node)) {
12670
12695
  return true;
@@ -12783,10 +12808,7 @@ var ts;
12783
12808
  node = node.original;
12784
12809
  }
12785
12810
  }
12786
- if (!node || !nodeTest) {
12787
- return node;
12788
- }
12789
- return nodeTest(node) ? node : undefined;
12811
+ return !nodeTest || nodeTest(node) ? node : undefined;
12790
12812
  }
12791
12813
  ts.getOriginalNode = getOriginalNode;
12792
12814
  function findAncestor(node, callback) {
@@ -13464,7 +13486,7 @@ var ts;
13464
13486
  // Node Arrays
13465
13487
  /* @internal */
13466
13488
  function isNodeArray(array) {
13467
- return array.hasOwnProperty("pos") && array.hasOwnProperty("end");
13489
+ return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end");
13468
13490
  }
13469
13491
  ts.isNodeArray = isNodeArray;
13470
13492
  // Literals
@@ -13812,13 +13834,6 @@ var ts;
13812
13834
  return false;
13813
13835
  }
13814
13836
  ts.isDeclarationBindingElement = isDeclarationBindingElement;
13815
- function isBindingOrAssignmentElement(node) {
13816
- return ts.isVariableDeclaration(node)
13817
- || ts.isParameter(node)
13818
- || isObjectBindingOrAssignmentElement(node)
13819
- || isArrayBindingOrAssignmentElement(node);
13820
- }
13821
- ts.isBindingOrAssignmentElement = isBindingOrAssignmentElement;
13822
13837
  /**
13823
13838
  * Determines whether a node is a BindingOrAssignmentPattern
13824
13839
  */
@@ -13867,22 +13882,6 @@ var ts;
13867
13882
  }
13868
13883
  ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern;
13869
13884
  /* @internal */
13870
- function isArrayBindingOrAssignmentElement(node) {
13871
- switch (node.kind) {
13872
- case 205 /* SyntaxKind.BindingElement */:
13873
- case 229 /* SyntaxKind.OmittedExpression */: // Elision
13874
- case 227 /* SyntaxKind.SpreadElement */: // AssignmentRestElement
13875
- case 206 /* SyntaxKind.ArrayLiteralExpression */: // ArrayAssignmentPattern
13876
- case 207 /* SyntaxKind.ObjectLiteralExpression */: // ObjectAssignmentPattern
13877
- case 79 /* SyntaxKind.Identifier */: // DestructuringAssignmentTarget
13878
- case 208 /* SyntaxKind.PropertyAccessExpression */: // DestructuringAssignmentTarget
13879
- case 209 /* SyntaxKind.ElementAccessExpression */: // DestructuringAssignmentTarget
13880
- return true;
13881
- }
13882
- return ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true); // AssignmentElement
13883
- }
13884
- ts.isArrayBindingOrAssignmentElement = isArrayBindingOrAssignmentElement;
13885
- /* @internal */
13886
13885
  function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
13887
13886
  var kind = node.kind;
13888
13887
  return kind === 208 /* SyntaxKind.PropertyAccessExpression */
@@ -13995,23 +13994,6 @@ var ts;
13995
13994
  }
13996
13995
  }
13997
13996
  ts.isUnaryExpressionWithWrite = isUnaryExpressionWithWrite;
13998
- /**
13999
- * See isExpression; not for use in transforms.
14000
- * @internal
14001
- */
14002
- function isLiteralTypeLiteral(node) {
14003
- node = skipPartiallyEmittedExpressions(node);
14004
- switch (skipPartiallyEmittedExpressions(node).kind) {
14005
- case 104 /* SyntaxKind.NullKeyword */:
14006
- case 110 /* SyntaxKind.TrueKeyword */:
14007
- case 95 /* SyntaxKind.FalseKeyword */:
14008
- case 221 /* SyntaxKind.PrefixUnaryExpression */:
14009
- return true;
14010
- default:
14011
- return isLiteralExpression(node);
14012
- }
14013
- }
14014
- ts.isLiteralTypeLiteral = isLiteralTypeLiteral;
14015
13997
  /* @internal */
14016
13998
  /**
14017
13999
  * Determines whether a node is an expression based only on its kind.
@@ -14976,7 +14958,6 @@ var ts;
14976
14958
  return emitNode && emitNode.flags || 0;
14977
14959
  }
14978
14960
  ts.getEmitFlags = getEmitFlags;
14979
- ;
14980
14961
  function getScriptTargetFeatures() {
14981
14962
  return {
14982
14963
  es2015: {
@@ -15291,7 +15272,6 @@ var ts;
15291
15272
  }
15292
15273
  ts.isBlockScope = isBlockScope;
15293
15274
  function isDeclarationWithTypeParameters(node) {
15294
- ts.Debug.type(node);
15295
15275
  switch (node.kind) {
15296
15276
  case 341 /* SyntaxKind.JSDocCallbackTag */:
15297
15277
  case 348 /* SyntaxKind.JSDocTypedefTag */:
@@ -15304,7 +15284,6 @@ var ts;
15304
15284
  }
15305
15285
  ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters;
15306
15286
  function isDeclarationWithTypeParameterChildren(node) {
15307
- ts.Debug.type(node);
15308
15287
  switch (node.kind) {
15309
15288
  case 176 /* SyntaxKind.CallSignature */:
15310
15289
  case 177 /* SyntaxKind.ConstructSignature */:
@@ -17763,10 +17742,6 @@ var ts;
17763
17742
  return node.escapedText === "push" || node.escapedText === "unshift";
17764
17743
  }
17765
17744
  ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;
17766
- // TODO(jakebailey): this function should not be named this. While it does technically
17767
- // return true if the argument is a ParameterDeclaration, it also returns true for nodes
17768
- // that are children of ParameterDeclarations inside binding elements.
17769
- // Probably, this should be called `rootDeclarationIsParameter`.
17770
17745
  function isParameterDeclaration(node) {
17771
17746
  var root = getRootDeclaration(node);
17772
17747
  return root.kind === 166 /* SyntaxKind.Parameter */;
@@ -19708,7 +19683,7 @@ var ts;
19708
19683
  }
19709
19684
  function isWatchSet(options) {
19710
19685
  // Firefox has Object.prototype.watch
19711
- return options.watch && options.hasOwnProperty("watch");
19686
+ return options.watch && ts.hasProperty(options, "watch");
19712
19687
  }
19713
19688
  ts.isWatchSet = isWatchSet;
19714
19689
  function closeFileWatcher(watcher) {
@@ -19956,7 +19931,6 @@ var ts;
19956
19931
  || kind === 114 /* SyntaxKind.VoidKeyword */
19957
19932
  || kind === 155 /* SyntaxKind.UndefinedKeyword */
19958
19933
  || kind === 144 /* SyntaxKind.NeverKeyword */
19959
- || kind === 139 /* SyntaxKind.IntrinsicKeyword */
19960
19934
  || kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */
19961
19935
  || kind === 315 /* SyntaxKind.JSDocAllType */
19962
19936
  || kind === 316 /* SyntaxKind.JSDocUnknownType */
@@ -22268,11 +22242,6 @@ var ts;
22268
22242
  }
22269
22243
  }
22270
22244
  ts.createParenthesizerRules = createParenthesizerRules;
22271
- function castToNodeArray(nodes) {
22272
- // TODO(jakebailey): Why do we need this helper? GH#49924?
22273
- // Also, why can't I write `isNodeArray<T>` as an expression?
22274
- return ts.cast(nodes, ts.isNodeArray);
22275
- }
22276
22245
  ts.nullParenthesizerRules = {
22277
22246
  getParenthesizeLeftSideOfBinaryForOperator: function (_) { return ts.identity; },
22278
22247
  getParenthesizeRightSideOfBinaryForOperator: function (_) { return ts.identity; },
@@ -22286,23 +22255,23 @@ var ts;
22286
22255
  parenthesizeLeftSideOfAccess: function (expression) { return ts.cast(expression, ts.isLeftHandSideExpression); },
22287
22256
  parenthesizeOperandOfPostfixUnary: function (operand) { return ts.cast(operand, ts.isLeftHandSideExpression); },
22288
22257
  parenthesizeOperandOfPrefixUnary: function (operand) { return ts.cast(operand, ts.isUnaryExpression); },
22289
- parenthesizeExpressionsOfCommaDelimitedList: castToNodeArray,
22258
+ parenthesizeExpressionsOfCommaDelimitedList: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
22290
22259
  parenthesizeExpressionForDisallowedComma: ts.identity,
22291
22260
  parenthesizeExpressionOfExpressionStatement: ts.identity,
22292
22261
  parenthesizeConciseBodyOfArrowFunction: ts.identity,
22293
22262
  parenthesizeCheckTypeOfConditionalType: ts.identity,
22294
22263
  parenthesizeExtendsTypeOfConditionalType: ts.identity,
22295
- parenthesizeConstituentTypesOfUnionType: castToNodeArray,
22264
+ parenthesizeConstituentTypesOfUnionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
22296
22265
  parenthesizeConstituentTypeOfUnionType: ts.identity,
22297
- parenthesizeConstituentTypesOfIntersectionType: castToNodeArray,
22266
+ parenthesizeConstituentTypesOfIntersectionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
22298
22267
  parenthesizeConstituentTypeOfIntersectionType: ts.identity,
22299
22268
  parenthesizeOperandOfTypeOperator: ts.identity,
22300
22269
  parenthesizeOperandOfReadonlyTypeOperator: ts.identity,
22301
22270
  parenthesizeNonArrayTypeOfPostfixType: ts.identity,
22302
- parenthesizeElementTypesOfTupleType: castToNodeArray,
22271
+ parenthesizeElementTypesOfTupleType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
22303
22272
  parenthesizeElementTypeOfTupleType: ts.identity,
22304
22273
  parenthesizeTypeOfOptionalType: ts.identity,
22305
- parenthesizeTypeArguments: function (nodes) { return nodes && castToNodeArray(nodes); },
22274
+ parenthesizeTypeArguments: function (nodes) { return nodes && ts.cast(nodes, ts.isNodeArray); },
22306
22275
  parenthesizeLeadingTypeArgument: ts.identity,
22307
22276
  };
22308
22277
  })(ts || (ts = {}));
@@ -26999,7 +26968,7 @@ var ts;
26999
26968
  clone.transformFlags = node.transformFlags;
27000
26969
  setOriginalNode(clone, node);
27001
26970
  for (var key in node) {
27002
- if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) {
26971
+ if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) {
27003
26972
  continue;
27004
26973
  }
27005
26974
  clone[key] = node[key];
@@ -31887,7 +31856,6 @@ var ts;
31887
31856
  visitNodes(cbNode, cbNodes, node.parameters) ||
31888
31857
  visitNode(cbNode, node.type);
31889
31858
  }
31890
- ;
31891
31859
  function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) {
31892
31860
  return visitNodes(cbNode, cbNodes, node.types);
31893
31861
  }
@@ -33189,7 +33157,7 @@ var ts;
33189
33157
  }
33190
33158
  function parsePrivateIdentifier() {
33191
33159
  var pos = getNodePos();
33192
- var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText()));
33160
+ var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue()));
33193
33161
  nextToken();
33194
33162
  return finishNode(node, pos);
33195
33163
  }
@@ -39287,8 +39255,8 @@ var ts;
39287
39255
  }
39288
39256
  }
39289
39257
  }
39290
- function moveElementEntirelyPastChangeRange(element, delta, oldText, newText, aggressiveChecks) {
39291
- if (ts.isArray(element)) {
39258
+ function moveElementEntirelyPastChangeRange(element, isArray, delta, oldText, newText, aggressiveChecks) {
39259
+ if (isArray) {
39292
39260
  visitArray(element);
39293
39261
  }
39294
39262
  else {
@@ -39296,7 +39264,6 @@ var ts;
39296
39264
  }
39297
39265
  return;
39298
39266
  function visitNode(node) {
39299
- ts.Debug.type(node);
39300
39267
  var text = "";
39301
39268
  if (aggressiveChecks && shouldCheckNode(node)) {
39302
39269
  text = oldText.substring(node.pos, node.end);
@@ -39320,7 +39287,6 @@ var ts;
39320
39287
  checkNodePositions(node, aggressiveChecks);
39321
39288
  }
39322
39289
  function visitArray(array) {
39323
- ts.Debug.type(array);
39324
39290
  array._children = undefined;
39325
39291
  ts.setTextRangePosEnd(array, array.pos + delta, array.end + delta);
39326
39292
  for (var _i = 0, array_9 = array; _i < array_9.length; _i++) {
@@ -39426,12 +39392,11 @@ var ts;
39426
39392
  visitNode(sourceFile);
39427
39393
  return;
39428
39394
  function visitNode(child) {
39429
- ts.Debug.type(child);
39430
39395
  ts.Debug.assert(child.pos <= child.end);
39431
39396
  if (child.pos > changeRangeOldEnd) {
39432
39397
  // Node is entirely past the change range. We need to move both its pos and
39433
39398
  // end, forward or backward appropriately.
39434
- moveElementEntirelyPastChangeRange(child, delta, oldText, newText, aggressiveChecks);
39399
+ moveElementEntirelyPastChangeRange(child, /*isArray*/ false, delta, oldText, newText, aggressiveChecks);
39435
39400
  return;
39436
39401
  }
39437
39402
  // Check if the element intersects the change range. If it does, then it is not
@@ -39457,12 +39422,11 @@ var ts;
39457
39422
  ts.Debug.assert(fullEnd < changeStart);
39458
39423
  }
39459
39424
  function visitArray(array) {
39460
- ts.Debug.type(array);
39461
39425
  ts.Debug.assert(array.pos <= array.end);
39462
39426
  if (array.pos > changeRangeOldEnd) {
39463
39427
  // Array is entirely after the change range. We need to move it, and move any of
39464
39428
  // its children.
39465
- moveElementEntirelyPastChangeRange(array, delta, oldText, newText, aggressiveChecks);
39429
+ moveElementEntirelyPastChangeRange(array, /*isArray*/ true, delta, oldText, newText, aggressiveChecks);
39466
39430
  return;
39467
39431
  }
39468
39432
  // Check if the element intersects the change range. If it does, then it is not
@@ -43064,7 +43028,6 @@ var ts;
43064
43028
  }
43065
43029
  }
43066
43030
  function specToDiagnostic(spec, disallowTrailingRecursion) {
43067
- ts.Debug.assert(typeof spec === "string");
43068
43031
  if (disallowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) {
43069
43032
  return [ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
43070
43033
  }
@@ -43208,7 +43171,7 @@ var ts;
43208
43171
  function convertCompilerOptionsForTelemetry(opts) {
43209
43172
  var out = {};
43210
43173
  for (var key in opts) {
43211
- if (opts.hasOwnProperty(key)) {
43174
+ if (ts.hasProperty(opts, key)) {
43212
43175
  var type = getOptionFromName(key);
43213
43176
  if (type !== undefined) { // Ignore unknown options
43214
43177
  out[key] = getOptionValueWithEmptyStrings(opts[key], type);
@@ -45280,6 +45243,7 @@ var ts;
45280
45243
  }
45281
45244
  }
45282
45245
  function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
45246
+ var _a;
45283
45247
  var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
45284
45248
  // First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
45285
45249
  var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
@@ -45294,13 +45258,7 @@ var ts;
45294
45258
  return withPackageId(packageInfo, fromDirectory);
45295
45259
  }
45296
45260
  }
45297
- var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
45298
45261
  var loader = function (extensions, candidate, onlyRecordFailures, state) {
45299
- var _a;
45300
- // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them)
45301
- if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
45302
- return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
45303
- }
45304
45262
  var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
45305
45263
  loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths);
45306
45264
  if (!pathAndExtension && packageInfo
@@ -45313,19 +45271,24 @@ var ts;
45313
45271
  }
45314
45272
  return withPackageId(packageInfo, pathAndExtension);
45315
45273
  };
45316
- if (rest !== "") { // If "rest" is empty, we just did this search above.
45317
- var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
45318
- // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings.
45274
+ var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest;
45275
+ var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
45276
+ if (rest !== "") {
45277
+ // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now.
45319
45278
  packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
45320
- if (packageInfo && packageInfo.contents.versionPaths) {
45321
- if (state.traceEnabled) {
45322
- trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest);
45323
- }
45324
- var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
45325
- var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state);
45326
- if (fromPaths) {
45327
- return fromPaths.value;
45328
- }
45279
+ }
45280
+ // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them)
45281
+ if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
45282
+ return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
45283
+ }
45284
+ if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) {
45285
+ if (state.traceEnabled) {
45286
+ trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest);
45287
+ }
45288
+ var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
45289
+ var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state);
45290
+ if (fromPaths) {
45291
+ return fromPaths.value;
45329
45292
  }
45330
45293
  }
45331
45294
  return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
@@ -49712,7 +49675,8 @@ var ts;
49712
49675
  var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */);
49713
49676
  emptyTypeLiteralSymbol.members = ts.createSymbolTable();
49714
49677
  var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49715
- var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
49678
+ var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49679
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
49716
49680
  var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49717
49681
  emptyGenericType.instantiations = new ts.Map();
49718
49682
  var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
@@ -49826,6 +49790,8 @@ var ts;
49826
49790
  var deferredGlobalOmitSymbol;
49827
49791
  var deferredGlobalAwaitedSymbol;
49828
49792
  var deferredGlobalBigIntType;
49793
+ var deferredGlobalNaNSymbol;
49794
+ var deferredGlobalRecordSymbol;
49829
49795
  var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
49830
49796
  var flowLoopStart = 0;
49831
49797
  var flowLoopCount = 0;
@@ -49910,7 +49876,7 @@ var ts;
49910
49876
  if (jsxFragmentPragma) {
49911
49877
  var chosenPragma = ts.isArray(jsxFragmentPragma) ? jsxFragmentPragma[0] : jsxFragmentPragma;
49912
49878
  file.localJsxFragmentFactory = ts.parseIsolatedEntityName(chosenPragma.arguments.factory, languageVersion);
49913
- ts.visitNode(file.localJsxFragmentFactory, markAsSynthetic, ts.isEntityName);
49879
+ ts.visitNode(file.localJsxFragmentFactory, markAsSynthetic);
49914
49880
  if (file.localJsxFragmentFactory) {
49915
49881
  return file.localJsxFragmentNamespace = ts.getFirstIdentifier(file.localJsxFragmentFactory).escapedText;
49916
49882
  }
@@ -49955,7 +49921,7 @@ var ts;
49955
49921
  if (jsxPragma) {
49956
49922
  var chosenPragma = ts.isArray(jsxPragma) ? jsxPragma[0] : jsxPragma;
49957
49923
  file.localJsxFactory = ts.parseIsolatedEntityName(chosenPragma.arguments.factory, languageVersion);
49958
- ts.visitNode(file.localJsxFactory, markAsSynthetic, ts.isEntityName);
49924
+ ts.visitNode(file.localJsxFactory, markAsSynthetic);
49959
49925
  if (file.localJsxFactory) {
49960
49926
  return file.localJsxNamespace = ts.getFirstIdentifier(file.localJsxFactory).escapedText;
49961
49927
  }
@@ -51614,7 +51580,6 @@ var ts;
51614
51580
  return valueSymbol;
51615
51581
  }
51616
51582
  var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName);
51617
- ts.Debug.assert(valueSymbol.declarations || typeSymbol.declarations);
51618
51583
  result.declarations = ts.deduplicate(ts.concatenate(valueSymbol.declarations, typeSymbol.declarations), ts.equateValues);
51619
51584
  result.parent = valueSymbol.parent || typeSymbol.parent;
51620
51585
  if (valueSymbol.valueDeclaration)
@@ -53667,7 +53632,6 @@ var ts;
53667
53632
  var objectFlags = ts.getObjectFlags(type);
53668
53633
  if (objectFlags & 4 /* ObjectFlags.Reference */) {
53669
53634
  ts.Debug.assert(!!(type.flags & 524288 /* TypeFlags.Object */));
53670
- ts.Debug.type(type);
53671
53635
  return type.node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(type);
53672
53636
  }
53673
53637
  if (type.flags & 262144 /* TypeFlags.TypeParameter */ || objectFlags & 3 /* ObjectFlags.ClassOrInterface */) {
@@ -55126,7 +55090,7 @@ var ts;
55126
55090
  }
55127
55091
  var hadError = false;
55128
55092
  var file = ts.getSourceFileOfNode(existing);
55129
- var transformed = ts.visitNode(existing, visitExistingNodeTreeSymbols, ts.isTypeNode);
55093
+ var transformed = ts.visitNode(existing, visitExistingNodeTreeSymbols);
55130
55094
  if (hadError) {
55131
55095
  return undefined;
55132
55096
  }
@@ -55157,7 +55121,7 @@ var ts;
55157
55121
  var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText);
55158
55122
  var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined;
55159
55123
  return ts.factory.createPropertySignature(
55160
- /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols, ts.isTypeNode)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */));
55124
+ /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */));
55161
55125
  }));
55162
55126
  }
55163
55127
  if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") {
@@ -55168,18 +55132,18 @@ var ts;
55168
55132
  /*modifiers*/ undefined, [ts.factory.createParameterDeclaration(
55169
55133
  /*modifiers*/ undefined,
55170
55134
  /*dotdotdotToken*/ undefined, "x",
55171
- /*questionToken*/ undefined, ts.visitNode(node.typeArguments[0], visitExistingNodeTreeSymbols, ts.isTypeNode))], ts.visitNode(node.typeArguments[1], visitExistingNodeTreeSymbols))]);
55135
+ /*questionToken*/ undefined, ts.visitNode(node.typeArguments[0], visitExistingNodeTreeSymbols))], ts.visitNode(node.typeArguments[1], visitExistingNodeTreeSymbols))]);
55172
55136
  }
55173
55137
  if (ts.isJSDocFunctionType(node)) {
55174
55138
  if (ts.isJSDocConstructSignature(node)) {
55175
55139
  var newTypeNode_1;
55176
55140
  return ts.factory.createConstructorTypeNode(
55177
- /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols, ts.isTypeParameterDeclaration), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration(
55141
+ /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration(
55178
55142
  /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols),
55179
55143
  /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */));
55180
55144
  }
55181
55145
  else {
55182
- return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols, ts.isTypeParameterDeclaration), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration(
55146
+ return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration(
55183
55147
  /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols),
55184
55148
  /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */));
55185
55149
  }
@@ -55505,6 +55469,7 @@ var ts;
55505
55469
  && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */
55506
55470
  && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */)
55507
55471
  && !(symbol.flags & 32 /* SymbolFlags.Class */)
55472
+ && !(symbol.flags & 8192 /* SymbolFlags.Method */)
55508
55473
  && !isConstMergedWithNSPrintableAsSignatureMerge) {
55509
55474
  if (propertyAsAlias) {
55510
55475
  var createdExport = serializeMaybeAliasAssignment(symbol);
@@ -55634,7 +55599,7 @@ var ts;
55634
55599
  }
55635
55600
  }
55636
55601
  function includePrivateSymbol(symbol) {
55637
- if (ts.some(symbol.declarations, ts.isParameter))
55602
+ if (ts.some(symbol.declarations, ts.isParameterDeclaration))
55638
55603
  return;
55639
55604
  ts.Debug.assertIsDefined(deferredPrivatesStack[deferredPrivatesStack.length - 1]);
55640
55605
  getUnusedName(ts.unescapeLeadingUnderscores(symbol.escapedName), symbol); // Call to cache unique name for symbol
@@ -56021,7 +55986,7 @@ var ts;
56021
55986
  case 268 /* SyntaxKind.ImportEqualsDeclaration */:
56022
55987
  // This _specifically_ only exists to handle json declarations - where we make aliases, but since
56023
55988
  // we emit no declarations for the json document, must not refer to it in the declarations
56024
- if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, function (d) { return ts.isSourceFile(d) && ts.isJsonSourceFile(d); })) {
55989
+ if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, ts.isJsonSourceFile)) {
56025
55990
  serializeMaybeAliasAssignment(symbol);
56026
55991
  break;
56027
55992
  }
@@ -57186,7 +57151,6 @@ var ts;
57186
57151
  return container;
57187
57152
  }
57188
57153
  }
57189
- ;
57190
57154
  }
57191
57155
  /** Create a synthetic property access flow node after the last statement of the file */
57192
57156
  function getFlowTypeFromCommonJSExport(symbol) {
@@ -60316,7 +60280,7 @@ var ts;
60316
60280
  var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp);
60317
60281
  // If the symbols are instances of one another with identical types - consider the symbols
60318
60282
  // equivalent and just use the first one, which thus allows us to avoid eliding private
60319
- // members when intersecting a (this-)instantiations of a class with it's raw base or another instance
60283
+ // members when intersecting a (this-)instantiations of a class with its raw base or another instance
60320
60284
  if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) {
60321
60285
  // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used
60322
60286
  // to do when we recorded multiple distinct symbols so that we still get, eg, `Array<T>.length` printed
@@ -60364,7 +60328,11 @@ var ts;
60364
60328
  }
60365
60329
  }
60366
60330
  }
60367
- if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) {
60331
+ if (!singleProp ||
60332
+ isUnion &&
60333
+ (propSet || checkFlags & 48 /* CheckFlags.Partial */) &&
60334
+ checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) &&
60335
+ !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) {
60368
60336
  // No property was found, or, in a union, a property has a private or protected declaration in one
60369
60337
  // constituent, but is missing or has a different declaration in another constituent.
60370
60338
  return undefined;
@@ -60466,6 +60434,33 @@ var ts;
60466
60434
  }
60467
60435
  return property;
60468
60436
  }
60437
+ function getCommonDeclarationsOfSymbols(symbols) {
60438
+ var commonDeclarations;
60439
+ var _loop_14 = function (symbol) {
60440
+ if (!symbol.declarations) {
60441
+ return { value: undefined };
60442
+ }
60443
+ if (!commonDeclarations) {
60444
+ commonDeclarations = new ts.Set(symbol.declarations);
60445
+ return "continue";
60446
+ }
60447
+ commonDeclarations.forEach(function (declaration) {
60448
+ if (!ts.contains(symbol.declarations, declaration)) {
60449
+ commonDeclarations.delete(declaration);
60450
+ }
60451
+ });
60452
+ if (commonDeclarations.size === 0) {
60453
+ return { value: undefined };
60454
+ }
60455
+ };
60456
+ for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
60457
+ var symbol = symbols_3[_i];
60458
+ var state_4 = _loop_14(symbol);
60459
+ if (typeof state_4 === "object")
60460
+ return state_4.value;
60461
+ }
60462
+ return commonDeclarations;
60463
+ }
60469
60464
  function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) {
60470
60465
  var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
60471
60466
  // We need to filter out partial properties in union types
@@ -61180,7 +61175,7 @@ var ts;
61180
61175
  function getIndexInfosOfIndexSymbol(indexSymbol) {
61181
61176
  if (indexSymbol.declarations) {
61182
61177
  var indexInfos_4 = [];
61183
- var _loop_14 = function (declaration) {
61178
+ var _loop_15 = function (declaration) {
61184
61179
  if (declaration.parameters.length === 1) {
61185
61180
  var parameter = declaration.parameters[0];
61186
61181
  if (parameter.type) {
@@ -61194,7 +61189,7 @@ var ts;
61194
61189
  };
61195
61190
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
61196
61191
  var declaration = _a[_i];
61197
- _loop_14(declaration);
61192
+ _loop_15(declaration);
61198
61193
  }
61199
61194
  return indexInfos_4;
61200
61195
  }
@@ -61211,7 +61206,7 @@ var ts;
61211
61206
  var _a;
61212
61207
  var inferences;
61213
61208
  if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
61214
- var _loop_15 = function (declaration) {
61209
+ var _loop_16 = function (declaration) {
61215
61210
  if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) {
61216
61211
  // When an 'infer T' declaration is immediately contained in a type reference node
61217
61212
  // (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
@@ -61275,7 +61270,7 @@ var ts;
61275
61270
  };
61276
61271
  for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
61277
61272
  var declaration = _b[_i];
61278
- _loop_15(declaration);
61273
+ _loop_16(declaration);
61279
61274
  }
61280
61275
  }
61281
61276
  return inferences && getIntersectionType(inferences);
@@ -61932,6 +61927,13 @@ var ts;
61932
61927
  function getGlobalBigIntType() {
61933
61928
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
61934
61929
  }
61930
+ function getGlobalNaNSymbol() {
61931
+ return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false)));
61932
+ }
61933
+ function getGlobalRecordSymbol() {
61934
+ deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
61935
+ return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
61936
+ }
61935
61937
  /**
61936
61938
  * Instantiates a global type that is generic with some element type, and returns that instantiation.
61937
61939
  */
@@ -62168,7 +62170,7 @@ var ts;
62168
62170
  var lastRequiredIndex = -1;
62169
62171
  var firstRestIndex = -1;
62170
62172
  var lastOptionalOrRestIndex = -1;
62171
- var _loop_16 = function (i) {
62173
+ var _loop_17 = function (i) {
62172
62174
  var type = elementTypes[i];
62173
62175
  var flags = target.elementFlags[i];
62174
62176
  if (flags & 8 /* ElementFlags.Variadic */) {
@@ -62198,9 +62200,9 @@ var ts;
62198
62200
  }
62199
62201
  };
62200
62202
  for (var i = 0; i < elementTypes.length; i++) {
62201
- var state_4 = _loop_16(i);
62202
- if (typeof state_4 === "object")
62203
- return state_4.value;
62203
+ var state_5 = _loop_17(i);
62204
+ if (typeof state_5 === "object")
62205
+ return state_5.value;
62204
62206
  }
62205
62207
  // Turn optional elements preceding the last required element into required elements
62206
62208
  for (var i = 0; i < lastRequiredIndex; i++) {
@@ -62228,7 +62230,7 @@ var ts;
62228
62230
  if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) {
62229
62231
  lastOptionalOrRestIndex = expandedFlags.length;
62230
62232
  }
62231
- expandedTypes.push(type);
62233
+ expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type);
62232
62234
  expandedFlags.push(flags);
62233
62235
  if (expandedDeclarations && declaration) {
62234
62236
  expandedDeclarations.push(declaration);
@@ -62394,7 +62396,7 @@ var ts;
62394
62396
  var templates = ts.filter(types, isPatternLiteralType);
62395
62397
  if (templates.length) {
62396
62398
  var i = types.length;
62397
- var _loop_17 = function () {
62399
+ var _loop_18 = function () {
62398
62400
  i--;
62399
62401
  var t = types[i];
62400
62402
  if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
@@ -62402,7 +62404,7 @@ var ts;
62402
62404
  }
62403
62405
  };
62404
62406
  while (i > 0) {
62405
- _loop_17();
62407
+ _loop_18();
62406
62408
  }
62407
62409
  }
62408
62410
  }
@@ -62479,14 +62481,14 @@ var ts;
62479
62481
  var namedUnions = [];
62480
62482
  addNamedUnions(namedUnions, types);
62481
62483
  var reducedTypes = [];
62482
- var _loop_18 = function (t) {
62484
+ var _loop_19 = function (t) {
62483
62485
  if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
62484
62486
  reducedTypes.push(t);
62485
62487
  }
62486
62488
  };
62487
62489
  for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
62488
62490
  var t = typeSet_1[_i];
62489
- _loop_18(t);
62491
+ _loop_19(t);
62490
62492
  }
62491
62493
  if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
62492
62494
  return namedUnions[0];
@@ -63716,7 +63718,7 @@ var ts;
63716
63718
  var result;
63717
63719
  var extraTypes;
63718
63720
  var tailCount = 0;
63719
- var _loop_19 = function () {
63721
+ var _loop_20 = function () {
63720
63722
  if (tailCount === 1000) {
63721
63723
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
63722
63724
  result = errorType;
@@ -63837,10 +63839,10 @@ var ts;
63837
63839
  // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63838
63840
  // cases we increment the tail recursion counter and stop after 1000 iterations.
63839
63841
  while (true) {
63840
- var state_5 = _loop_19();
63841
- if (typeof state_5 === "object")
63842
- return state_5.value;
63843
- if (state_5 === "break")
63842
+ var state_6 = _loop_20();
63843
+ if (typeof state_6 === "object")
63844
+ return state_6.value;
63845
+ if (state_6 === "break")
63844
63846
  break;
63845
63847
  }
63846
63848
  return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
@@ -66455,7 +66457,7 @@ var ts;
66455
66457
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
66456
66458
  checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
66457
66459
  }
66458
- var _loop_20 = function (prop) {
66460
+ var _loop_21 = function (prop) {
66459
66461
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
66460
66462
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
66461
66463
  if (reportErrors) {
@@ -66518,9 +66520,9 @@ var ts;
66518
66520
  };
66519
66521
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
66520
66522
  var prop = _b[_i];
66521
- var state_6 = _loop_20(prop);
66522
- if (typeof state_6 === "object")
66523
- return state_6.value;
66523
+ var state_7 = _loop_21(prop);
66524
+ if (typeof state_7 === "object")
66525
+ return state_7.value;
66524
66526
  }
66525
66527
  return false;
66526
66528
  }
@@ -67511,11 +67513,11 @@ var ts;
67511
67513
  // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
67512
67514
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
67513
67515
  var matchingTypes = [];
67514
- var _loop_21 = function (combination) {
67516
+ var _loop_22 = function (combination) {
67515
67517
  var hasMatch = false;
67516
67518
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
67517
67519
  var type = _d[_c];
67518
- var _loop_22 = function (i) {
67520
+ var _loop_23 = function (i) {
67519
67521
  var sourceProperty = sourcePropertiesFiltered[i];
67520
67522
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
67521
67523
  if (!targetProperty)
@@ -67531,8 +67533,8 @@ var ts;
67531
67533
  }
67532
67534
  };
67533
67535
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
67534
- var state_8 = _loop_22(i);
67535
- switch (state_8) {
67536
+ var state_9 = _loop_23(i);
67537
+ switch (state_9) {
67536
67538
  case "continue-outer": continue outer;
67537
67539
  }
67538
67540
  }
@@ -67545,9 +67547,9 @@ var ts;
67545
67547
  };
67546
67548
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
67547
67549
  var combination = discriminantCombinations_1[_a];
67548
- var state_7 = _loop_21(combination);
67549
- if (typeof state_7 === "object")
67550
- return state_7.value;
67550
+ var state_8 = _loop_22(combination);
67551
+ if (typeof state_8 === "object")
67552
+ return state_8.value;
67551
67553
  }
67552
67554
  // Compare the remaining non-discriminant properties of each match.
67553
67555
  var result = -1 /* Ternary.True */;
@@ -68252,7 +68254,7 @@ var ts;
68252
68254
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
68253
68255
  links.variances = ts.emptyArray;
68254
68256
  var variances = [];
68255
- var _loop_23 = function (tp) {
68257
+ var _loop_24 = function (tp) {
68256
68258
  var modifiers = getVarianceModifiers(tp);
68257
68259
  var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
68258
68260
  modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@@ -68290,7 +68292,7 @@ var ts;
68290
68292
  };
68291
68293
  for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
68292
68294
  var tp = typeParameters_2[_i];
68293
- _loop_23(tp);
68295
+ _loop_24(tp);
68294
68296
  }
68295
68297
  links.variances = variances;
68296
68298
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@@ -68882,7 +68884,8 @@ var ts;
68882
68884
  function getOptionalType(type, isProperty) {
68883
68885
  if (isProperty === void 0) { isProperty = false; }
68884
68886
  ts.Debug.assert(strictNullChecks);
68885
- return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
68887
+ var missingOrUndefined = isProperty ? missingType : undefinedType;
68888
+ return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]);
68886
68889
  }
68887
68890
  function getGlobalNonNullableTypeInstantiation(type) {
68888
68891
  if (!deferredGlobalNonNullableTypeAlias) {
@@ -70247,7 +70250,7 @@ var ts;
70247
70250
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
70248
70251
  // succeed. That would be a pointless and confusing outcome.
70249
70252
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
70250
- var _loop_24 = function (i) {
70253
+ var _loop_25 = function (i) {
70251
70254
  var source_1 = matches ? matches[i] : neverType;
70252
70255
  var target_3 = types[i];
70253
70256
  // If we are inferring from a string literal type to a type variable whose constraint includes one of the
@@ -70297,7 +70300,7 @@ var ts;
70297
70300
  inferFromTypes(source_1, target_3);
70298
70301
  };
70299
70302
  for (var i = 0; i < types.length; i++) {
70300
- _loop_24(i);
70303
+ _loop_25(i);
70301
70304
  }
70302
70305
  }
70303
70306
  }
@@ -70761,7 +70764,7 @@ var ts;
70761
70764
  return name;
70762
70765
  }
70763
70766
  }
70764
- if (ts.hasOnlyExpressionInitializer(declaration)) {
70767
+ if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
70765
70768
  var initializer = ts.getEffectiveInitializer(declaration);
70766
70769
  return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
70767
70770
  }
@@ -70821,7 +70824,7 @@ var ts;
70821
70824
  function mapTypesByKeyProperty(types, name) {
70822
70825
  var map = new ts.Map();
70823
70826
  var count = 0;
70824
- var _loop_25 = function (type) {
70827
+ var _loop_26 = function (type) {
70825
70828
  if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
70826
70829
  var discriminant = getTypeOfPropertyOfType(type, name);
70827
70830
  if (discriminant) {
@@ -70847,9 +70850,9 @@ var ts;
70847
70850
  };
70848
70851
  for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
70849
70852
  var type = types_15[_i];
70850
- var state_9 = _loop_25(type);
70851
- if (typeof state_9 === "object")
70852
- return state_9.value;
70853
+ var state_10 = _loop_26(type);
70854
+ if (typeof state_10 === "object")
70855
+ return state_10.value;
70853
70856
  }
70854
70857
  return count >= 10 && count * 2 >= types.length ? map : undefined;
70855
70858
  }
@@ -72248,18 +72251,26 @@ var ts;
72248
72251
  }
72249
72252
  function isTypePresencePossible(type, propName, assumeTrue) {
72250
72253
  var prop = getPropertyOfType(type, propName);
72251
- if (prop) {
72252
- return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue;
72253
- }
72254
- return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
72255
- }
72256
- function narrowByInKeyword(type, name, assumeTrue) {
72257
- if (type.flags & 1048576 /* TypeFlags.Union */
72258
- || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
72259
- || ts.isThisTypeParameter(type)
72260
- || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
72254
+ return prop ?
72255
+ !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
72256
+ !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
72257
+ }
72258
+ function narrowByInKeyword(type, nameType, assumeTrue) {
72259
+ var name = getPropertyNameFromType(nameType);
72260
+ var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
72261
+ if (isKnownProperty) {
72262
+ // If the check is for a known property (i.e. a property declared in some constituent of
72263
+ // the target type), we filter the target type by presence of absence of the property.
72261
72264
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
72262
72265
  }
72266
+ if (assumeTrue) {
72267
+ // If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
72268
+ // where X is the name of the property.
72269
+ var recordSymbol = getGlobalRecordSymbol();
72270
+ if (recordSymbol) {
72271
+ return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]);
72272
+ }
72273
+ }
72263
72274
  return type;
72264
72275
  }
72265
72276
  function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
@@ -72318,15 +72329,14 @@ var ts;
72318
72329
  return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
72319
72330
  }
72320
72331
  var target = getReferenceCandidate(expr.right);
72321
- var leftType = getTypeOfNode(expr.left);
72322
- if (leftType.flags & 128 /* TypeFlags.StringLiteral */) {
72323
- var name = ts.escapeLeadingUnderscores(leftType.value);
72332
+ var leftType = getTypeOfExpression(expr.left);
72333
+ if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) {
72324
72334
  if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) &&
72325
- getAccessedPropertyName(reference) === name) {
72335
+ getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
72326
72336
  return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
72327
72337
  }
72328
72338
  if (isMatchingReference(reference, target)) {
72329
- return narrowByInKeyword(type, name, assumeTrue);
72339
+ return narrowByInKeyword(type, leftType, assumeTrue);
72330
72340
  }
72331
72341
  }
72332
72342
  break;
@@ -74588,7 +74598,7 @@ var ts;
74588
74598
  return left === right || !left ? left
74589
74599
  : compareTypeParametersIdentical(left.typeParameters, right.typeParameters) ? combineSignaturesOfIntersectionMembers(left, right)
74590
74600
  : undefined;
74591
- }) // TODO(jakebailey): This is suspect. Can't pass initialValue as reduceLeft checks argument length.
74601
+ })
74592
74602
  : undefined;
74593
74603
  }
74594
74604
  function combineIntersectionThisParam(left, right, mapper) {
@@ -76496,7 +76506,6 @@ var ts;
76496
76506
  }
76497
76507
  return false;
76498
76508
  }
76499
- ;
76500
76509
  var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
76501
76510
  if (!hasProp(suggestedMethod)) {
76502
76511
  return undefined;
@@ -77298,7 +77307,7 @@ var ts;
77298
77307
  if (spreadIndex >= 0) {
77299
77308
  // Create synthetic arguments from spreads of tuple types.
77300
77309
  var effectiveArgs_1 = args.slice(0, spreadIndex);
77301
- var _loop_26 = function (i) {
77310
+ var _loop_27 = function (i) {
77302
77311
  var arg = args[i];
77303
77312
  // We can call checkExpressionCached because spread expressions never have a contextual type.
77304
77313
  var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -77315,7 +77324,7 @@ var ts;
77315
77324
  }
77316
77325
  };
77317
77326
  for (var i = spreadIndex; i < args.length; i++) {
77318
- _loop_26(i);
77327
+ _loop_27(i);
77319
77328
  }
77320
77329
  return effectiveArgs_1;
77321
77330
  }
@@ -77644,7 +77653,7 @@ var ts;
77644
77653
  var min_3 = Number.MAX_VALUE;
77645
77654
  var minIndex = 0;
77646
77655
  var i_1 = 0;
77647
- var _loop_27 = function (c) {
77656
+ var _loop_28 = function (c) {
77648
77657
  var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
77649
77658
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
77650
77659
  if (diags_2) {
@@ -77662,7 +77671,7 @@ var ts;
77662
77671
  };
77663
77672
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
77664
77673
  var c = candidatesForArgumentError_1[_a];
77665
- _loop_27(c);
77674
+ _loop_28(c);
77666
77675
  }
77667
77676
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
77668
77677
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -77820,7 +77829,7 @@ var ts;
77820
77829
  }
77821
77830
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
77822
77831
  var parameters = [];
77823
- var _loop_28 = function (i) {
77832
+ var _loop_29 = function (i) {
77824
77833
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
77825
77834
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
77826
77835
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -77828,7 +77837,7 @@ var ts;
77828
77837
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
77829
77838
  };
77830
77839
  for (var i = 0; i < maxNonRestParam; i++) {
77831
- _loop_28(i);
77840
+ _loop_29(i);
77832
77841
  }
77833
77842
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
77834
77843
  var flags = 0 /* SignatureFlags.None */;
@@ -80067,6 +80076,9 @@ var ts;
80067
80076
  }
80068
80077
  return booleanType;
80069
80078
  }
80079
+ function hasEmptyObjectIntersection(type) {
80080
+ return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); });
80081
+ }
80070
80082
  function checkInExpression(left, right, leftType, rightType) {
80071
80083
  if (leftType === silentNeverType || rightType === silentNeverType) {
80072
80084
  return silentNeverType;
@@ -80083,40 +80095,20 @@ var ts;
80083
80095
  }
80084
80096
  }
80085
80097
  else {
80086
- leftType = checkNonNullType(leftType, left);
80087
- // TypeScript 1.0 spec (April 2014): 4.15.5
80088
- // Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
80089
- if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
80090
- isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
80091
- error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
80098
+ // The type of the lef operand must be assignable to string, number, or symbol.
80099
+ checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
80100
+ }
80101
+ // The type of the right operand must be assignable to 'object'.
80102
+ if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
80103
+ // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we
80104
+ // detect and error on {} that results from narrowing the unknown type, as well as intersections
80105
+ // that include {} (we know that the other types in such intersections are assignable to object
80106
+ // since we already checked for that).
80107
+ if (hasEmptyObjectIntersection(rightType)) {
80108
+ error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType));
80092
80109
  }
80093
80110
  }
80094
- rightType = checkNonNullType(rightType, right);
80095
- // TypeScript 1.0 spec (April 2014): 4.15.5
80096
- // The in operator requires the right operand to be
80097
- //
80098
- // 1. assignable to the non-primitive type,
80099
- // 2. an unconstrained type parameter,
80100
- // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
80101
- // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
80102
- // non-primitive type, or
80103
- // 4. a type parameter whose constraint is
80104
- // i. an object type,
80105
- // ii. the non-primitive type, or
80106
- // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
80107
- //
80108
- // The divergent behavior for type parameters and unions containing type parameters is a workaround for type
80109
- // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
80110
- // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
80111
- // unless *all* instantiations would result in an error.
80112
- //
80113
80111
  // The result is always of the Boolean primitive type.
80114
- var rightTypeConstraint = getConstraintOfType(rightType);
80115
- if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
80116
- rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
80117
- !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
80118
- error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
80119
- }
80120
80112
  return booleanType;
80121
80113
  }
80122
80114
  function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
@@ -80627,6 +80619,7 @@ var ts;
80627
80619
  var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */;
80628
80620
  error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
80629
80621
  }
80622
+ checkNaNEquality(errorNode, operator, left, right);
80630
80623
  reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); });
80631
80624
  return booleanType;
80632
80625
  case 102 /* SyntaxKind.InstanceOfKeyword */:
@@ -80832,6 +80825,26 @@ var ts;
80832
80825
  return undefined;
80833
80826
  }
80834
80827
  }
80828
+ function checkNaNEquality(errorNode, operator, left, right) {
80829
+ var isLeftNaN = isGlobalNaN(ts.skipParentheses(left));
80830
+ var isRightNaN = isGlobalNaN(ts.skipParentheses(right));
80831
+ if (isLeftNaN || isRightNaN) {
80832
+ var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */));
80833
+ if (isLeftNaN && isRightNaN)
80834
+ return;
80835
+ var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : "";
80836
+ var location = isLeftNaN ? right : left;
80837
+ var expression = ts.skipParentheses(location);
80838
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")")));
80839
+ }
80840
+ }
80841
+ function isGlobalNaN(expr) {
80842
+ if (ts.isIdentifier(expr) && expr.escapedText === "NaN") {
80843
+ var globalNaNSymbol = getGlobalNaNSymbol();
80844
+ return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr);
80845
+ }
80846
+ return false;
80847
+ }
80835
80848
  }
80836
80849
  function getBaseTypesIfUnrelated(leftType, rightType, isRelated) {
80837
80850
  var effectiveLeft = leftType;
@@ -81869,7 +81882,7 @@ var ts;
81869
81882
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
81870
81883
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
81871
81884
  var indexSignatureMap_1 = new ts.Map();
81872
- var _loop_29 = function (declaration) {
81885
+ var _loop_30 = function (declaration) {
81873
81886
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
81874
81887
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
81875
81888
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -81884,7 +81897,7 @@ var ts;
81884
81897
  };
81885
81898
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
81886
81899
  var declaration = _a[_i];
81887
- _loop_29(declaration);
81900
+ _loop_30(declaration);
81888
81901
  }
81889
81902
  indexSignatureMap_1.forEach(function (entry) {
81890
81903
  if (entry.declarations.length > 1) {
@@ -85484,7 +85497,7 @@ var ts;
85484
85497
  var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
85485
85498
  name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
85486
85499
  var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
85487
- var _loop_30 = function (info) {
85500
+ var _loop_31 = function (info) {
85488
85501
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
85489
85502
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
85490
85503
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -85501,7 +85514,7 @@ var ts;
85501
85514
  };
85502
85515
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
85503
85516
  var info = indexInfos_9[_i];
85504
- _loop_30(info);
85517
+ _loop_31(info);
85505
85518
  }
85506
85519
  }
85507
85520
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -85509,7 +85522,7 @@ var ts;
85509
85522
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
85510
85523
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
85511
85524
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
85512
- var _loop_31 = function (info) {
85525
+ var _loop_32 = function (info) {
85513
85526
  if (info === checkInfo)
85514
85527
  return "continue";
85515
85528
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -85524,7 +85537,7 @@ var ts;
85524
85537
  };
85525
85538
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
85526
85539
  var info = indexInfos_10[_i];
85527
- _loop_31(info);
85540
+ _loop_32(info);
85528
85541
  }
85529
85542
  }
85530
85543
  function checkTypeNameIsReserved(name, message) {
@@ -85844,7 +85857,7 @@ var ts;
85844
85857
  var baseTypes = baseTypeNode && getBaseTypes(type);
85845
85858
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
85846
85859
  var baseStaticType = getBaseConstructorTypeOfClass(type);
85847
- var _loop_32 = function (member) {
85860
+ var _loop_33 = function (member) {
85848
85861
  if (ts.hasAmbientModifier(member)) {
85849
85862
  return "continue";
85850
85863
  }
@@ -85861,7 +85874,7 @@ var ts;
85861
85874
  };
85862
85875
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85863
85876
  var member = _a[_i];
85864
- _loop_32(member);
85877
+ _loop_33(member);
85865
85878
  }
85866
85879
  }
85867
85880
  /**
@@ -85949,7 +85962,7 @@ var ts;
85949
85962
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
85950
85963
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
85951
85964
  var issuedMemberError = false;
85952
- var _loop_33 = function (member) {
85965
+ var _loop_34 = function (member) {
85953
85966
  if (ts.isStatic(member)) {
85954
85967
  return "continue";
85955
85968
  }
@@ -85968,7 +85981,7 @@ var ts;
85968
85981
  };
85969
85982
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85970
85983
  var member = _a[_i];
85971
- _loop_33(member);
85984
+ _loop_34(member);
85972
85985
  }
85973
85986
  if (!issuedMemberError) {
85974
85987
  // check again with diagnostics to generate a less-specific error
@@ -86039,7 +86052,7 @@ var ts;
86039
86052
  var _a, _b, _c, _d;
86040
86053
  // NOTE: assignability is checked in checkClassDeclaration
86041
86054
  var baseProperties = getPropertiesOfType(baseType);
86042
- var _loop_34 = function (baseProperty) {
86055
+ var _loop_35 = function (baseProperty) {
86043
86056
  var base = getTargetSymbol(baseProperty);
86044
86057
  if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
86045
86058
  return "continue";
@@ -86149,8 +86162,8 @@ var ts;
86149
86162
  };
86150
86163
  basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
86151
86164
  var baseProperty = baseProperties_1[_i];
86152
- var state_10 = _loop_34(baseProperty);
86153
- switch (state_10) {
86165
+ var state_11 = _loop_35(baseProperty);
86166
+ switch (state_11) {
86154
86167
  case "continue-basePropertyCheck": continue basePropertyCheck;
86155
86168
  }
86156
86169
  }
@@ -91126,27 +91139,17 @@ var ts;
91126
91139
  })(ts || (ts = {}));
91127
91140
  var ts;
91128
91141
  (function (ts) {
91129
- // TODO(jakebailey): include type guard and non-type guard variants on visitNode and visitNodes
91130
91142
  var _a;
91131
- /**
91132
- * Visits a Node using the supplied visitor, possibly returning a new Node in its place.
91133
- *
91134
- * @param node The Node to visit.
91135
- * @param visitor The callback used to visit the Node.
91136
- * @param test A callback to execute to verify the Node is valid.
91137
- * @param lift An optional callback to execute to lift a NodeArray into a valid Node.
91138
- */
91139
91143
  function visitNode(node, visitor, test, lift) {
91140
- if (node === undefined) {
91141
- // If the input type is undefined, then the output type can be undefined.
91144
+ if (node === undefined || visitor === undefined) {
91145
+ return node;
91146
+ }
91147
+ var visited = visitor(node);
91148
+ if (visited === node) {
91142
91149
  return node;
91143
91150
  }
91144
- var visited = visitor ? visitor(node) : node;
91145
91151
  var visitedNode;
91146
91152
  if (visited === undefined) {
91147
- // If the visited node is undefined, then the visitor must have returned undefined,
91148
- // so the visitor must have been declared as able to return undefined, so TOut must be
91149
- // potentially undefined.
91150
91153
  return undefined;
91151
91154
  }
91152
91155
  else if (ts.isArray(visited)) {
@@ -91159,7 +91162,6 @@ var ts;
91159
91162
  return visitedNode;
91160
91163
  }
91161
91164
  ts.visitNode = visitNode;
91162
- (function (_) { })(visitNode); // Check that visitNode is a NodeVisitor.
91163
91165
  /**
91164
91166
  * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
91165
91167
  *
@@ -91170,8 +91172,7 @@ var ts;
91170
91172
  * @param count An optional value indicating the maximum number of nodes to visit.
91171
91173
  */
91172
91174
  function visitNodes(nodes, visitor, test, start, count) {
91173
- if (nodes === undefined) {
91174
- // If the input type is undefined, then the output type can be undefined.
91175
+ if (nodes === undefined || visitor === undefined) {
91175
91176
  return nodes;
91176
91177
  }
91177
91178
  // Ensure start and count have valid values
@@ -91202,17 +91203,11 @@ var ts;
91202
91203
  ts.setTextRangePosEnd(updatedArray, pos, end);
91203
91204
  return updatedArray;
91204
91205
  }
91205
- // If we are here, updated === nodes. This means that it's still a NodeArray,
91206
- // and also that its contents passed the tests in visitArrayWorker, so has contents
91207
- // of type TOut.
91208
91206
  return nodes;
91209
91207
  }
91210
91208
  ts.visitNodes = visitNodes;
91211
- (function (_) { })(visitNodes); // Check that visitNode is a NodeVisitor.
91212
- /* @internal */
91213
91209
  function visitArray(nodes, visitor, test, start, count) {
91214
91210
  if (nodes === undefined) {
91215
- // If the input type is undefined, then the output type can be undefined.
91216
91211
  return nodes;
91217
91212
  }
91218
91213
  // Ensure start and count have valid values
@@ -91237,7 +91232,7 @@ var ts;
91237
91232
  // Visit each original node.
91238
91233
  for (var i = 0; i < count; i++) {
91239
91234
  var node = nodes[i + start];
91240
- var visited = node !== undefined ? (visitor ? visitor(node) : node) : undefined;
91235
+ var visited = node !== undefined ? visitor(node) : undefined;
91241
91236
  if (updated !== undefined || visited === undefined || visited !== node) {
91242
91237
  if (updated === undefined) {
91243
91238
  // Ensure we have a copy of `nodes`, up to the current index.
@@ -91247,20 +91242,18 @@ var ts;
91247
91242
  if (ts.isArray(visited)) {
91248
91243
  for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) {
91249
91244
  var visitedNode = visited_1[_i];
91250
- // void Debug.assertNode(visitedNode, test);
91245
+ void ts.Debug.assertNode(visitedNode, test);
91251
91246
  updated.push(visitedNode);
91252
91247
  }
91253
91248
  }
91254
91249
  else {
91255
- // void Debug.assertNode(visited, test);
91250
+ void ts.Debug.assertNode(visited, test);
91256
91251
  updated.push(visited);
91257
91252
  }
91258
91253
  }
91259
91254
  }
91260
91255
  }
91261
- var result = updated !== null && updated !== void 0 ? updated : nodes;
91262
- ts.Debug.assertEachNode(result, test);
91263
- return result;
91256
+ return updated !== null && updated !== void 0 ? updated : nodes;
91264
91257
  }
91265
91258
  /**
91266
91259
  * Starts a new lexical environment and visits a statement list, ending the lexical environment
@@ -91281,7 +91274,7 @@ var ts;
91281
91274
  context.startLexicalEnvironment();
91282
91275
  if (nodes) {
91283
91276
  context.setLexicalEnvironmentFlags(1 /* LexicalEnvironmentFlags.InParameters */, true);
91284
- updated = nodesVisitor(nodes, visitor, ts.isParameter);
91277
+ updated = nodesVisitor(nodes, visitor, ts.isParameterDeclaration);
91285
91278
  // As of ES2015, any runtime execution of that occurs in for a parameter (such as evaluating an
91286
91279
  // initializer or a binding pattern), occurs in its own lexical scope. As a result, any expression
91287
91280
  // that we might transform that introduces a temporary variable would fail as the temporary variable
@@ -91364,7 +91357,6 @@ var ts;
91364
91357
  if (nodeVisitor === void 0) { nodeVisitor = visitNode; }
91365
91358
  context.startBlockScope();
91366
91359
  var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock);
91367
- ts.Debug.assert(updated);
91368
91360
  var declarations = context.endBlockScope();
91369
91361
  if (ts.some(declarations)) {
91370
91362
  if (ts.isBlock(updated)) {
@@ -91404,23 +91396,23 @@ var ts;
91404
91396
  return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode));
91405
91397
  },
91406
91398
  _a[166 /* SyntaxKind.Parameter */] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) {
91407
- return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), ts.Debug.checkDefined(nodeVisitor(node.name, visitor, ts.isBindingName)), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression));
91399
+ return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression));
91408
91400
  },
91409
91401
  _a[167 /* SyntaxKind.Decorator */] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
91410
91402
  return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression));
91411
91403
  },
91412
91404
  // Type elements
91413
91405
  _a[168 /* SyntaxKind.PropertySignature */] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) {
91414
- return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode));
91406
+ return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode));
91415
91407
  },
91416
91408
  _a[169 /* SyntaxKind.PropertyDeclaration */] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) {
91417
91409
  var _a;
91418
- return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), ts.Debug.checkDefined(nodeVisitor(node.name, visitor, ts.isPropertyName)),
91410
+ return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName),
91419
91411
  // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration
91420
91412
  nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression));
91421
91413
  },
91422
91414
  _a[170 /* SyntaxKind.MethodSignature */] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) {
91423
- return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameter), nodeVisitor(node.type, visitor, ts.isTypeNode));
91415
+ return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
91424
91416
  },
91425
91417
  _a[171 /* SyntaxKind.MethodDeclaration */] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) {
91426
91418
  return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor));
@@ -91440,13 +91432,13 @@ var ts;
91440
91432
  return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor));
91441
91433
  },
91442
91434
  _a[176 /* SyntaxKind.CallSignature */] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
91443
- return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameter), nodeVisitor(node.type, visitor, ts.isTypeNode));
91435
+ return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
91444
91436
  },
91445
91437
  _a[177 /* SyntaxKind.ConstructSignature */] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
91446
- return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameter), nodeVisitor(node.type, visitor, ts.isTypeNode));
91438
+ return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
91447
91439
  },
91448
91440
  _a[178 /* SyntaxKind.IndexSignature */] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
91449
- return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameter), nodeVisitor(node.type, visitor, ts.isTypeNode));
91441
+ return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
91450
91442
  },
91451
91443
  // Types
91452
91444
  _a[179 /* SyntaxKind.TypePredicate */] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
@@ -91456,10 +91448,10 @@ var ts;
91456
91448
  return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
91457
91449
  },
91458
91450
  _a[181 /* SyntaxKind.FunctionType */] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
91459
- return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameter), nodeVisitor(node.type, visitor, ts.isTypeNode));
91451
+ return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
91460
91452
  },
91461
91453
  _a[182 /* SyntaxKind.ConstructorType */] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
91462
- return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameter), nodeVisitor(node.type, visitor, ts.isTypeNode));
91454
+ return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
91463
91455
  },
91464
91456
  _a[183 /* SyntaxKind.TypeQuery */] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
91465
91457
  return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
@@ -91513,7 +91505,7 @@ var ts;
91513
91505
  return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement));
91514
91506
  },
91515
91507
  _a[198 /* SyntaxKind.LiteralType */] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
91516
- return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isLiteralTypeLiteral));
91508
+ return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression));
91517
91509
  },
91518
91510
  _a[200 /* SyntaxKind.TemplateLiteralType */] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
91519
91511
  return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan));
@@ -93003,7 +92995,6 @@ var ts;
93003
92995
  };
93004
92996
  if (value) {
93005
92997
  value = ts.visitNode(value, visitor, ts.isExpression);
93006
- ts.Debug.assert(value);
93007
92998
  if (ts.isIdentifier(value) && bindingOrAssignmentElementAssignsToName(node, value.escapedText) ||
93008
92999
  bindingOrAssignmentElementContainsNonLiteralComputedName(node)) {
93009
93000
  // If the right-hand value of the assignment is also an assignment target then
@@ -93230,7 +93221,7 @@ var ts;
93230
93221
  && !(element.transformFlags & (32768 /* TransformFlags.ContainsRestOrSpread */ | 65536 /* TransformFlags.ContainsObjectRestOrSpread */))
93231
93222
  && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (32768 /* TransformFlags.ContainsRestOrSpread */ | 65536 /* TransformFlags.ContainsObjectRestOrSpread */))
93232
93223
  && !ts.isComputedPropertyName(propertyName)) {
93233
- bindingElements = ts.append(bindingElements, ts.visitNode(element, flattenContext.visitor, ts.isBindingOrAssignmentElement));
93224
+ bindingElements = ts.append(bindingElements, ts.visitNode(element, flattenContext.visitor));
93234
93225
  }
93235
93226
  else {
93236
93227
  if (bindingElements) {
@@ -93411,7 +93402,6 @@ var ts;
93411
93402
  return factory.createArrayBindingPattern(elements);
93412
93403
  }
93413
93404
  function makeArrayAssignmentPattern(factory, elements) {
93414
- ts.Debug.assertEachNode(elements, ts.isArrayBindingOrAssignmentElement);
93415
93405
  return factory.createArrayLiteralExpression(ts.map(elements, factory.converters.convertToArrayAssignmentElement));
93416
93406
  }
93417
93407
  function makeObjectBindingPattern(factory, elements) {
@@ -93419,7 +93409,6 @@ var ts;
93419
93409
  return factory.createObjectBindingPattern(elements);
93420
93410
  }
93421
93411
  function makeObjectAssignmentPattern(factory, elements) {
93422
- ts.Debug.assertEachNode(elements, ts.isObjectBindingOrAssignmentElement);
93423
93412
  return factory.createObjectLiteralExpression(ts.map(elements, factory.converters.convertToObjectAssignmentElement));
93424
93413
  }
93425
93414
  function makeBindingElement(factory, name) {
@@ -93440,7 +93429,6 @@ var ts;
93440
93429
  function processTaggedTemplateExpression(context, node, visitor, currentSourceFile, recordTaggedTemplateString, level) {
93441
93430
  // Visit the tag expression
93442
93431
  var tag = ts.visitNode(node.tag, visitor, ts.isExpression);
93443
- ts.Debug.assert(tag);
93444
93432
  // Build up the template arguments and the raw and cooked strings for the template.
93445
93433
  // We start out with 'undefined' for the first argument and revisit later
93446
93434
  // to avoid walking over the template string twice and shifting all our arguments over after the fact.
@@ -94006,7 +93994,7 @@ var ts;
94006
93994
  return factory.updateSourceFile(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, /*start*/ 0, alwaysStrict));
94007
93995
  }
94008
93996
  function visitObjectLiteralExpression(node) {
94009
- return factory.updateObjectLiteralExpression(node, ts.visitNodes(node.properties, getObjectLiteralElementVisitor(node), ts.isObjectLiteralElementLike));
93997
+ return factory.updateObjectLiteralExpression(node, ts.visitNodes(node.properties, getObjectLiteralElementVisitor(node), ts.isObjectLiteralElement));
94010
93998
  }
94011
93999
  function getClassFacts(node, staticProperties) {
94012
94000
  var facts = 0 /* ClassFacts.None */;
@@ -94192,7 +94180,6 @@ var ts;
94192
94180
  for (var _i = 0, parameterDecorators_1 = parameterDecorators; _i < parameterDecorators_1.length; _i++) {
94193
94181
  var parameterDecorator = parameterDecorators_1[_i];
94194
94182
  var expression = ts.visitNode(parameterDecorator.expression, visitor, ts.isExpression);
94195
- ts.Debug.assert(expression);
94196
94183
  var helper = emitHelpers().createParamHelper(expression, parameterOffset);
94197
94184
  ts.setTextRange(helper, parameterDecorator.expression);
94198
94185
  ts.setEmitFlags(helper, 1536 /* EmitFlags.NoComments */);
@@ -94335,7 +94322,6 @@ var ts;
94335
94322
  // - the property has a decorator.
94336
94323
  if (ts.isComputedPropertyName(name) && ((!ts.hasStaticModifier(member) && currentClassHasParameterProperties) || ts.hasDecorators(member))) {
94337
94324
  var expression = ts.visitNode(name.expression, visitor, ts.isExpression);
94338
- ts.Debug.assert(expression);
94339
94325
  var innerExpression = ts.skipPartiallyEmittedExpressions(expression);
94340
94326
  if (!ts.isSimpleInlineableExpression(innerExpression)) {
94341
94327
  var generatedName = factory.getGeneratedNameForNode(name);
@@ -94370,7 +94356,7 @@ var ts;
94370
94356
  * @param node The ExpressionWithTypeArguments to transform.
94371
94357
  */
94372
94358
  function visitExpressionWithTypeArguments(node) {
94373
- return factory.updateExpressionWithTypeArguments(node, ts.Debug.checkDefined(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)),
94359
+ return factory.updateExpressionWithTypeArguments(node, ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression),
94374
94360
  /*typeArguments*/ undefined);
94375
94361
  }
94376
94362
  /**
@@ -94391,7 +94377,7 @@ var ts;
94391
94377
  var decorators = transformAllDecoratorsOfDeclaration(node, parent, allDecorators);
94392
94378
  // Preserve a `declare x` property with decorators to be handled by the decorators transform
94393
94379
  if (isAmbient) {
94394
- return factory.updatePropertyDeclaration(node, ts.concatenate(decorators, factory.createModifiersFromModifierFlags(2 /* ModifierFlags.Ambient */)), ts.Debug.checkDefined(ts.visitNode(node.name, visitor, ts.isPropertyName)),
94380
+ return factory.updatePropertyDeclaration(node, ts.concatenate(decorators, factory.createModifiersFromModifierFlags(2 /* ModifierFlags.Ambient */)), ts.visitNode(node.name, visitor, ts.isPropertyName),
94395
94381
  /*questionOrExclamationToken*/ undefined,
94396
94382
  /*type*/ undefined,
94397
94383
  /*initializer*/ undefined);
@@ -94552,7 +94538,7 @@ var ts;
94552
94538
  return undefined;
94553
94539
  }
94554
94540
  var updated = factory.updateParameterDeclaration(node, ts.elideNodes(factory, node.modifiers), // preserve positions, if available
94555
- node.dotDotDotToken, ts.Debug.checkDefined(ts.visitNode(node.name, visitor, ts.isBindingName)),
94541
+ node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName),
94556
94542
  /*questionToken*/ undefined,
94557
94543
  /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
94558
94544
  if (updated !== node) {
@@ -94604,7 +94590,6 @@ var ts;
94604
94590
  // Make sure we consider all nested cast expressions, e.g.:
94605
94591
  // (<any><number><any>-A).x;
94606
94592
  var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
94607
- ts.Debug.assert(expression);
94608
94593
  // We have an expression of the form: (<Type>SubExpr). Emitting this as (SubExpr)
94609
94594
  // is really not desirable. We would like to emit the subexpression as-is. Omitting
94610
94595
  // the parentheses, however, could cause change in the semantics of the generated
@@ -94628,17 +94613,14 @@ var ts;
94628
94613
  }
94629
94614
  function visitAssertionExpression(node) {
94630
94615
  var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
94631
- ts.Debug.assert(expression);
94632
94616
  return factory.createPartiallyEmittedExpression(expression, node);
94633
94617
  }
94634
94618
  function visitNonNullExpression(node) {
94635
94619
  var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression);
94636
- ts.Debug.assert(expression);
94637
94620
  return factory.createPartiallyEmittedExpression(expression, node);
94638
94621
  }
94639
94622
  function visitSatisfiesExpression(node) {
94640
94623
  var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
94641
- ts.Debug.assert(expression);
94642
94624
  return factory.createPartiallyEmittedExpression(expression, node);
94643
94625
  }
94644
94626
  function visitCallExpression(node) {
@@ -94651,7 +94633,7 @@ var ts;
94651
94633
  }
94652
94634
  function visitTaggedTemplateExpression(node) {
94653
94635
  return factory.updateTaggedTemplateExpression(node, ts.visitNode(node.tag, visitor, ts.isExpression),
94654
- /*typeArguments*/ undefined, ts.visitNode(node.template, visitor, ts.isTemplateLiteral));
94636
+ /*typeArguments*/ undefined, ts.visitNode(node.template, visitor, ts.isExpression));
94655
94637
  }
94656
94638
  function visitJsxSelfClosingElement(node) {
94657
94639
  return factory.updateJsxSelfClosingElement(node, ts.visitNode(node.tagName, visitor, ts.isJsxTagNameExpression),
@@ -95681,7 +95663,6 @@ var ts;
95681
95663
  var info = accessPrivateIdentifier(node.left);
95682
95664
  if (info) {
95683
95665
  var receiver = ts.visitNode(node.right, visitor, ts.isExpression);
95684
- ts.Debug.assert(receiver);
95685
95666
  return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node);
95686
95667
  }
95687
95668
  // Private name has not been declared. Subsequent transformers will handle this error
@@ -95698,7 +95679,6 @@ var ts;
95698
95679
  }
95699
95680
  function visitComputedPropertyName(node) {
95700
95681
  var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
95701
- ts.Debug.assert(expression);
95702
95682
  if (ts.some(pendingExpressions)) {
95703
95683
  if (ts.isParenthesizedExpression(expression)) {
95704
95684
  expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false)));
@@ -95778,7 +95758,6 @@ var ts;
95778
95758
  var temp = factory.createTempVariable(hoistVariableDeclaration);
95779
95759
  ts.setSourceMapRange(temp, name.expression);
95780
95760
  var expression = ts.visitNode(name.expression, visitor, ts.isExpression);
95781
- ts.Debug.assert(expression);
95782
95761
  var assignment = factory.createAssignment(temp, expression);
95783
95762
  ts.setSourceMapRange(assignment, name.expression);
95784
95763
  getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp]));
@@ -95929,7 +95908,6 @@ var ts;
95929
95908
  var info = void 0;
95930
95909
  if (info = accessPrivateIdentifier(operand.name)) {
95931
95910
  var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression);
95932
- ts.Debug.assert(receiver);
95933
95911
  var _a = createCopiableReceiverExpr(receiver), readExpression = _a.readExpression, initializeExpression = _a.initializeExpression;
95934
95912
  var expression = createPrivateIdentifierAccess(info, readExpression);
95935
95913
  var temp = ts.isPrefixUnaryExpression(node) || valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration);
@@ -96133,17 +96111,14 @@ var ts;
96133
96111
  var superPropertyGet = factory.createReflectGetCall(superClassReference, getterName, classConstructor);
96134
96112
  ts.setOriginalNode(superPropertyGet, node.left);
96135
96113
  ts.setTextRange(superPropertyGet, node.left);
96136
- ts.Debug.assert(expression);
96137
96114
  expression = factory.createBinaryExpression(superPropertyGet, ts.getNonAssignmentOperatorForCompoundAssignment(node.operatorToken.kind), expression);
96138
96115
  ts.setTextRange(expression, node);
96139
96116
  }
96140
96117
  var temp = valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration);
96141
96118
  if (temp) {
96142
- ts.Debug.assert(expression);
96143
96119
  expression = factory.createAssignment(temp, expression);
96144
96120
  ts.setTextRange(temp, node);
96145
96121
  }
96146
- ts.Debug.assert(expression);
96147
96122
  expression = factory.createReflectSetCall(superClassReference, setterName, expression, classConstructor);
96148
96123
  ts.setOriginalNode(expression, node);
96149
96124
  ts.setTextRange(expression, node);
@@ -96903,7 +96878,6 @@ var ts;
96903
96878
  function getPropertyNameExpressionIfNeeded(name, shouldHoist) {
96904
96879
  if (ts.isComputedPropertyName(name)) {
96905
96880
  var expression = ts.visitNode(name.expression, visitor, ts.isExpression);
96906
- ts.Debug.assert(expression);
96907
96881
  var innerExpression = ts.skipPartiallyEmittedExpressions(expression);
96908
96882
  var inlinable = ts.isSimpleInlineableExpression(innerExpression);
96909
96883
  var alreadyTransformed = ts.isAssignmentExpression(innerExpression) && ts.isGeneratedIdentifier(innerExpression.left);
@@ -97227,8 +97201,7 @@ var ts;
97227
97201
  //
97228
97202
  // Transformation:
97229
97203
  // [ { set value(x) { this.#myProp = x; } }.value ] = [ "hello" ];
97230
- return factory.updateArrayLiteralExpression(node, ts.visitNodes(node.elements, visitArrayAssignmentTarget, ts.isExpression) // TODO(jakebailey): the elements property's type looks to be wrong.
97231
- );
97204
+ return factory.updateArrayLiteralExpression(node, ts.visitNodes(node.elements, visitArrayAssignmentTarget, ts.isExpression));
97232
97205
  }
97233
97206
  else {
97234
97207
  // Transforms private names in destructuring assignment object bindings.
@@ -97948,7 +97921,7 @@ var ts;
97948
97921
  /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), ts.visitNodes(node.members, visitor, ts.isClassElement));
97949
97922
  }
97950
97923
  function visitConstructorDeclaration(node) {
97951
- return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.visitNodes(node.parameters, visitor, ts.isParameter), ts.visitNode(node.body, visitor, ts.isBlock));
97924
+ return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.visitNodes(node.parameters, visitor, ts.isParameterDeclaration), ts.visitNode(node.body, visitor, ts.isBlock));
97952
97925
  }
97953
97926
  function finishClassElement(updated, original) {
97954
97927
  if (updated !== original) {
@@ -97962,26 +97935,26 @@ var ts;
97962
97935
  function visitMethodDeclaration(node) {
97963
97936
  return finishClassElement(factory.updateMethodDeclaration(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.visitNode(node.name, visitor, ts.isPropertyName),
97964
97937
  /*questionToken*/ undefined,
97965
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
97938
+ /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameterDeclaration),
97966
97939
  /*type*/ undefined, ts.visitNode(node.body, visitor, ts.isBlock)), node);
97967
97940
  }
97968
97941
  function visitGetAccessorDeclaration(node) {
97969
- return finishClassElement(factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitNodes(node.parameters, visitor, ts.isParameter),
97942
+ return finishClassElement(factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitNodes(node.parameters, visitor, ts.isParameterDeclaration),
97970
97943
  /*type*/ undefined, ts.visitNode(node.body, visitor, ts.isBlock)), node);
97971
97944
  }
97972
97945
  function visitSetAccessorDeclaration(node) {
97973
- return finishClassElement(factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitNodes(node.parameters, visitor, ts.isParameter), ts.visitNode(node.body, visitor, ts.isBlock)), node);
97946
+ return finishClassElement(factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitNodes(node.parameters, visitor, ts.isParameterDeclaration), ts.visitNode(node.body, visitor, ts.isBlock)), node);
97974
97947
  }
97975
97948
  function visitPropertyDeclaration(node) {
97976
97949
  if (node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) {
97977
97950
  return undefined;
97978
97951
  }
97979
- return finishClassElement(factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.Debug.checkDefined(ts.visitNode(node.name, visitor, ts.isPropertyName)),
97952
+ return finishClassElement(factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.visitNode(node.name, visitor, ts.isPropertyName),
97980
97953
  /*questionOrExclamationToken*/ undefined,
97981
97954
  /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)), node);
97982
97955
  }
97983
97956
  function visitParameterDeclaration(node) {
97984
- var updated = factory.updateParameterDeclaration(node, ts.elideNodes(factory, node.modifiers), node.dotDotDotToken, ts.Debug.checkDefined(ts.visitNode(node.name, visitor, ts.isBindingName)),
97957
+ var updated = factory.updateParameterDeclaration(node, ts.elideNodes(factory, node.modifiers), node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName),
97985
97958
  /*questionToken*/ undefined,
97986
97959
  /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
97987
97960
  if (updated !== node) {
@@ -98155,7 +98128,7 @@ var ts;
98155
98128
  * @param decorator The decorator node.
98156
98129
  */
98157
98130
  function transformDecorator(decorator) {
98158
- return ts.Debug.checkDefined(ts.visitNode(decorator.expression, visitor, ts.isExpression));
98131
+ return ts.visitNode(decorator.expression, visitor, ts.isExpression);
98159
98132
  }
98160
98133
  /**
98161
98134
  * Transforms the decorators of a parameter.
@@ -98466,7 +98439,7 @@ var ts;
98466
98439
  : ts.visitNode(node.initializer, visitor, ts.isForInitializer), ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitIterationBody(node.statement, asyncBodyVisitor, context));
98467
98440
  }
98468
98441
  function visitForOfStatementInAsyncBody(node) {
98469
- return factory.updateForOfStatement(node, ts.visitNode(node.awaitModifier, visitor, ts.isAwaitKeyword), isVariableDeclarationListWithCollidingName(node.initializer)
98442
+ return factory.updateForOfStatement(node, ts.visitNode(node.awaitModifier, visitor, ts.isToken), isVariableDeclarationListWithCollidingName(node.initializer)
98470
98443
  ? visitVariableDeclarationListWithCollidingNames(node.initializer, /*hasReceiver*/ true)
98471
98444
  : ts.visitNode(node.initializer, visitor, ts.isForInitializer), ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitIterationBody(node.statement, asyncBodyVisitor, context));
98472
98445
  }
@@ -98531,7 +98504,7 @@ var ts;
98531
98504
  * @param node The node to visit.
98532
98505
  */
98533
98506
  function visitFunctionExpression(node) {
98534
- return factory.updateFunctionExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name,
98507
+ return factory.updateFunctionExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.asteriskToken, node.name,
98535
98508
  /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
98536
98509
  /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */
98537
98510
  ? transformAsyncFunctionBody(node)
@@ -98546,7 +98519,7 @@ var ts;
98546
98519
  * @param node The node to visit.
98547
98520
  */
98548
98521
  function visitArrowFunction(node) {
98549
- return factory.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier),
98522
+ return factory.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike),
98550
98523
  /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
98551
98524
  /*type*/ undefined, node.equalsGreaterThanToken, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */
98552
98525
  ? transformAsyncFunctionBody(node)
@@ -98602,7 +98575,7 @@ var ts;
98602
98575
  }
98603
98576
  function transformInitializedVariable(node) {
98604
98577
  var converted = ts.setSourceMapRange(factory.createAssignment(factory.converters.convertToAssignmentElementTarget(node.name), node.initializer), node);
98605
- return ts.Debug.checkDefined(ts.visitNode(converted, visitor, ts.isExpression));
98578
+ return ts.visitNode(converted, visitor, ts.isExpression);
98606
98579
  }
98607
98580
  function collidesWithParameterName(_a) {
98608
98581
  var name = _a.name;
@@ -99466,7 +99439,7 @@ var ts;
99466
99439
  ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifierLike)
99467
99440
  : node.modifiers, enclosingFunctionFlags & 2 /* FunctionFlags.Async */
99468
99441
  ? undefined
99469
- : node.asteriskToken, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitNode(/*questionToken*/ undefined, visitor, ts.isQuestionToken),
99442
+ : node.asteriskToken, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitNode(/*questionToken*/ undefined, visitor, ts.isToken),
99470
99443
  /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, parameterVisitor, context),
99471
99444
  /*type*/ undefined, enclosingFunctionFlags & 2 /* FunctionFlags.Async */ && enclosingFunctionFlags & 1 /* FunctionFlags.Generator */
99472
99445
  ? transformAsyncGeneratorFunctionBody(node)
@@ -100355,7 +100328,7 @@ var ts;
100355
100328
  return ts.singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
100356
100329
  }
100357
100330
  function transformJsxSpreadAttributeToExpression(node) {
100358
- return ts.Debug.checkDefined(ts.visitNode(node.expression, visitor, ts.isExpression));
100331
+ return ts.visitNode(node.expression, visitor, ts.isExpression);
100359
100332
  }
100360
100333
  function transformJsxAttributeToObjectLiteralElement(node) {
100361
100334
  var name = getAttributeName(node);
@@ -102023,7 +101996,6 @@ var ts;
102023
101996
  var sourceMapRange = ts.getSourceMapRange(member);
102024
101997
  var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined, container);
102025
101998
  var propertyName = ts.visitNode(member.name, visitor, ts.isPropertyName);
102026
- ts.Debug.assert(propertyName);
102027
101999
  var e;
102028
102000
  if (!ts.isPrivateIdentifier(propertyName) && ts.getUseDefineForClassFields(context.getCompilerOptions())) {
102029
102001
  var name = ts.isComputedPropertyName(propertyName) ? propertyName.expression
@@ -102076,7 +102048,6 @@ var ts;
102076
102048
  ts.setEmitFlags(target, 1536 /* EmitFlags.NoComments */ | 32 /* EmitFlags.NoTrailingSourceMap */);
102077
102049
  ts.setSourceMapRange(target, firstAccessor.name);
102078
102050
  var visitedAccessorName = ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName);
102079
- ts.Debug.assert(visitedAccessorName);
102080
102051
  if (ts.isPrivateIdentifier(visitedAccessorName)) {
102081
102052
  return ts.Debug.failBadSyntaxKind(visitedAccessorName, "Encountered unhandled private identifier while transforming ES2015.");
102082
102053
  }
@@ -102351,7 +102322,6 @@ var ts;
102351
102322
  var visited = ts.visitNode(element, i < node.elements.length - 1 ? visitorWithUnusedExpressionResult : visitor, ts.isExpression);
102352
102323
  if (result || visited !== element) {
102353
102324
  result || (result = node.elements.slice(0, i));
102354
- ts.Debug.assert(visited);
102355
102325
  result.push(visited);
102356
102326
  }
102357
102327
  }
@@ -102411,7 +102381,6 @@ var ts;
102411
102381
  var declarations = ts.flatMap(node.declarations, node.flags & 1 /* NodeFlags.Let */
102412
102382
  ? visitVariableDeclarationInLetDeclarationList
102413
102383
  : visitVariableDeclaration);
102414
- ts.Debug.assertEachNode(declarations, ts.isVariableDeclaration); // TODO(jakebailey): side effect of VisitResult.
102415
102384
  var declarationList = factory.createVariableDeclarationList(declarations);
102416
102385
  ts.setOriginalNode(declarationList, node);
102417
102386
  ts.setTextRange(declarationList, node);
@@ -102631,7 +102600,6 @@ var ts;
102631
102600
  }
102632
102601
  else {
102633
102602
  var statement = ts.visitNode(node.statement, visitor, ts.isStatement, factory.liftToBlock);
102634
- ts.Debug.assert(statement);
102635
102603
  if (ts.isBlock(statement)) {
102636
102604
  return factory.updateBlock(statement, ts.setTextRange(factory.createNodeArray(ts.concatenate(statements, statement.statements)), statement.statements));
102637
102605
  }
@@ -102667,7 +102635,6 @@ var ts;
102667
102635
  // Note also that because an extra statement is needed to assign to the LHS,
102668
102636
  // for-of bodies are always emitted as blocks.
102669
102637
  var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
102670
- ts.Debug.assert(expression);
102671
102638
  // In the case where the user wrote an identifier as the RHS, like this:
102672
102639
  //
102673
102640
  // for (let v of arr) { }
@@ -102693,7 +102660,6 @@ var ts;
102693
102660
  }
102694
102661
  function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) {
102695
102662
  var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
102696
- ts.Debug.assert(expression);
102697
102663
  var iterator = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(/*recordTempVariable*/ undefined);
102698
102664
  var result = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable(/*recordTempVariable*/ undefined);
102699
102665
  var errorRecord = factory.createUniqueName("e");
@@ -103122,7 +103088,6 @@ var ts;
103122
103088
  statements.push(factory.createIfStatement(factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, ts.visitNode(node.condition, visitor, ts.isExpression)), ts.visitNode(factory.createBreakStatement(), visitor, ts.isStatement)));
103123
103089
  }
103124
103090
  }
103125
- ts.Debug.assert(statement);
103126
103091
  if (ts.isBlock(statement)) {
103127
103092
  ts.addRange(statements, statement.statements);
103128
103093
  }
@@ -103763,9 +103728,7 @@ var ts;
103763
103728
  return ts.map(chunk, visitExpressionOfSpread);
103764
103729
  }
103765
103730
  function visitExpressionOfSpread(node) {
103766
- ts.Debug.assertNode(node, ts.isSpreadElement);
103767
103731
  var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
103768
- ts.Debug.assert(expression);
103769
103732
  // We don't need to pack already packed array literals, or existing calls to the `__read` helper.
103770
103733
  var isCallToReadHelper = ts.isCallToHelper(expression, "___read");
103771
103734
  var kind = isCallToReadHelper || ts.isPackedArrayLiteral(expression) ? 2 /* SpreadSegmentKind.PackedSpread */ : 1 /* SpreadSegmentKind.UnpackedSpread */;
@@ -103833,7 +103796,7 @@ var ts;
103833
103796
  var expression = factory.createStringLiteral(node.head.text);
103834
103797
  for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {
103835
103798
  var span = _a[_i];
103836
- var args = [ts.Debug.checkDefined(ts.visitNode(span.expression, visitor, ts.isExpression))];
103799
+ var args = [ts.visitNode(span.expression, visitor, ts.isExpression)];
103837
103800
  if (span.literal.text.length > 0) {
103838
103801
  args.push(factory.createStringLiteral(span.literal.text));
103839
103802
  }
@@ -104734,7 +104697,7 @@ var ts;
104734
104697
  // .yield resumeLabel
104735
104698
  // .mark resumeLabel
104736
104699
  // _a.b = %sent%;
104737
- target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.Debug.checkDefined(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression))), left.name);
104700
+ target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);
104738
104701
  break;
104739
104702
  case 209 /* SyntaxKind.ElementAccessExpression */:
104740
104703
  // [source]
@@ -104747,7 +104710,7 @@ var ts;
104747
104710
  // .yield resumeLabel
104748
104711
  // .mark resumeLabel
104749
104712
  // _a[_b] = %sent%;
104750
- target = factory.updateElementAccessExpression(left, cacheExpression(ts.Debug.checkDefined(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression))), cacheExpression(ts.Debug.checkDefined(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))));
104713
+ target = factory.updateElementAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression)));
104751
104714
  break;
104752
104715
  default:
104753
104716
  target = ts.visitNode(left, visitor, ts.isExpression);
@@ -105065,7 +105028,7 @@ var ts;
105065
105028
  // .yield resumeLabel
105066
105029
  // .mark resumeLabel
105067
105030
  // a = _a[%sent%]
105068
- return factory.updateElementAccessExpression(node, cacheExpression(ts.Debug.checkDefined(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression))), ts.visitNode(node.argumentExpression, visitor, ts.isExpression));
105031
+ return factory.updateElementAccessExpression(node, cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)), ts.visitNode(node.argumentExpression, visitor, ts.isExpression));
105069
105032
  }
105070
105033
  return ts.visitEachChild(node, visitor, context);
105071
105034
  }
@@ -105082,7 +105045,7 @@ var ts;
105082
105045
  // .mark resumeLabel
105083
105046
  // _b.apply(_a, _c.concat([%sent%, 2]));
105084
105047
  var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion, /*cacheIdentifiers*/ true), target = _a.target, thisArg = _a.thisArg;
105085
- return ts.setOriginalNode(ts.setTextRange(factory.createFunctionApplyCall(cacheExpression(ts.Debug.checkDefined(ts.visitNode(target, visitor, ts.isLeftHandSideExpression))), thisArg, visitElements(node.arguments)), node), node);
105048
+ return ts.setOriginalNode(ts.setTextRange(factory.createFunctionApplyCall(cacheExpression(ts.visitNode(target, visitor, ts.isLeftHandSideExpression)), thisArg, visitElements(node.arguments)), node), node);
105086
105049
  }
105087
105050
  return ts.visitEachChild(node, visitor, context);
105088
105051
  }
@@ -107067,7 +107030,7 @@ var ts;
107067
107030
  */
107068
107031
  function addExportEqualsIfNeeded(statements, emitAsReturn) {
107069
107032
  if (currentModuleInfo.exportEquals) {
107070
- var expressionResult = ts.visitNode(currentModuleInfo.exportEquals.expression, visitor, ts.isExpression);
107033
+ var expressionResult = ts.visitNode(currentModuleInfo.exportEquals.expression, visitor);
107071
107034
  if (expressionResult) {
107072
107035
  if (emitAsReturn) {
107073
107036
  var statement = factory.createReturnStatement(expressionResult);
@@ -107267,7 +107230,7 @@ var ts;
107267
107230
  }
107268
107231
  function visitImportCallExpression(node) {
107269
107232
  var externalModuleName = ts.getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions);
107270
- var firstArgument = ts.visitNode(ts.firstOrUndefined(node.arguments), visitor, ts.isExpression);
107233
+ var firstArgument = ts.visitNode(ts.firstOrUndefined(node.arguments), visitor);
107271
107234
  // Only use the external module name if it differs from the first argument. This allows us to preserve the quote style of the argument on output.
107272
107235
  var argument = externalModuleName && (!firstArgument || !ts.isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
107273
107236
  var containsLexicalThis = !!(node.transformFlags & 16384 /* TransformFlags.ContainsLexicalThis */);
@@ -107615,7 +107578,7 @@ var ts;
107615
107578
  var statements;
107616
107579
  if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) {
107617
107580
  statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createFunctionDeclaration(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, factory.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true),
107618
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
107581
+ /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor),
107619
107582
  /*type*/ undefined, ts.visitEachChild(node.body, visitor, context)),
107620
107583
  /*location*/ node),
107621
107584
  /*original*/ node));
@@ -107642,7 +107605,7 @@ var ts;
107642
107605
  var statements;
107643
107606
  if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) {
107644
107607
  statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createClassDeclaration(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifierLike), factory.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true),
107645
- /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), ts.visitNodes(node.members, visitor, ts.isClassElement)), node), node));
107608
+ /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor), ts.visitNodes(node.members, visitor)), node), node));
107646
107609
  }
107647
107610
  else {
107648
107611
  statements = ts.append(statements, ts.visitEachChild(node, visitor, context));
@@ -107682,7 +107645,7 @@ var ts;
107682
107645
  if (!ts.isBindingPattern(variable.name) && (ts.isArrowFunction(variable.initializer) || ts.isFunctionExpression(variable.initializer) || ts.isClassExpression(variable.initializer))) {
107683
107646
  var expression = factory.createAssignment(ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), variable.name),
107684
107647
  /*location*/ variable.name), factory.createIdentifier(ts.getTextOfIdentifierOrLiteral(variable.name)));
107685
- var updatedVariable = factory.createVariableDeclaration(variable.name, variable.exclamationToken, variable.type, ts.visitNode(variable.initializer, visitor, ts.isExpression));
107648
+ var updatedVariable = factory.createVariableDeclaration(variable.name, variable.exclamationToken, variable.type, ts.visitNode(variable.initializer, visitor));
107686
107649
  variables = ts.append(variables, updatedVariable);
107687
107650
  expressions = ts.append(expressions, expression);
107688
107651
  removeCommentsOnExpressions = true;
@@ -108710,7 +108673,7 @@ var ts;
108710
108673
  function visitFunctionDeclaration(node) {
108711
108674
  if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) {
108712
108675
  hoistedStatements = ts.append(hoistedStatements, factory.updateFunctionDeclaration(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifierLike), node.asteriskToken, factory.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true),
108713
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
108676
+ /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameterDeclaration),
108714
108677
  /*type*/ undefined, ts.visitNode(node.body, visitor, ts.isBlock)));
108715
108678
  }
108716
108679
  else {
@@ -109226,7 +109189,7 @@ var ts;
109226
109189
  return expressions ? factory.inlineExpressions(expressions) : factory.createOmittedExpression();
109227
109190
  }
109228
109191
  else {
109229
- return ts.visitNode(node, discardedValueVisitor, ts.isForInitializer);
109192
+ return ts.visitNode(node, discardedValueVisitor, ts.isExpression);
109230
109193
  }
109231
109194
  }
109232
109195
  /**
@@ -109398,7 +109361,7 @@ var ts;
109398
109361
  // };
109399
109362
  // });
109400
109363
  var externalModuleName = ts.getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions);
109401
- var firstArgument = ts.visitNode(ts.firstOrUndefined(node.arguments), visitor, ts.isExpression);
109364
+ var firstArgument = ts.visitNode(ts.firstOrUndefined(node.arguments), visitor);
109402
109365
  // Only use the external module name if it differs from the first argument. This allows us to preserve the quote style of the argument on output.
109403
109366
  var argument = externalModuleName && (!firstArgument || !ts.isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
109404
109367
  return factory.createCallExpression(factory.createPropertyAccessExpression(contextObject, factory.createIdentifier("import")),
@@ -110618,7 +110581,7 @@ var ts;
110618
110581
  var _a;
110619
110582
  var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; });
110620
110583
  var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; });
110621
- if (augmentingDeclarations) {
110584
+ if (primaryDeclaration && augmentingDeclarations) {
110622
110585
  for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) {
110623
110586
  var augmentations = augmentingDeclarations_1[_i];
110624
110587
  context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file)));
@@ -110673,12 +110636,12 @@ var ts;
110673
110636
  if (ts.isExternalOrCommonJsModule(sourceFile) || ts.isJsonSourceFile(sourceFile)) {
110674
110637
  resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules)
110675
110638
  needsDeclare = false;
110676
- var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements, ts.isStatement);
110639
+ var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
110677
110640
  var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
110678
110641
  return newFile;
110679
110642
  }
110680
110643
  needsDeclare = true;
110681
- var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements, ts.isStatement);
110644
+ var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
110682
110645
  return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
110683
110646
  }), ts.mapDefined(node.prepends, function (prepend) {
110684
110647
  if (prepend.kind === 311 /* SyntaxKind.InputFiles */) {
@@ -110725,7 +110688,7 @@ var ts;
110725
110688
  emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
110726
110689
  }
110727
110690
  else {
110728
- var statements = ts.visitNodes(node.statements, visitDeclarationStatements, ts.isStatement);
110691
+ var statements = ts.visitNodes(node.statements, visitDeclarationStatements);
110729
110692
  combinedStatements = ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
110730
110693
  refs.forEach(referenceVisitor);
110731
110694
  emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
@@ -110823,10 +110786,10 @@ var ts;
110823
110786
  }
110824
110787
  else {
110825
110788
  if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) {
110826
- return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement, ts.isArrayBindingElement));
110789
+ return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement));
110827
110790
  }
110828
110791
  else {
110829
- return factory.updateObjectBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement, ts.isBindingElement));
110792
+ return factory.updateObjectBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement));
110830
110793
  }
110831
110794
  }
110832
110795
  function visitBindingElement(elem) {
@@ -110876,10 +110839,10 @@ var ts;
110876
110839
  (resolver.isRequiredInitializedParameter(node) ||
110877
110840
  resolver.isOptionalUninitializedParameterProperty(node));
110878
110841
  if (type && !shouldUseResolverType) {
110879
- return ts.visitNode(type, visitDeclarationSubtree, ts.isTypeNode);
110842
+ return ts.visitNode(type, visitDeclarationSubtree);
110880
110843
  }
110881
110844
  if (!ts.getParseTreeNode(node)) {
110882
- return type ? ts.visitNode(type, visitDeclarationSubtree, ts.isTypeNode) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */);
110845
+ return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */);
110883
110846
  }
110884
110847
  if (node.kind === 175 /* SyntaxKind.SetAccessor */) {
110885
110848
  // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now
@@ -110992,7 +110955,7 @@ var ts;
110992
110955
  return factory.createNodeArray(newParams || ts.emptyArray);
110993
110956
  }
110994
110957
  function ensureTypeParams(node, params) {
110995
- return ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */) ? undefined : ts.visitNodes(params, visitDeclarationSubtree, ts.isTypeParameterDeclaration);
110958
+ return ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */) ? undefined : ts.visitNodes(params, visitDeclarationSubtree);
110996
110959
  }
110997
110960
  function isEnclosingDeclaration(node) {
110998
110961
  return ts.isSourceFile(node)
@@ -111124,7 +111087,6 @@ var ts;
111124
111087
  var key = ts.getOriginalNodeId(statement);
111125
111088
  if (lateStatementReplacementMap.has(key)) {
111126
111089
  var result = lateStatementReplacementMap.get(key);
111127
- ts.Debug.type(result);
111128
111090
  lateStatementReplacementMap.delete(key);
111129
111091
  if (result) {
111130
111092
  if (ts.isArray(result) ? ts.some(result, ts.needsScopeMarker) : ts.needsScopeMarker(result)) {
@@ -111272,17 +111234,13 @@ var ts;
111272
111234
  case 191 /* SyntaxKind.ConditionalType */: {
111273
111235
  // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration
111274
111236
  // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type.
111275
- var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree, ts.isTypeNode);
111276
- var extendsType = ts.visitNode(input.extendsType, visitDeclarationSubtree, ts.isTypeNode);
111237
+ var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree);
111238
+ var extendsType = ts.visitNode(input.extendsType, visitDeclarationSubtree);
111277
111239
  var oldEnclosingDecl = enclosingDeclaration;
111278
111240
  enclosingDeclaration = input.trueType;
111279
- var trueType = ts.visitNode(input.trueType, visitDeclarationSubtree, ts.isTypeNode);
111241
+ var trueType = ts.visitNode(input.trueType, visitDeclarationSubtree);
111280
111242
  enclosingDeclaration = oldEnclosingDecl;
111281
- var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree, ts.isTypeNode);
111282
- ts.Debug.assert(checkType);
111283
- ts.Debug.assert(extendsType);
111284
- ts.Debug.assert(trueType);
111285
- ts.Debug.assert(falseType);
111243
+ var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree);
111286
111244
  return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
111287
111245
  }
111288
111246
  case 181 /* SyntaxKind.FunctionType */: {
@@ -111420,7 +111378,7 @@ var ts;
111420
111378
  return clean;
111421
111379
  }
111422
111380
  case 261 /* SyntaxKind.InterfaceDeclaration */: {
111423
- return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree, ts.isTypeElement)));
111381
+ return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
111424
111382
  }
111425
111383
  case 259 /* SyntaxKind.FunctionDeclaration */: {
111426
111384
  // Generators lose their generator-ness, excepting their return type
@@ -111492,7 +111450,7 @@ var ts;
111492
111450
  var oldHasScopeFix = resultHasScopeMarker;
111493
111451
  resultHasScopeMarker = false;
111494
111452
  needsScopeFixMarker = false;
111495
- var statements = ts.visitNodes(inner.statements, visitDeclarationStatements, ts.isStatement);
111453
+ var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
111496
111454
  var lateStatements = transformAndReplaceLatePaintedStatements(statements);
111497
111455
  if (input.flags & 16777216 /* NodeFlags.Ambient */) {
111498
111456
  needsScopeFixMarker = false; // If it was `declare`'d everything is implicitly exported already, ignore late printed "privates"
@@ -111577,7 +111535,7 @@ var ts;
111577
111535
  /*type*/ undefined,
111578
111536
  /*initializer*/ undefined)
111579
111537
  ] : undefined;
111580
- var memberNodes = ts.concatenate(ts.concatenate(privateIdentifier, parameterProperties), ts.visitNodes(input.members, visitDeclarationSubtree, ts.isClassElement));
111538
+ var memberNodes = ts.concatenate(ts.concatenate(privateIdentifier, parameterProperties), ts.visitNodes(input.members, visitDeclarationSubtree));
111581
111539
  var members = factory.createNodeArray(memberNodes);
111582
111540
  var extendsClause_1 = ts.getEffectiveBaseTypeNode(input);
111583
111541
  if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 104 /* SyntaxKind.NullKeyword */) {
@@ -111595,11 +111553,11 @@ var ts;
111595
111553
  if (clause.token === 94 /* SyntaxKind.ExtendsKeyword */) {
111596
111554
  var oldDiag_2 = getSymbolAccessibilityDiagnostic;
111597
111555
  getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]);
111598
- var newClause = factory.updateHeritageClause(clause, ts.map(clause.types, function (t) { return factory.updateExpressionWithTypeArguments(t, newId_1, ts.visitNodes(t.typeArguments, visitDeclarationSubtree, ts.isTypeNode)); }));
111556
+ var newClause = factory.updateHeritageClause(clause, ts.map(clause.types, function (t) { return factory.updateExpressionWithTypeArguments(t, newId_1, ts.visitNodes(t.typeArguments, visitDeclarationSubtree)); }));
111599
111557
  getSymbolAccessibilityDiagnostic = oldDiag_2;
111600
111558
  return newClause;
111601
111559
  }
111602
- return factory.updateHeritageClause(clause, ts.visitNodes(factory.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 104 /* SyntaxKind.NullKeyword */; })), visitDeclarationSubtree, ts.isExpressionWithTypeArguments));
111560
+ return factory.updateHeritageClause(clause, ts.visitNodes(factory.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 104 /* SyntaxKind.NullKeyword */; })), visitDeclarationSubtree));
111603
111561
  }));
111604
111562
  return [statement, cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members))]; // TODO: GH#18217
111605
111563
  }
@@ -111644,7 +111602,7 @@ var ts;
111644
111602
  function transformVariableStatement(input) {
111645
111603
  if (!ts.forEach(input.declarationList.declarations, getBindingNameVisible))
111646
111604
  return;
111647
- var nodes = ts.visitNodes(input.declarationList.declarations, visitDeclarationSubtree, ts.isVariableDeclaration);
111605
+ var nodes = ts.visitNodes(input.declarationList.declarations, visitDeclarationSubtree);
111648
111606
  if (!ts.length(nodes))
111649
111607
  return;
111650
111608
  return factory.updateVariableStatement(input, factory.createNodeArray(ensureModifiers(input)), factory.updateVariableDeclarationList(input.declarationList, nodes));
@@ -111727,7 +111685,7 @@ var ts;
111727
111685
  function transformHeritageClauses(nodes) {
111728
111686
  return factory.createNodeArray(ts.filter(ts.map(nodes, function (clause) { return factory.updateHeritageClause(clause, ts.visitNodes(factory.createNodeArray(ts.filter(clause.types, function (t) {
111729
111687
  return ts.isEntityNameExpression(t.expression) || (clause.token === 94 /* SyntaxKind.ExtendsKeyword */ && t.expression.kind === 104 /* SyntaxKind.NullKeyword */);
111730
- })), visitDeclarationSubtree, ts.isExpressionWithTypeArguments)); }), function (clause) { return clause.types && !!clause.types.length; }));
111688
+ })), visitDeclarationSubtree)); }), function (clause) { return clause.types && !!clause.types.length; }));
111731
111689
  }
111732
111690
  }
111733
111691
  ts.transformDeclarations = transformDeclarations;
@@ -115446,6 +115404,7 @@ var ts;
115446
115404
  writeTrailingSemicolon();
115447
115405
  }
115448
115406
  function emitExportDeclaration(node) {
115407
+ emitModifiers(node, node.modifiers);
115449
115408
  var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node);
115450
115409
  writeSpace();
115451
115410
  if (node.isTypeOnly) {
@@ -118672,7 +118631,6 @@ var ts;
118672
118631
  return resolutions;
118673
118632
  }
118674
118633
  ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
118675
- ;
118676
118634
  /**
118677
118635
  * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
118678
118636
  * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
@@ -123930,17 +123888,13 @@ var ts;
123930
123888
  var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
123931
123889
  return !!value && !!value.length;
123932
123890
  }
123933
- function createHasInvalidatedResolution(forceAllFilesAsInvalidated) {
123891
+ function createHasInvalidatedResolution(userProvidedHasInvalidatedResolution) {
123934
123892
  // Ensure pending resolutions are applied
123935
123893
  invalidateResolutionsOfFailedLookupLocations();
123936
- if (forceAllFilesAsInvalidated) {
123937
- // Any file asked would have invalidated resolution
123938
- filesWithInvalidatedResolutions = undefined;
123939
- return ts.returnTrue;
123940
- }
123941
123894
  var collected = filesWithInvalidatedResolutions;
123942
123895
  filesWithInvalidatedResolutions = undefined;
123943
- return function (path) { return (!!collected && collected.has(path)) ||
123896
+ return function (path) { return (userProvidedHasInvalidatedResolution === null || userProvidedHasInvalidatedResolution === void 0 ? void 0 : userProvidedHasInvalidatedResolution(path)) ||
123897
+ !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) ||
123944
123898
  isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
123945
123899
  }
123946
123900
  function startCachingPerDirectoryResolution() {
@@ -125049,7 +125003,7 @@ var ts;
125049
125003
  });
125050
125004
  // Sort by paths closest to importing file Name directory
125051
125005
  var sortedPaths = [];
125052
- var _loop_35 = function (directory) {
125006
+ var _loop_36 = function (directory) {
125053
125007
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
125054
125008
  var pathsInDirectory;
125055
125009
  allFileNames.forEach(function (_a, fileName) {
@@ -125073,9 +125027,9 @@ var ts;
125073
125027
  };
125074
125028
  var out_directory_1;
125075
125029
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
125076
- var state_11 = _loop_35(directory);
125030
+ var state_12 = _loop_36(directory);
125077
125031
  directory = out_directory_1;
125078
- if (state_11 === "break")
125032
+ if (state_12 === "break")
125079
125033
  break;
125080
125034
  }
125081
125035
  if (allFileNames.size) {
@@ -125144,7 +125098,7 @@ var ts;
125144
125098
  }
125145
125099
  function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
125146
125100
  for (var key in paths) {
125147
- var _loop_36 = function (patternText_1) {
125101
+ var _loop_37 = function (patternText_1) {
125148
125102
  var pattern = ts.normalizePath(patternText_1);
125149
125103
  var indexOfStar = pattern.indexOf("*");
125150
125104
  // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@@ -125211,9 +125165,9 @@ var ts;
125211
125165
  };
125212
125166
  for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
125213
125167
  var patternText_1 = _a[_i];
125214
- var state_12 = _loop_36(patternText_1);
125215
- if (typeof state_12 === "object")
125216
- return state_12.value;
125168
+ var state_13 = _loop_37(patternText_1);
125169
+ if (typeof state_13 === "object")
125170
+ return state_13.value;
125217
125171
  }
125218
125172
  }
125219
125173
  function validateEnding(_a) {
@@ -125618,9 +125572,6 @@ var ts;
125618
125572
  return "".concat(errorDiagnostic.file.fileName);
125619
125573
  });
125620
125574
  return filesInError.map(function (fileName) {
125621
- if (fileName === undefined) {
125622
- return undefined;
125623
- }
125624
125575
  var diagnosticForFileName = ts.find(diagnostics, function (diagnostic) {
125625
125576
  return diagnostic.file !== undefined && diagnostic.file.fileName === fileName;
125626
125577
  });
@@ -126257,8 +126208,6 @@ var ts;
126257
126208
  parseConfigFile();
126258
126209
  newLine = updateNewLine();
126259
126210
  }
126260
- ts.Debug.assert(compilerOptions);
126261
- ts.Debug.assert(rootFileNames);
126262
126211
  var _b = ts.createWatchFactory(host, compilerOptions), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory, writeLog = _b.writeLog;
126263
126212
  var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
126264
126213
  writeLog("Current directory: ".concat(currentDirectory, " CaseSensitiveFileNames: ").concat(useCaseSensitiveFileNames));
@@ -126325,6 +126274,7 @@ var ts;
126325
126274
  ts.maybeBind(host, host.getModuleResolutionCache) :
126326
126275
  (function () { return resolutionCache.getModuleResolutionCache(); });
126327
126276
  var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
126277
+ var userProvidedHasInvalidatedResolution = ts.maybeBind(host, host.hasInvalidatedResolution) || ts.returnTrue;
126328
126278
  builderProgram = readBuilderProgram(compilerOptions, compilerHost);
126329
126279
  synchronizeProgram();
126330
126280
  // Update the wild card directory watch
@@ -126382,8 +126332,6 @@ var ts;
126382
126332
  }
126383
126333
  function synchronizeProgram() {
126384
126334
  writeLog("Synchronizing program");
126385
- ts.Debug.assert(compilerOptions);
126386
- ts.Debug.assert(rootFileNames);
126387
126335
  clearInvalidateResolutionsOfFailedLookupLocations();
126388
126336
  var program = getCurrentBuilderProgram();
126389
126337
  if (hasChangedCompilerOptions) {
@@ -126393,7 +126341,7 @@ var ts;
126393
126341
  }
126394
126342
  }
126395
126343
  // All resolutions are invalid if user provided resolutions
126396
- var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
126344
+ var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution ? userProvidedHasInvalidatedResolution : undefined);
126397
126345
  var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
126398
126346
  if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
126399
126347
  if (hasChangedConfigFileParsingErrors) {
@@ -126632,8 +126580,6 @@ var ts;
126632
126580
  }
126633
126581
  function reloadFileNamesFromConfigFile() {
126634
126582
  writeLog("Reloading new file names and options");
126635
- ts.Debug.assert(compilerOptions);
126636
- ts.Debug.assert(configFileName);
126637
126583
  reloadLevel = ts.ConfigFileProgramReloadLevel.None;
126638
126584
  rootFileNames = ts.getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
126639
126585
  if (ts.updateErrorForNoInputFiles(rootFileNames, ts.getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
@@ -126643,7 +126589,6 @@ var ts;
126643
126589
  synchronizeProgram();
126644
126590
  }
126645
126591
  function reloadConfigFile() {
126646
- ts.Debug.assert(configFileName);
126647
126592
  writeLog("Reloading config file: ".concat(configFileName));
126648
126593
  reloadLevel = ts.ConfigFileProgramReloadLevel.None;
126649
126594
  if (cachedDirectoryStructureHost) {
@@ -126658,7 +126603,6 @@ var ts;
126658
126603
  updateExtendedConfigFilesWatches(toPath(configFileName), compilerOptions, watchOptions, ts.WatchType.ExtendedConfigFile);
126659
126604
  }
126660
126605
  function parseConfigFile() {
126661
- ts.Debug.assert(configFileName);
126662
126606
  setConfigFileParsingResult(ts.getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost, extendedConfigCache || (extendedConfigCache = new ts.Map()), watchOptionsToExtend, extraFileExtensions)); // TODO: GH#18217
126663
126607
  }
126664
126608
  function setConfigFileParsingResult(configFileParseResult) {
@@ -126680,7 +126624,6 @@ var ts;
126680
126624
  // With host implementing getParsedCommandLine we cant just update file names
126681
126625
  if (config.parsedCommandLine && config.reloadLevel === ts.ConfigFileProgramReloadLevel.Partial && !host.getParsedCommandLine) {
126682
126626
  writeLog("Reloading new file names and options");
126683
- ts.Debug.assert(compilerOptions);
126684
126627
  var fileNames = ts.getFileNamesFromConfigSpecs(config.parsedCommandLine.options.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost);
126685
126628
  config.parsedCommandLine = __assign(__assign({}, config.parsedCommandLine), { fileNames: fileNames });
126686
126629
  config.reloadLevel = undefined;
@@ -126767,8 +126710,7 @@ var ts;
126767
126710
  }
126768
126711
  function watchWildcardDirectory(directory, flags) {
126769
126712
  return watchDirectory(directory, function (fileOrDirectory) {
126770
- ts.Debug.assert(configFileName);
126771
- ts.Debug.assert(compilerOptions);
126713
+ ts.Debug.assert(!!configFileName);
126772
126714
  var fileOrDirectoryPath = toPath(fileOrDirectory);
126773
126715
  // Since the file existence changed, update the sourceFiles cache
126774
126716
  if (cachedDirectoryStructureHost) {
@@ -126798,7 +126740,6 @@ var ts;
126798
126740
  }, flags, watchOptions, ts.WatchType.WildcardDirectory);
126799
126741
  }
126800
126742
  function updateExtendedConfigFilesWatches(forProjectPath, options, watchOptions, watchType) {
126801
- ts.Debug.assert(configFileName);
126802
126743
  ts.updateSharedExtendedConfigFileWatcher(forProjectPath, options, sharedExtendedConfigFileWatchers || (sharedExtendedConfigFileWatchers = new ts.Map()), function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(extendedConfigFileName, function (_fileName, eventKind) {
126803
126744
  var _a;
126804
126745
  updateCachedSystemWithFile(extendedConfigFileName, extendedConfigFilePath, eventKind);
@@ -131941,6 +131882,12 @@ var ts;
131941
131882
  }
131942
131883
  ts.getSynthesizedDeepCloneWithReplacements = getSynthesizedDeepCloneWithReplacements;
131943
131884
  function getSynthesizedDeepCloneWorker(node, replaceNode) {
131885
+ var nodeClone = replaceNode
131886
+ ? function (n) { return getSynthesizedDeepCloneWithReplacements(n, /*includeTrivia*/ true, replaceNode); }
131887
+ : getSynthesizedDeepClone;
131888
+ var nodesClone = replaceNode
131889
+ ? function (ns) { return ns && getSynthesizedDeepClonesWithReplacements(ns, /*includeTrivia*/ true, replaceNode); }
131890
+ : function (ns) { return ns && getSynthesizedDeepClones(ns); };
131944
131891
  var visited = ts.visitEachChild(node, nodeClone, ts.nullTransformationContext, nodesClone, nodeClone);
131945
131892
  if (visited === node) {
131946
131893
  // This only happens for leaf nodes - internal nodes always see their children change.
@@ -131954,16 +131901,6 @@ var ts;
131954
131901
  // would have made.
131955
131902
  visited.parent = undefined;
131956
131903
  return visited;
131957
- function nodeClone(node) {
131958
- return replaceNode
131959
- ? getSynthesizedDeepCloneWithReplacements(node, /*includeTrivia*/ true, replaceNode)
131960
- : getSynthesizedDeepClone(node);
131961
- }
131962
- function nodesClone(nodes) {
131963
- return replaceNode
131964
- ? nodes && getSynthesizedDeepClonesWithReplacements(nodes, /*includeTrivia*/ true, replaceNode)
131965
- : nodes && getSynthesizedDeepClones(nodes);
131966
- }
131967
131904
  }
131968
131905
  function getSynthesizedDeepClones(nodes, includeTrivia) {
131969
131906
  if (includeTrivia === void 0) { includeTrivia = true; }
@@ -132703,7 +132640,7 @@ var ts;
132703
132640
  return false;
132704
132641
  }
132705
132642
  // If the file is a module written in TypeScript, it still might be in a `declare global` augmentation
132706
- return ts.isInJSFile(declaration) || !ts.findAncestor(declaration, function (d) { return ts.isModuleDeclaration(d) && ts.isGlobalScopeAugmentation(d); });
132643
+ return ts.isInJSFile(declaration) || !ts.findAncestor(declaration, ts.isGlobalScopeAugmentation);
132707
132644
  }
132708
132645
  ts.isNonGlobalDeclaration = isNonGlobalDeclaration;
132709
132646
  function isDeprecatedDeclaration(decl) {
@@ -135186,7 +135123,7 @@ var ts;
135186
135123
  if (!dependencies)
135187
135124
  continue;
135188
135125
  for (var dep in dependencies) {
135189
- if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) {
135126
+ if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) {
135190
135127
  result.push(dep);
135191
135128
  }
135192
135129
  }
@@ -135570,7 +135507,7 @@ var ts;
135570
135507
  return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
135571
135508
  }
135572
135509
  function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
135573
- var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports;
135510
+ var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports;
135574
135511
  // Verify if the file is JSX language variant
135575
135512
  if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) {
135576
135513
  var completionInfo = getJsxClosingTagCompletion(location, sourceFile);
@@ -135584,7 +135521,7 @@ var ts;
135584
135521
  return undefined;
135585
135522
  }
135586
135523
  var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
135587
- /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
135524
+ /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
135588
135525
  if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) {
135589
135526
  for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
135590
135527
  var keywordEntry = _a[_i];
@@ -135702,7 +135639,7 @@ var ts;
135702
135639
  function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
135703
135640
  return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority };
135704
135641
  }
135705
- function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
135642
+ function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
135706
135643
  var _a, _b;
135707
135644
  var insertText;
135708
135645
  var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
@@ -135758,8 +135695,8 @@ var ts;
135758
135695
  }
135759
135696
  if (originIsResolvedExport(origin)) {
135760
135697
  sourceDisplay = [ts.textPart(origin.moduleSpecifier)];
135761
- if (importCompletionNode) {
135762
- (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan);
135698
+ if (importStatementCompletion) {
135699
+ (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan);
135763
135700
  isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
135764
135701
  }
135765
135702
  }
@@ -135814,7 +135751,7 @@ var ts;
135814
135751
  }
135815
135752
  if (originIsExport(origin) || originIsResolvedExport(origin)) {
135816
135753
  data = originToCompletionEntryData(origin);
135817
- hasAction = !importCompletionNode;
135754
+ hasAction = !importStatementCompletion;
135818
135755
  }
135819
135756
  // TODO(drosen): Right now we just permit *all* semantic meanings when calling
135820
135757
  // 'getSymbolKind' which is permissible given that it is backwards compatible; but
@@ -135837,7 +135774,7 @@ var ts;
135837
135774
  labelDetails: labelDetails,
135838
135775
  isSnippet: isSnippet,
135839
135776
  isPackageJsonImport: originIsPackageJsonImport(origin) || undefined,
135840
- isImportStatementCompletion: !!importCompletionNode || undefined,
135777
+ isImportStatementCompletion: !!importStatementCompletion || undefined,
135841
135778
  data: data,
135842
135779
  };
135843
135780
  }
@@ -136039,7 +135976,6 @@ var ts;
136039
135976
  var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) };
136040
135977
  return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails };
136041
135978
  }
136042
- ;
136043
135979
  function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) {
136044
135980
  var declarations = symbol.getDeclarations();
136045
135981
  if (!(declarations && declarations.length)) {
@@ -136210,19 +136146,16 @@ var ts;
136210
136146
  };
136211
136147
  return unresolvedOrigin;
136212
136148
  }
136213
- function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) {
136214
- var _a, _b, _c;
136215
- var sourceFile = importCompletionNode.getSourceFile();
136216
- var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile);
136149
+ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
136150
+ var replacementSpan = importStatementCompletion.replacementSpan;
136217
136151
  var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier);
136218
136152
  var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ :
136219
136153
  origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ :
136220
136154
  0 /* ExportKind.Named */;
136221
136155
  var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
136222
136156
  var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true);
136223
- var isTopLevelTypeOnly = ((_b = (_a = ts.tryCast(importCompletionNode, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || ((_c = ts.tryCast(importCompletionNode, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly);
136224
- var isImportSpecifierTypeOnly = couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken);
136225
- var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
136157
+ var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier;
136158
+ var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
136226
136159
  var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : "";
136227
136160
  var suffix = useSemicolons ? ";" : "";
136228
136161
  switch (importKind) {
@@ -136256,7 +136189,7 @@ var ts;
136256
136189
  return CompletionSource.TypeOnlyAlias;
136257
136190
  }
136258
136191
  }
136259
- function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
136192
+ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
136260
136193
  var _a;
136261
136194
  var start = ts.timestamp();
136262
136195
  var variableDeclaration = getVariableDeclaration(location);
@@ -136277,7 +136210,7 @@ var ts;
136277
136210
  var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
136278
136211
  var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority;
136279
136212
  var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText);
136280
- var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag);
136213
+ var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag);
136281
136214
  if (!entry) {
136282
136215
  continue;
136283
136216
  }
@@ -136468,7 +136401,7 @@ var ts;
136468
136401
  Completions.createCompletionDetails = createCompletionDetails;
136469
136402
  function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) {
136470
136403
  if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
136471
- if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) {
136404
+ if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) {
136472
136405
  // Import statement completion: 'import c|'
136473
136406
  return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
136474
136407
  }
@@ -136669,34 +136602,34 @@ var ts;
136669
136602
  var isStartingCloseTag = false;
136670
136603
  var isJsxInitializer = false;
136671
136604
  var isJsxIdentifierExpected = false;
136672
- var importCompletionNode;
136605
+ var importStatementCompletion;
136673
136606
  var location = ts.getTouchingPropertyName(sourceFile, position);
136674
136607
  var keywordFilters = 0 /* KeywordCompletionFilters.None */;
136675
136608
  var isNewIdentifierLocation = false;
136676
136609
  var flags = 0 /* CompletionInfoFlags.None */;
136677
136610
  if (contextToken) {
136678
- var importStatementCompletion = getImportStatementCompletionInfo(contextToken);
136679
- isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation;
136680
- if (importStatementCompletion.keywordCompletion) {
136681
- if (importStatementCompletion.isKeywordOnlyCompletion) {
136611
+ var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken);
136612
+ if (importStatementCompletionInfo.keywordCompletion) {
136613
+ if (importStatementCompletionInfo.isKeywordOnlyCompletion) {
136682
136614
  return {
136683
136615
  kind: 4 /* CompletionDataKind.Keywords */,
136684
- keywordCompletions: [keywordToCompletionEntry(importStatementCompletion.keywordCompletion)],
136685
- isNewIdentifierLocation: isNewIdentifierLocation,
136616
+ keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)],
136617
+ isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation,
136686
136618
  };
136687
136619
  }
136688
- keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletion.keywordCompletion);
136620
+ keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion);
136689
136621
  }
136690
- if (importStatementCompletion.replacementNode && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
136622
+ if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
136691
136623
  // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier`
136692
136624
  // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature
136693
136625
  // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
136694
136626
  // to opt in with the `includeCompletionsForImportStatements` user preference.
136695
- importCompletionNode = importStatementCompletion.replacementNode;
136696
136627
  flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */;
136628
+ importStatementCompletion = importStatementCompletionInfo;
136629
+ isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation;
136697
136630
  }
136698
136631
  // Bail out if this is a known invalid completion location
136699
- if (!importCompletionNode && isCompletionListBlocker(contextToken)) {
136632
+ if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) {
136700
136633
  log("Returning an empty list because completion was requested in an invalid position.");
136701
136634
  return keywordFilters
136702
136635
  ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation())
@@ -136742,7 +136675,7 @@ var ts;
136742
136675
  return undefined;
136743
136676
  }
136744
136677
  }
136745
- else if (!importCompletionNode && sourceFile.languageVariant === 1 /* LanguageVariant.JSX */) {
136678
+ else if (!importStatementCompletion) {
136746
136679
  // <UI.Test /* completion position */ />
136747
136680
  // If the tagname is a property access expression, we will then walk up to the top most of property access expression.
136748
136681
  // Then, try to get a JSX container and its associated attributes type.
@@ -136885,7 +136818,7 @@ var ts;
136885
136818
  isTypeOnlyLocation: isTypeOnlyLocation,
136886
136819
  isJsxIdentifierExpected: isJsxIdentifierExpected,
136887
136820
  isRightOfOpenTag: isRightOfOpenTag,
136888
- importCompletionNode: importCompletionNode,
136821
+ importStatementCompletion: importStatementCompletion,
136889
136822
  hasUnresolvedAutoImports: hasUnresolvedAutoImports,
136890
136823
  flags: flags,
136891
136824
  };
@@ -137139,7 +137072,7 @@ var ts;
137139
137072
  return 1 /* GlobalsSearch.Success */;
137140
137073
  }
137141
137074
  function tryGetImportCompletionSymbols() {
137142
- if (!importCompletionNode)
137075
+ if (!importStatementCompletion)
137143
137076
  return 0 /* GlobalsSearch.Continue */;
137144
137077
  isNewIdentifierLocation = true;
137145
137078
  collectAutoImports();
@@ -137222,7 +137155,7 @@ var ts;
137222
137155
  }
137223
137156
  function shouldOfferImportCompletions() {
137224
137157
  // If already typing an import statement, provide completions for it.
137225
- if (importCompletionNode)
137158
+ if (importStatementCompletion)
137226
137159
  return true;
137227
137160
  // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols
137228
137161
  if (isNonContextualObjectLiteral)
@@ -137252,7 +137185,7 @@ var ts;
137252
137185
  }
137253
137186
  function isTypeOnlyCompletion() {
137254
137187
  return insideJsDocTagTypeExpression
137255
- || !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent)
137188
+ || !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent)
137256
137189
  || !isContextTokenValueLocation(contextToken) &&
137257
137190
  (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
137258
137191
  || ts.isPartOfTypeNode(location)
@@ -137302,8 +137235,7 @@ var ts;
137302
137235
  flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */;
137303
137236
  // import { type | -> token text should be blank
137304
137237
  var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken
137305
- && importCompletionNode
137306
- && couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken);
137238
+ && importStatementCompletion;
137307
137239
  var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" :
137308
137240
  previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() :
137309
137241
  "";
@@ -137311,14 +137243,14 @@ var ts;
137311
137243
  var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken);
137312
137244
  var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
137313
137245
  var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
137314
- resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
137246
+ resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
137315
137247
  exportInfo.search(sourceFile.path,
137316
137248
  /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) {
137317
137249
  if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
137318
137250
  return false;
137319
137251
  if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
137320
137252
  return false;
137321
- if (!isTypeOnlyLocation && !importCompletionNode && !(targetFlags & 111551 /* SymbolFlags.Value */))
137253
+ if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */))
137322
137254
  return false;
137323
137255
  if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */)))
137324
137256
  return false;
@@ -137399,7 +137331,7 @@ var ts;
137399
137331
  return;
137400
137332
  }
137401
137333
  symbolToOriginInfoMap[symbols.length] = origin;
137402
- symbolToSortTextMap[symbolId] = importCompletionNode ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions;
137334
+ symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions;
137403
137335
  symbols.push(symbol);
137404
137336
  }
137405
137337
  /* Mutates `symbols` and `symbolToOriginInfoMap`. */
@@ -138666,6 +138598,7 @@ var ts;
138666
138598
  return undefined;
138667
138599
  }
138668
138600
  function getImportStatementCompletionInfo(contextToken) {
138601
+ var _a, _b, _c;
138669
138602
  var keywordCompletion;
138670
138603
  var isKeywordOnlyCompletion = false;
138671
138604
  var candidate = getCandidate();
@@ -138673,9 +138606,9 @@ var ts;
138673
138606
  isKeywordOnlyCompletion: isKeywordOnlyCompletion,
138674
138607
  keywordCompletion: keywordCompletion,
138675
138608
  isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */),
138676
- replacementNode: candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile())
138677
- ? candidate
138678
- : undefined
138609
+ isTopLevelTypeOnly: !!((_b = (_a = ts.tryCast(candidate, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts.tryCast(candidate, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly),
138610
+ couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken),
138611
+ replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate),
138679
138612
  };
138680
138613
  function getCandidate() {
138681
138614
  var parent = contextToken.parent;
@@ -138717,14 +138650,71 @@ var ts;
138717
138650
  return undefined;
138718
138651
  }
138719
138652
  }
138653
+ function getSingleLineReplacementSpanForImportCompletionNode(node) {
138654
+ var _a, _b, _c;
138655
+ if (!node)
138656
+ return undefined;
138657
+ var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node;
138658
+ var sourceFile = top.getSourceFile();
138659
+ if (ts.rangeIsOnSingleLine(top, sourceFile)) {
138660
+ return ts.createTextSpanFromNode(top, sourceFile);
138661
+ }
138662
+ // ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration
138663
+ ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */);
138664
+ // Guess which point in the import might actually be a later statement parsed as part of the import
138665
+ // during parser recovery - either in the middle of named imports, or the module specifier.
138666
+ var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */
138667
+ ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier
138668
+ : top.moduleReference;
138669
+ var withoutModuleSpecifier = {
138670
+ pos: top.getFirstToken().getStart(),
138671
+ end: potentialSplitPoint.pos,
138672
+ };
138673
+ // The module specifier/reference was previously found to be missing, empty, or
138674
+ // not a string literal - in this last case, it's likely that statement on a following
138675
+ // line was parsed as the module specifier of a partially-typed import, e.g.
138676
+ // import Foo|
138677
+ // interface Blah {}
138678
+ // This appears to be a multiline-import, and editors can't replace multiple lines.
138679
+ // But if everything but the "module specifier" is on one line, by this point we can
138680
+ // assume that the "module specifier" is actually just another statement, and return
138681
+ // the single-line range of the import excluding that probable statement.
138682
+ if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) {
138683
+ return ts.createTextSpanFromRange(withoutModuleSpecifier);
138684
+ }
138685
+ }
138686
+ // Tries to identify the first named import that is not really a named import, but rather
138687
+ // just parser recovery for a situation like:
138688
+ // import { Foo|
138689
+ // interface Bar {}
138690
+ // in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller
138691
+ // will also check if this token is on a separate line from the rest of the import.
138692
+ function getPotentiallyInvalidImportSpecifier(namedBindings) {
138693
+ var _a;
138694
+ return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) {
138695
+ var _a;
138696
+ return !e.propertyName &&
138697
+ ts.isStringANonContextualKeyword(e.name.text) &&
138698
+ ((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */;
138699
+ });
138700
+ }
138720
138701
  function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) {
138721
138702
  return ts.isImportSpecifier(importSpecifier)
138722
138703
  && (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken));
138723
138704
  }
138724
138705
  function canCompleteFromNamedBindings(namedBindings) {
138725
- return isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier)
138726
- && (ts.isNamespaceImport(namedBindings) || namedBindings.elements.length < 2)
138727
- && !namedBindings.parent.name;
138706
+ if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) {
138707
+ return false;
138708
+ }
138709
+ if (ts.isNamedImports(namedBindings)) {
138710
+ // We can only complete on named imports if there are no other named imports already,
138711
+ // but parser recovery sometimes puts later statements in the named imports list, so
138712
+ // we try to only consider the probably-valid ones.
138713
+ var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings);
138714
+ var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length;
138715
+ return validImports < 2;
138716
+ }
138717
+ return true;
138728
138718
  }
138729
138719
  function isModuleSpecifierMissingOrEmpty(specifier) {
138730
138720
  var _a;
@@ -138743,7 +138733,6 @@ var ts;
138743
138733
  function isArrowFunctionBody(node) {
138744
138734
  return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node;
138745
138735
  }
138746
- ;
138747
138736
  /** True if symbol is a type or a module containing at least one type. */
138748
138737
  function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) {
138749
138738
  if (seenModules === void 0) { seenModules = new ts.Map(); }
@@ -139027,7 +139016,7 @@ var ts;
139027
139016
  // If we're an accessibility modifier, we're in an instance member and should search
139028
139017
  // the constructor's parameter list for instance members as well.
139029
139018
  if (modifierFlag & (28 /* ModifierFlags.AccessibilityModifier */ | 64 /* ModifierFlags.Readonly */)) {
139030
- var constructor = ts.find(container.members, ts.isConstructorDeclaration); // TODO(jakebailey): GH#49924 ???
139019
+ var constructor = ts.find(container.members, ts.isConstructorDeclaration);
139031
139020
  if (constructor) {
139032
139021
  return __spreadArray(__spreadArray([], nodes, true), constructor.parameters, true);
139033
139022
  }
@@ -146760,6 +146749,10 @@ var ts;
146760
146749
  pushSelectionCommentRange(comment.pos, comment.end);
146761
146750
  }
146762
146751
  if (positionShouldSnapToNode(sourceFile, pos, node)) {
146752
+ if (ts.isFunctionBody(node)
146753
+ && ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) {
146754
+ pushSelectionRange(node.getStart(sourceFile), node.getEnd());
146755
+ }
146763
146756
  // 1. Blocks are effectively redundant with SyntaxLists.
146764
146757
  // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
146765
146758
  // of things that should be considered independently.
@@ -147911,7 +147904,7 @@ var ts;
147911
147904
  return name === "undefined";
147912
147905
  }
147913
147906
  function isHintableDeclaration(node) {
147914
- if ((ts.isParameter(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node)) && node.initializer) {
147907
+ if ((ts.isParameterDeclaration(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node)) && node.initializer) {
147915
147908
  var initializer = ts.skipParentheses(node.initializer);
147916
147909
  return !(isHintableLiteral(initializer) || ts.isNewExpression(initializer) || ts.isObjectLiteralExpression(initializer) || ts.isAssertionExpression(initializer));
147917
147910
  }
@@ -149824,19 +149817,19 @@ var ts;
149824
149817
  return function (context) { return context.options && context.options[optionName] === optionValue; };
149825
149818
  }
149826
149819
  function isOptionEnabled(optionName) {
149827
- return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; };
149820
+ return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; };
149828
149821
  }
149829
149822
  function isOptionDisabled(optionName) {
149830
- return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; };
149823
+ return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; };
149831
149824
  }
149832
149825
  function isOptionDisabledOrUndefined(optionName) {
149833
- return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; };
149826
+ return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; };
149834
149827
  }
149835
149828
  function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) {
149836
- return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); };
149829
+ return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); };
149837
149830
  }
149838
149831
  function isOptionEnabledOrUndefined(optionName) {
149839
- return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; };
149832
+ return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; };
149840
149833
  }
149841
149834
  function isForContext(context) {
149842
149835
  return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */;
@@ -153152,7 +153145,6 @@ var ts;
153152
153145
  if (!visited) {
153153
153146
  return visited;
153154
153147
  }
153155
- ts.Debug.assert(nodes);
153156
153148
  // clone nodearray if necessary
153157
153149
  var nodeArray = visited === nodes ? ts.factory.createNodeArray(visited.slice(0)) : visited;
153158
153150
  ts.setTextRangePosEnd(nodeArray, getPos(nodes), getEnd(nodes));
@@ -154441,31 +154433,22 @@ var ts;
154441
154433
  var param = _a[_i];
154442
154434
  if (!param.type) {
154443
154435
  var paramType = ts.getJSDocType(param);
154444
- if (paramType) {
154445
- var transformedType = transformJSDocType(paramType);
154446
- ts.Debug.assertNode(transformedType, ts.isTypeNode);
154447
- changes.tryInsertTypeAnnotation(sourceFile, param, transformedType);
154448
- }
154436
+ if (paramType)
154437
+ changes.tryInsertTypeAnnotation(sourceFile, param, transformJSDocType(paramType));
154449
154438
  }
154450
154439
  }
154451
154440
  if (needParens)
154452
154441
  changes.insertNodeAfter(sourceFile, ts.last(decl.parameters), ts.factory.createToken(21 /* SyntaxKind.CloseParenToken */));
154453
154442
  if (!decl.type) {
154454
154443
  var returnType = ts.getJSDocReturnType(decl);
154455
- if (returnType) {
154456
- var transformedType = transformJSDocType(returnType);
154457
- ts.Debug.assertNode(transformedType, ts.isTypeNode);
154458
- changes.tryInsertTypeAnnotation(sourceFile, decl, transformedType);
154459
- }
154460
- ;
154444
+ if (returnType)
154445
+ changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(returnType));
154461
154446
  }
154462
154447
  }
154463
154448
  else {
154464
154449
  var jsdocType = ts.Debug.checkDefined(ts.getJSDocType(decl), "A JSDocType for this declaration should exist"); // If not defined, shouldn't have been an error to fix
154465
154450
  ts.Debug.assert(!decl.type, "The JSDocType decl should have a type"); // If defined, shouldn't have been an error to fix.
154466
- var transformedType = transformJSDocType(jsdocType);
154467
- ts.Debug.assertNode(transformedType, ts.isTypeNode);
154468
- changes.tryInsertTypeAnnotation(sourceFile, decl, transformedType);
154451
+ changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(jsdocType));
154469
154452
  }
154470
154453
  }
154471
154454
  function isDeclarationWithType(node) {
@@ -157468,7 +157451,7 @@ var ts;
157468
157451
  var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
157469
157452
  if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
157470
157453
  return;
157471
- var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
157454
+ var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
157472
157455
  if (declaration === undefined)
157473
157456
  return;
157474
157457
  if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) {
@@ -157502,14 +157485,6 @@ var ts;
157502
157485
  }
157503
157486
  }
157504
157487
  }
157505
- function findAncestorMatchingSpan(sourceFile, span) {
157506
- var end = ts.textSpanEnd(span);
157507
- var token = ts.getTokenAtPosition(sourceFile, span.start);
157508
- while (token.end < end) {
157509
- token = token.parent;
157510
- }
157511
- return token;
157512
- }
157513
157488
  function tryGetConstraintFromDiagnosticMessage(messageText) {
157514
157489
  var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1];
157515
157490
  return constraint;
@@ -158390,7 +158365,7 @@ var ts;
158390
158365
  return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
158391
158366
  }
158392
158367
  var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
158393
- if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
158368
+ if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
158394
158369
  return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
158395
158370
  }
158396
158371
  return undefined;
@@ -159055,6 +159030,63 @@ var ts;
159055
159030
  })(ts || (ts = {}));
159056
159031
  /* @internal */
159057
159032
  var ts;
159033
+ (function (ts) {
159034
+ var codefix;
159035
+ (function (codefix) {
159036
+ var fixId = "fixNaNEquality";
159037
+ var errorCodes = [
159038
+ ts.Diagnostics.This_condition_will_always_return_0.code,
159039
+ ];
159040
+ codefix.registerCodeFix({
159041
+ errorCodes: errorCodes,
159042
+ getCodeActions: function (context) {
159043
+ var sourceFile = context.sourceFile, span = context.span, program = context.program;
159044
+ var info = getInfo(program, sourceFile, span);
159045
+ if (info === undefined)
159046
+ return;
159047
+ var suggestion = info.suggestion, expression = info.expression, arg = info.arg;
159048
+ var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); });
159049
+ return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)];
159050
+ },
159051
+ fixIds: [fixId],
159052
+ getAllCodeActions: function (context) {
159053
+ return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
159054
+ var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length));
159055
+ if (info) {
159056
+ doChange(changes, diag.file, info.arg, info.expression);
159057
+ }
159058
+ });
159059
+ }
159060
+ });
159061
+ function getInfo(program, sourceFile, span) {
159062
+ var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
159063
+ if (diag === undefined || diag.relatedInformation === undefined)
159064
+ return;
159065
+ var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; });
159066
+ if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
159067
+ return;
159068
+ var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
159069
+ if (token === undefined)
159070
+ return;
159071
+ if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) {
159072
+ return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token };
159073
+ }
159074
+ return undefined;
159075
+ }
159076
+ function doChange(changes, sourceFile, arg, expression) {
159077
+ var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]);
159078
+ var operator = expression.operatorToken.kind;
159079
+ changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */
159080
+ ? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression);
159081
+ }
159082
+ function getSuggestion(messageText) {
159083
+ var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1];
159084
+ return suggestion;
159085
+ }
159086
+ })(codefix = ts.codefix || (ts.codefix = {}));
159087
+ })(ts || (ts = {}));
159088
+ /* @internal */
159089
+ var ts;
159058
159090
  (function (ts) {
159059
159091
  var codefix;
159060
159092
  (function (codefix) {
@@ -161741,11 +161773,12 @@ var ts;
161741
161773
  */
161742
161774
  function tryGetAutoImportableReferenceFromTypeNode(importTypeNode, scriptTarget) {
161743
161775
  var symbols;
161744
- var typeNode = ts.visitNode(importTypeNode, visit, ts.isTypeNode);
161776
+ var typeNode = ts.visitNode(importTypeNode, visit);
161745
161777
  if (symbols && typeNode) {
161746
161778
  return { typeNode: typeNode, symbols: symbols };
161747
161779
  }
161748
161780
  function visit(node) {
161781
+ var _a;
161749
161782
  if (ts.isLiteralImportTypeNode(node) && node.qualifier) {
161750
161783
  // Symbol for the left-most thing after the dot
161751
161784
  var firstIdentifier = ts.getFirstIdentifier(node.qualifier);
@@ -161754,7 +161787,7 @@ var ts;
161754
161787
  ? replaceFirstIdentifierOfEntityName(node.qualifier, ts.factory.createIdentifier(name))
161755
161788
  : node.qualifier;
161756
161789
  symbols = ts.append(symbols, firstIdentifier.symbol);
161757
- var typeArguments = ts.visitNodes(node.typeArguments, visit, ts.isTypeNode);
161790
+ var typeArguments = (_a = node.typeArguments) === null || _a === void 0 ? void 0 : _a.map(visit);
161758
161791
  return ts.factory.createTypeReferenceNode(qualifier, typeArguments);
161759
161792
  }
161760
161793
  return ts.visitEachChild(node, visit, ts.nullTransformationContext);
@@ -161771,6 +161804,15 @@ var ts;
161771
161804
  symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); });
161772
161805
  }
161773
161806
  codefix.importSymbols = importSymbols;
161807
+ function findAncestorMatchingSpan(sourceFile, span) {
161808
+ var end = ts.textSpanEnd(span);
161809
+ var token = ts.getTokenAtPosition(sourceFile, span.start);
161810
+ while (token.end < end) {
161811
+ token = token.parent;
161812
+ }
161813
+ return token;
161814
+ }
161815
+ codefix.findAncestorMatchingSpan = findAncestorMatchingSpan;
161774
161816
  })(codefix = ts.codefix || (ts.codefix = {}));
161775
161817
  })(ts || (ts = {}));
161776
161818
  /* @internal */
@@ -162829,7 +162871,6 @@ var ts;
162829
162871
  return { edits: edits, renameFilename: undefined, renameLocation: undefined };
162830
162872
  },
162831
162873
  });
162832
- ;
162833
162874
  function getInfo(context, considerPartialSpans) {
162834
162875
  if (considerPartialSpans === void 0) { considerPartialSpans = true; }
162835
162876
  var file = context.file, program = context.program;
@@ -163306,7 +163347,6 @@ var ts;
163306
163347
  });
163307
163348
  return { edits: edits, renameFilename: undefined, renameLocation: undefined };
163308
163349
  }
163309
- ;
163310
163350
  function isValidExpression(node) {
163311
163351
  return ts.isBinaryExpression(node) || ts.isConditionalExpression(node);
163312
163352
  }
@@ -163354,7 +163394,6 @@ var ts;
163354
163394
  if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) {
163355
163395
  return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) };
163356
163396
  }
163357
- ;
163358
163397
  var finalExpression = getFinalExpressionInChain(expression.right);
163359
163398
  if (!finalExpression)
163360
163399
  return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) };
@@ -164871,7 +164910,7 @@ var ts;
164871
164910
  var statements = ts.factory.createNodeArray(ts.isBlock(body) ? body.statements.slice(0) : [ts.isStatement(body) ? body : ts.factory.createReturnStatement(ts.skipParentheses(body))]);
164872
164911
  // rewrite body if either there are writes that should be propagated back via return statements or there are substitutions
164873
164912
  if (hasWritesOrVariableDeclarations || substitutions.size) {
164874
- var rewrittenStatements = ts.visitNodes(statements, visitor, ts.isStatement).slice();
164913
+ var rewrittenStatements = ts.visitNodes(statements, visitor).slice();
164875
164914
  if (hasWritesOrVariableDeclarations && !hasReturn && ts.isStatement(body)) {
164876
164915
  // add return at the end to propagate writes back in case if control flow falls out of the function body
164877
164916
  // it is ok to know that range has at least one return since it we only allow unconditional returns
@@ -165698,7 +165737,6 @@ var ts;
165698
165737
  (function (ts) {
165699
165738
  var refactor;
165700
165739
  (function (refactor) {
165701
- ;
165702
165740
  /**
165703
165741
  * Checks if some refactor info has refactor error info.
165704
165742
  */
@@ -165803,7 +165841,6 @@ var ts;
165803
165841
  // Imports will be copied to the new file anyway, and may still be needed in the old file.
165804
165842
  // Prologue directives will be copied to the new file and should be left in the old file.
165805
165843
  return !isPureImport(statement) && !ts.isPrologueDirective(statement);
165806
- ;
165807
165844
  }
165808
165845
  function isPureImport(node) {
165809
165846
  switch (node.kind) {
@@ -172903,7 +172940,7 @@ var ts;
172903
172940
  (name === undefined || typeof name === "string" || ts.isPropertyName(name)) &&
172904
172941
  (questionToken === undefined || typeof questionToken === "object" && ts.isQuestionToken(questionToken)) &&
172905
172942
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
172906
- (parameters === undefined || ts.isArrayOf(parameters, ts.isParameter)) &&
172943
+ (parameters === undefined || !ts.some(parameters, ts.isTypeParameterDeclaration)) &&
172907
172944
  (type === undefined || !ts.isArray(type)) &&
172908
172945
  (body === undefined || ts.isBlock(body));
172909
172946
  },
@@ -172913,7 +172950,7 @@ var ts;
172913
172950
  (asteriskToken === undefined || typeof asteriskToken === "object" && ts.isAsteriskToken(asteriskToken)) &&
172914
172951
  (name === undefined || typeof name === "string" || ts.isPropertyName(name)) &&
172915
172952
  (questionToken === undefined || !ts.isArray(questionToken)) &&
172916
- (typeParameters === undefined || ts.isArrayOf(typeParameters, ts.isTypeParameterDeclaration)) &&
172953
+ (typeParameters === undefined || !ts.some(typeParameters, ts.isParameter)) &&
172917
172954
  (parameters === undefined || ts.isArray(parameters)) &&
172918
172955
  (type === undefined || ts.isTypeNode(type)) &&
172919
172956
  (body === undefined || ts.isBlock(body));
@@ -172940,7 +172977,7 @@ var ts;
172940
172977
  (name === undefined || typeof name === "string" || ts.isPropertyName(name)) &&
172941
172978
  (questionToken === undefined || typeof questionToken === "object" && ts.isQuestionToken(questionToken)) &&
172942
172979
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
172943
- (parameters === undefined || ts.isArrayOf(parameters, ts.isParameter)) &&
172980
+ (parameters === undefined || !ts.some(parameters, ts.isTypeParameterDeclaration)) &&
172944
172981
  (type === undefined || !ts.isArray(type)) &&
172945
172982
  (body === undefined || ts.isBlock(body));
172946
172983
  },
@@ -172950,7 +172987,7 @@ var ts;
172950
172987
  (asteriskToken === undefined || typeof asteriskToken === "object" && ts.isAsteriskToken(asteriskToken)) &&
172951
172988
  (name === undefined || typeof name === "string" || ts.isPropertyName(name)) &&
172952
172989
  (questionToken === undefined || !ts.isArray(questionToken)) &&
172953
- (typeParameters === undefined || ts.isArrayOf(typeParameters, ts.isTypeParameterDeclaration)) &&
172990
+ (typeParameters === undefined || !ts.some(typeParameters, ts.isParameter)) &&
172954
172991
  (parameters === undefined || ts.isArray(parameters)) &&
172955
172992
  (type === undefined || ts.isTypeNode(type)) &&
172956
172993
  (body === undefined || ts.isBlock(body));
@@ -172973,14 +173010,14 @@ var ts;
172973
173010
  0: function (_a) {
172974
173011
  var modifiers = _a[0], parameters = _a[1], body = _a[2], other = _a[3];
172975
173012
  return (other === undefined) &&
172976
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
172977
- (parameters === undefined || ts.isArrayOf(parameters, ts.isParameter)) &&
173013
+ (modifiers === undefined || !ts.some(modifiers, ts.isDecorator)) &&
173014
+ (parameters === undefined || !ts.some(parameters, ts.isModifier)) &&
172978
173015
  (body === undefined || !ts.isArray(body));
172979
173016
  },
172980
173017
  1: function (_a) {
172981
173018
  var decorators = _a[0], modifiers = _a[1], parameters = _a[2], body = _a[3];
172982
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
172983
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173019
+ return (decorators === undefined || !ts.some(decorators, ts.isModifier)) &&
173020
+ (modifiers === undefined || !ts.some(modifiers, ts.isParameter)) &&
172984
173021
  (parameters === undefined || ts.isArray(parameters)) &&
172985
173022
  (body === undefined || ts.isBlock(body));
172986
173023
  },
@@ -173002,14 +173039,14 @@ var ts;
173002
173039
  0: function (_a) {
173003
173040
  var modifiers = _a[1], parameters = _a[2], body = _a[3], other = _a[4];
173004
173041
  return (other === undefined) &&
173005
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173006
- (parameters === undefined || ts.isArrayOf(parameters, ts.isParameter)) &&
173042
+ (modifiers === undefined || !ts.some(modifiers, ts.isDecorator)) &&
173043
+ (parameters === undefined || !ts.some(parameters, ts.isModifier)) &&
173007
173044
  (body === undefined || !ts.isArray(body));
173008
173045
  },
173009
173046
  1: function (_a) {
173010
173047
  var decorators = _a[1], modifiers = _a[2], parameters = _a[3], body = _a[4];
173011
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173012
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173048
+ return (decorators === undefined || !ts.some(decorators, ts.isModifier)) &&
173049
+ (modifiers === undefined || !ts.some(modifiers, ts.isParameter)) &&
173013
173050
  (parameters === undefined || ts.isArray(parameters)) &&
173014
173051
  (body === undefined || ts.isBlock(body));
173015
173052
  },
@@ -173151,14 +173188,14 @@ var ts;
173151
173188
  0: function (_a) {
173152
173189
  var modifiers = _a[0], parameters = _a[1], type = _a[2], other = _a[3];
173153
173190
  return (other === undefined) &&
173154
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173155
- (parameters === undefined || ts.isArrayOf(parameters, ts.isParameter)) &&
173191
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173192
+ (parameters === undefined || ts.every(parameters, ts.isParameter)) &&
173156
173193
  (type === undefined || !ts.isArray(type));
173157
173194
  },
173158
173195
  1: function (_a) {
173159
173196
  var decorators = _a[0], modifiers = _a[1], parameters = _a[2], type = _a[3];
173160
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173161
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173197
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173198
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173162
173199
  (parameters === undefined || ts.isArray(parameters)) &&
173163
173200
  (type === undefined || ts.isTypeNode(type));
173164
173201
  },
@@ -173180,14 +173217,14 @@ var ts;
173180
173217
  0: function (_a) {
173181
173218
  var modifiers = _a[1], parameters = _a[2], type = _a[3], other = _a[4];
173182
173219
  return (other === undefined) &&
173183
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173184
- (parameters === undefined || ts.isArrayOf(parameters, ts.isParameter)) &&
173220
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173221
+ (parameters === undefined || ts.every(parameters, ts.isParameter)) &&
173185
173222
  (type === undefined || !ts.isArray(type));
173186
173223
  },
173187
173224
  1: function (_a) {
173188
173225
  var decorators = _a[1], modifiers = _a[2], parameters = _a[3], type = _a[4];
173189
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173190
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173226
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173227
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173191
173228
  (parameters === undefined || ts.isArray(parameters)) &&
173192
173229
  (type === undefined || ts.isTypeNode(type));
173193
173230
  },
@@ -173265,15 +173302,15 @@ var ts;
173265
173302
  return (other === undefined) &&
173266
173303
  (name === undefined || !ts.isArray(name)) &&
173267
173304
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
173268
- (heritageClauses === undefined || ts.isArrayOf(heritageClauses, ts.isHeritageClause)) &&
173269
- (members === undefined || ts.isArrayOf(members, ts.isClassElement));
173305
+ (heritageClauses === undefined || ts.every(heritageClauses, ts.isHeritageClause)) &&
173306
+ (members === undefined || ts.every(members, ts.isClassElement));
173270
173307
  },
173271
173308
  1: function (_a) {
173272
173309
  var modifiers = _a[1], name = _a[2], typeParameters = _a[3], heritageClauses = _a[4], members = _a[5];
173273
173310
  return (modifiers === undefined || ts.isArray(modifiers)) &&
173274
173311
  (name === undefined || !ts.isArray(name)) &&
173275
- (typeParameters === undefined || ts.isArrayOf(typeParameters, ts.isTypeParameterDeclaration)) &&
173276
- (heritageClauses === undefined || ts.isArrayOf(heritageClauses, ts.isHeritageClause)) &&
173312
+ (typeParameters === undefined || ts.every(typeParameters, ts.isTypeParameterDeclaration)) &&
173313
+ (heritageClauses === undefined || ts.every(heritageClauses, ts.isHeritageClause)) &&
173277
173314
  (members === undefined || ts.isArray(members));
173278
173315
  },
173279
173316
  })
@@ -173296,15 +173333,15 @@ var ts;
173296
173333
  return (other === undefined) &&
173297
173334
  (name === undefined || !ts.isArray(name)) &&
173298
173335
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
173299
- (heritageClauses === undefined || ts.isArrayOf(heritageClauses, ts.isHeritageClause)) &&
173300
- (members === undefined || ts.isArrayOf(members, ts.isClassElement));
173336
+ (heritageClauses === undefined || ts.every(heritageClauses, ts.isHeritageClause)) &&
173337
+ (members === undefined || ts.every(members, ts.isClassElement));
173301
173338
  },
173302
173339
  1: function (_a) {
173303
173340
  var modifiers = _a[2], name = _a[3], typeParameters = _a[4], heritageClauses = _a[5], members = _a[6];
173304
173341
  return (modifiers === undefined || ts.isArray(modifiers)) &&
173305
173342
  (name === undefined || !ts.isArray(name)) &&
173306
- (typeParameters === undefined || ts.isArrayOf(typeParameters, ts.isTypeParameterDeclaration)) &&
173307
- (heritageClauses === undefined || ts.isArrayOf(heritageClauses, ts.isHeritageClause)) &&
173343
+ (typeParameters === undefined || ts.every(typeParameters, ts.isTypeParameterDeclaration)) &&
173344
+ (heritageClauses === undefined || ts.every(heritageClauses, ts.isHeritageClause)) &&
173308
173345
  (members === undefined || ts.isArray(members));
173309
173346
  },
173310
173347
  })
@@ -173328,7 +173365,7 @@ var ts;
173328
173365
  (asteriskToken === undefined || !ts.isArray(asteriskToken)) &&
173329
173366
  (name === undefined || typeof name === "string" || ts.isIdentifier(name)) &&
173330
173367
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
173331
- (parameters === undefined || ts.isArrayOf(parameters, ts.isParameter)) &&
173368
+ (parameters === undefined || ts.every(parameters, ts.isParameter)) &&
173332
173369
  (type === undefined || !ts.isArray(type)) &&
173333
173370
  (body === undefined || ts.isBlock(body));
173334
173371
  },
@@ -173337,7 +173374,7 @@ var ts;
173337
173374
  return (modifiers === undefined || ts.isArray(modifiers)) &&
173338
173375
  (asteriskToken === undefined || typeof asteriskToken !== "string" && ts.isAsteriskToken(asteriskToken)) &&
173339
173376
  (name === undefined || !ts.isArray(name)) &&
173340
- (typeParameters === undefined || ts.isArrayOf(typeParameters, ts.isTypeParameterDeclaration)) &&
173377
+ (typeParameters === undefined || ts.every(typeParameters, ts.isTypeParameterDeclaration)) &&
173341
173378
  (parameters === undefined || ts.isArray(parameters)) &&
173342
173379
  (type === undefined || ts.isTypeNode(type)) &&
173343
173380
  (body === undefined || ts.isBlock(body));
@@ -173363,7 +173400,7 @@ var ts;
173363
173400
  (asteriskToken === undefined || !ts.isArray(asteriskToken)) &&
173364
173401
  (name === undefined || ts.isIdentifier(name)) &&
173365
173402
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
173366
- (parameters === undefined || ts.isArrayOf(parameters, ts.isParameter)) &&
173403
+ (parameters === undefined || ts.every(parameters, ts.isParameter)) &&
173367
173404
  (type === undefined || !ts.isArray(type)) &&
173368
173405
  (body === undefined || ts.isBlock(body));
173369
173406
  },
@@ -173372,7 +173409,7 @@ var ts;
173372
173409
  return (modifiers === undefined || ts.isArray(modifiers)) &&
173373
173410
  (asteriskToken === undefined || typeof asteriskToken !== "string" && ts.isAsteriskToken(asteriskToken)) &&
173374
173411
  (name === undefined || !ts.isArray(name)) &&
173375
- (typeParameters === undefined || ts.isArrayOf(typeParameters, ts.isTypeParameterDeclaration)) &&
173412
+ (typeParameters === undefined || ts.every(typeParameters, ts.isTypeParameterDeclaration)) &&
173376
173413
  (parameters === undefined || ts.isArray(parameters)) &&
173377
173414
  (type === undefined || ts.isTypeNode(type)) &&
173378
173415
  (body === undefined || ts.isBlock(body));
@@ -173397,8 +173434,8 @@ var ts;
173397
173434
  return (other === undefined) &&
173398
173435
  (name === undefined || !ts.isArray(name)) &&
173399
173436
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
173400
- (heritageClauses === undefined || ts.isArrayOf(heritageClauses, ts.isHeritageClause)) &&
173401
- (members === undefined || ts.isArrayOf(members, ts.isClassElement));
173437
+ (heritageClauses === undefined || ts.every(heritageClauses, ts.isHeritageClause)) &&
173438
+ (members === undefined || ts.every(members, ts.isClassElement));
173402
173439
  },
173403
173440
  1: function () { return true; },
173404
173441
  })
@@ -173421,15 +173458,15 @@ var ts;
173421
173458
  return (other === undefined) &&
173422
173459
  (name === undefined || !ts.isArray(name)) &&
173423
173460
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
173424
- (heritageClauses === undefined || ts.isArrayOf(heritageClauses, ts.isHeritageClause)) &&
173425
- (members === undefined || ts.isArrayOf(members, ts.isClassElement));
173461
+ (heritageClauses === undefined || ts.every(heritageClauses, ts.isHeritageClause)) &&
173462
+ (members === undefined || ts.every(members, ts.isClassElement));
173426
173463
  },
173427
173464
  1: function (_a) {
173428
173465
  var modifiers = _a[2], name = _a[3], typeParameters = _a[4], heritageClauses = _a[5], members = _a[6];
173429
173466
  return (modifiers === undefined || ts.isArray(modifiers)) &&
173430
173467
  (name === undefined || !ts.isArray(name)) &&
173431
- (typeParameters === undefined || ts.isArrayOf(typeParameters, ts.isTypeParameterDeclaration)) &&
173432
- (heritageClauses === undefined || ts.isArrayOf(heritageClauses, ts.isHeritageClause)) &&
173468
+ (typeParameters === undefined || ts.every(typeParameters, ts.isTypeParameterDeclaration)) &&
173469
+ (heritageClauses === undefined || ts.every(heritageClauses, ts.isHeritageClause)) &&
173433
173470
  (members === undefined || ts.isArray(members));
173434
173471
  },
173435
173472
  })
@@ -173450,19 +173487,19 @@ var ts;
173450
173487
  0: function (_a) {
173451
173488
  var modifiers = _a[0], name = _a[1], typeParameters = _a[2], heritageClauses = _a[3], members = _a[4], other = _a[5];
173452
173489
  return (other === undefined) &&
173453
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173490
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173454
173491
  (name === undefined || !ts.isArray(name)) &&
173455
173492
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
173456
- (heritageClauses === undefined || ts.isArrayOf(heritageClauses, ts.isHeritageClause)) &&
173457
- (members === undefined || ts.isArrayOf(members, ts.isTypeElement));
173493
+ (heritageClauses === undefined || ts.every(heritageClauses, ts.isHeritageClause)) &&
173494
+ (members === undefined || ts.every(members, ts.isTypeElement));
173458
173495
  },
173459
173496
  1: function (_a) {
173460
173497
  var decorators = _a[0], modifiers = _a[1], name = _a[2], typeParameters = _a[3], heritageClauses = _a[4], members = _a[5];
173461
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173498
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173462
173499
  (modifiers === undefined || ts.isArray(modifiers)) &&
173463
173500
  (name === undefined || !ts.isArray(name)) &&
173464
- (typeParameters === undefined || ts.isArrayOf(typeParameters, ts.isTypeParameterDeclaration)) &&
173465
- (heritageClauses === undefined || ts.isArrayOf(heritageClauses, ts.isHeritageClause)) &&
173501
+ (typeParameters === undefined || ts.every(typeParameters, ts.isTypeParameterDeclaration)) &&
173502
+ (heritageClauses === undefined || ts.every(heritageClauses, ts.isHeritageClause)) &&
173466
173503
  (members === undefined || ts.every(members, ts.isTypeElement));
173467
173504
  },
173468
173505
  })
@@ -173483,19 +173520,19 @@ var ts;
173483
173520
  0: function (_a) {
173484
173521
  var modifiers = _a[1], name = _a[2], typeParameters = _a[3], heritageClauses = _a[4], members = _a[5], other = _a[6];
173485
173522
  return (other === undefined) &&
173486
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173523
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173487
173524
  (name === undefined || !ts.isArray(name)) &&
173488
173525
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
173489
- (heritageClauses === undefined || ts.isArrayOf(heritageClauses, ts.isHeritageClause)) &&
173490
- (members === undefined || ts.isArrayOf(members, ts.isTypeElement));
173526
+ (heritageClauses === undefined || ts.every(heritageClauses, ts.isHeritageClause)) &&
173527
+ (members === undefined || ts.every(members, ts.isTypeElement));
173491
173528
  },
173492
173529
  1: function (_a) {
173493
173530
  var decorators = _a[1], modifiers = _a[2], name = _a[3], typeParameters = _a[4], heritageClauses = _a[5], members = _a[6];
173494
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173531
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173495
173532
  (modifiers === undefined || ts.isArray(modifiers)) &&
173496
173533
  (name === undefined || !ts.isArray(name)) &&
173497
- (typeParameters === undefined || ts.isArrayOf(typeParameters, ts.isTypeParameterDeclaration)) &&
173498
- (heritageClauses === undefined || ts.isArrayOf(heritageClauses, ts.isHeritageClause)) &&
173534
+ (typeParameters === undefined || ts.every(typeParameters, ts.isTypeParameterDeclaration)) &&
173535
+ (heritageClauses === undefined || ts.every(heritageClauses, ts.isHeritageClause)) &&
173499
173536
  (members === undefined || ts.every(members, ts.isTypeElement));
173500
173537
  },
173501
173538
  })
@@ -173516,14 +173553,14 @@ var ts;
173516
173553
  0: function (_a) {
173517
173554
  var modifiers = _a[0], name = _a[1], typeParameters = _a[2], type = _a[3], other = _a[4];
173518
173555
  return (other === undefined) &&
173519
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173556
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173520
173557
  (name === undefined || !ts.isArray(name)) &&
173521
173558
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
173522
173559
  (type === undefined || !ts.isArray(type));
173523
173560
  },
173524
173561
  1: function (_a) {
173525
173562
  var decorators = _a[0], modifiers = _a[1], name = _a[2], typeParameters = _a[3], type = _a[4];
173526
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173563
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173527
173564
  (modifiers === undefined || ts.isArray(modifiers)) &&
173528
173565
  (name === undefined || !ts.isArray(name)) &&
173529
173566
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
@@ -173547,14 +173584,14 @@ var ts;
173547
173584
  0: function (_a) {
173548
173585
  var modifiers = _a[1], name = _a[2], typeParameters = _a[3], type = _a[4], other = _a[5];
173549
173586
  return (other === undefined) &&
173550
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173587
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173551
173588
  (name === undefined || !ts.isArray(name)) &&
173552
173589
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
173553
173590
  (type === undefined || !ts.isArray(type));
173554
173591
  },
173555
173592
  1: function (_a) {
173556
173593
  var decorators = _a[1], modifiers = _a[2], name = _a[3], typeParameters = _a[4], type = _a[5];
173557
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173594
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173558
173595
  (modifiers === undefined || ts.isArray(modifiers)) &&
173559
173596
  (name === undefined || !ts.isArray(name)) &&
173560
173597
  (typeParameters === undefined || ts.isArray(typeParameters)) &&
@@ -173578,13 +173615,13 @@ var ts;
173578
173615
  0: function (_a) {
173579
173616
  var modifiers = _a[0], name = _a[1], members = _a[2], other = _a[3];
173580
173617
  return (other === undefined) &&
173581
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173618
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173582
173619
  (name === undefined || !ts.isArray(name)) &&
173583
173620
  (members === undefined || ts.isArray(members));
173584
173621
  },
173585
173622
  1: function (_a) {
173586
173623
  var decorators = _a[0], modifiers = _a[1], name = _a[2], members = _a[3];
173587
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173624
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173588
173625
  (modifiers === undefined || ts.isArray(modifiers)) &&
173589
173626
  (name === undefined || !ts.isArray(name)) &&
173590
173627
  (members === undefined || ts.isArray(members));
@@ -173607,13 +173644,13 @@ var ts;
173607
173644
  0: function (_a) {
173608
173645
  var modifiers = _a[1], name = _a[2], members = _a[3], other = _a[4];
173609
173646
  return (other === undefined) &&
173610
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173647
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173611
173648
  (name === undefined || !ts.isArray(name)) &&
173612
173649
  (members === undefined || ts.isArray(members));
173613
173650
  },
173614
173651
  1: function (_a) {
173615
173652
  var decorators = _a[1], modifiers = _a[2], name = _a[3], members = _a[4];
173616
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173653
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173617
173654
  (modifiers === undefined || ts.isArray(modifiers)) &&
173618
173655
  (name === undefined || !ts.isArray(name)) &&
173619
173656
  (members === undefined || ts.isArray(members));
@@ -173636,14 +173673,14 @@ var ts;
173636
173673
  0: function (_a) {
173637
173674
  var modifiers = _a[0], name = _a[1], body = _a[2], flags = _a[3], other = _a[4];
173638
173675
  return (other === undefined) &&
173639
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173676
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173640
173677
  (name !== undefined && !ts.isArray(name)) &&
173641
173678
  (body === undefined || ts.isModuleBody(body)) &&
173642
173679
  (flags === undefined || typeof flags === "number");
173643
173680
  },
173644
173681
  1: function (_a) {
173645
173682
  var decorators = _a[0], modifiers = _a[1], name = _a[2], body = _a[3], flags = _a[4];
173646
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173683
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173647
173684
  (modifiers === undefined || ts.isArray(modifiers)) &&
173648
173685
  (name !== undefined && ts.isModuleName(name)) &&
173649
173686
  (body === undefined || typeof body === "object") &&
@@ -173667,13 +173704,13 @@ var ts;
173667
173704
  0: function (_a) {
173668
173705
  var modifiers = _a[1], name = _a[2], body = _a[3], other = _a[4];
173669
173706
  return (other === undefined) &&
173670
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173707
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173671
173708
  (name === undefined || !ts.isArray(name)) &&
173672
173709
  (body === undefined || ts.isModuleBody(body));
173673
173710
  },
173674
173711
  1: function (_a) {
173675
173712
  var decorators = _a[1], modifiers = _a[2], name = _a[3], body = _a[4];
173676
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173713
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173677
173714
  (modifiers === undefined || ts.isArray(modifiers)) &&
173678
173715
  (name !== undefined && ts.isModuleName(name)) &&
173679
173716
  (body === undefined || ts.isModuleBody(body));
@@ -173696,14 +173733,14 @@ var ts;
173696
173733
  0: function (_a) {
173697
173734
  var modifiers = _a[0], isTypeOnly = _a[1], name = _a[2], moduleReference = _a[3], other = _a[4];
173698
173735
  return (other === undefined) &&
173699
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173736
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173700
173737
  (isTypeOnly === undefined || typeof isTypeOnly === "boolean") &&
173701
173738
  (typeof name !== "boolean") &&
173702
173739
  (typeof moduleReference !== "string");
173703
173740
  },
173704
173741
  1: function (_a) {
173705
173742
  var decorators = _a[0], modifiers = _a[1], isTypeOnly = _a[2], name = _a[3], moduleReference = _a[4];
173706
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173743
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173707
173744
  (modifiers === undefined || ts.isArray(modifiers)) &&
173708
173745
  (isTypeOnly === undefined || typeof isTypeOnly === "boolean") &&
173709
173746
  (typeof name === "string" || ts.isIdentifier(name)) &&
@@ -173727,14 +173764,14 @@ var ts;
173727
173764
  0: function (_a) {
173728
173765
  var modifiers = _a[1], isTypeOnly = _a[2], name = _a[3], moduleReference = _a[4], other = _a[5];
173729
173766
  return (other === undefined) &&
173730
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173767
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173731
173768
  (isTypeOnly === undefined || typeof isTypeOnly === "boolean") &&
173732
173769
  (typeof name !== "boolean") &&
173733
173770
  (typeof moduleReference !== "string");
173734
173771
  },
173735
173772
  1: function (_a) {
173736
173773
  var decorators = _a[1], modifiers = _a[2], isTypeOnly = _a[3], name = _a[4], moduleReference = _a[5];
173737
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173774
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173738
173775
  (modifiers === undefined || ts.isArray(modifiers)) &&
173739
173776
  (isTypeOnly === undefined || typeof isTypeOnly === "boolean") &&
173740
173777
  (typeof name === "string" || ts.isIdentifier(name)) &&
@@ -173758,14 +173795,14 @@ var ts;
173758
173795
  0: function (_a) {
173759
173796
  var modifiers = _a[0], importClause = _a[1], moduleSpecifier = _a[2], assertClause = _a[3], other = _a[4];
173760
173797
  return (other === undefined) &&
173761
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173798
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173762
173799
  (importClause === undefined || !ts.isArray(importClause)) &&
173763
173800
  (moduleSpecifier !== undefined && ts.isExpression(moduleSpecifier)) &&
173764
173801
  (assertClause === undefined || ts.isAssertClause(assertClause));
173765
173802
  },
173766
173803
  1: function (_a) {
173767
173804
  var decorators = _a[0], modifiers = _a[1], importClause = _a[2], moduleSpecifier = _a[3], assertClause = _a[4];
173768
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173805
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173769
173806
  (modifiers === undefined || ts.isArray(modifiers)) &&
173770
173807
  (importClause === undefined || ts.isImportClause(importClause)) &&
173771
173808
  (moduleSpecifier !== undefined && ts.isExpression(moduleSpecifier)) &&
@@ -173789,14 +173826,14 @@ var ts;
173789
173826
  0: function (_a) {
173790
173827
  var modifiers = _a[1], importClause = _a[2], moduleSpecifier = _a[3], assertClause = _a[4], other = _a[5];
173791
173828
  return (other === undefined) &&
173792
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173829
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173793
173830
  (importClause === undefined || !ts.isArray(importClause)) &&
173794
173831
  (moduleSpecifier === undefined || ts.isExpression(moduleSpecifier)) &&
173795
173832
  (assertClause === undefined || ts.isAssertClause(assertClause));
173796
173833
  },
173797
173834
  1: function (_a) {
173798
173835
  var decorators = _a[1], modifiers = _a[2], importClause = _a[3], moduleSpecifier = _a[4], assertClause = _a[5];
173799
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173836
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173800
173837
  (modifiers === undefined || ts.isArray(modifiers)) &&
173801
173838
  (importClause === undefined || ts.isImportClause(importClause)) &&
173802
173839
  (moduleSpecifier !== undefined && ts.isExpression(moduleSpecifier)) &&
@@ -173820,13 +173857,13 @@ var ts;
173820
173857
  0: function (_a) {
173821
173858
  var modifiers = _a[0], isExportEquals = _a[1], expression = _a[2], other = _a[3];
173822
173859
  return (other === undefined) &&
173823
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173860
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173824
173861
  (isExportEquals === undefined || typeof isExportEquals === "boolean") &&
173825
173862
  (typeof expression === "object");
173826
173863
  },
173827
173864
  1: function (_a) {
173828
173865
  var decorators = _a[0], modifiers = _a[1], isExportEquals = _a[2], expression = _a[3];
173829
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173866
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173830
173867
  (modifiers === undefined || ts.isArray(modifiers)) &&
173831
173868
  (isExportEquals === undefined || typeof isExportEquals === "boolean") &&
173832
173869
  (expression !== undefined && ts.isExpression(expression));
@@ -173849,12 +173886,12 @@ var ts;
173849
173886
  0: function (_a) {
173850
173887
  var modifiers = _a[1], expression = _a[2], other = _a[3];
173851
173888
  return (other === undefined) &&
173852
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173889
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173853
173890
  (expression !== undefined && !ts.isArray(expression));
173854
173891
  },
173855
173892
  1: function (_a) {
173856
173893
  var decorators = _a[1], modifiers = _a[2], expression = _a[3];
173857
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173894
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173858
173895
  (modifiers === undefined || ts.isArray(modifiers)) &&
173859
173896
  (expression !== undefined && ts.isExpression(expression));
173860
173897
  },
@@ -173876,7 +173913,7 @@ var ts;
173876
173913
  0: function (_a) {
173877
173914
  var modifiers = _a[0], isTypeOnly = _a[1], exportClause = _a[2], moduleSpecifier = _a[3], assertClause = _a[4], other = _a[5];
173878
173915
  return (other === undefined) &&
173879
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173916
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173880
173917
  (typeof isTypeOnly === "boolean") &&
173881
173918
  (typeof exportClause !== "boolean") &&
173882
173919
  (moduleSpecifier === undefined || ts.isExpression(moduleSpecifier)) &&
@@ -173884,7 +173921,7 @@ var ts;
173884
173921
  },
173885
173922
  1: function (_a) {
173886
173923
  var decorators = _a[0], modifiers = _a[1], isTypeOnly = _a[2], exportClause = _a[3], moduleSpecifier = _a[4], assertClause = _a[5];
173887
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173924
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173888
173925
  (modifiers === undefined || ts.isArray(modifiers)) &&
173889
173926
  (typeof isTypeOnly === "boolean") &&
173890
173927
  (exportClause === undefined || ts.isNamedExportBindings(exportClause)) &&
@@ -173909,7 +173946,7 @@ var ts;
173909
173946
  0: function (_a) {
173910
173947
  var modifiers = _a[1], isTypeOnly = _a[2], exportClause = _a[3], moduleSpecifier = _a[4], assertClause = _a[5], other = _a[6];
173911
173948
  return (other === undefined) &&
173912
- (modifiers === undefined || ts.isArrayOf(modifiers, ts.isModifier)) &&
173949
+ (modifiers === undefined || ts.every(modifiers, ts.isModifier)) &&
173913
173950
  (typeof isTypeOnly === "boolean") &&
173914
173951
  (typeof exportClause !== "boolean") &&
173915
173952
  (moduleSpecifier === undefined || ts.isExpression(moduleSpecifier)) &&
@@ -173917,7 +173954,7 @@ var ts;
173917
173954
  },
173918
173955
  1: function (_a) {
173919
173956
  var decorators = _a[1], modifiers = _a[2], isTypeOnly = _a[3], exportClause = _a[4], moduleSpecifier = _a[5], assertClause = _a[6];
173920
- return (decorators === undefined || ts.isArrayOf(decorators, ts.isDecorator)) &&
173957
+ return (decorators === undefined || ts.every(decorators, ts.isDecorator)) &&
173921
173958
  (modifiers === undefined || ts.isArray(modifiers)) &&
173922
173959
  (typeof isTypeOnly === "boolean") &&
173923
173960
  (exportClause === undefined || ts.isNamedExportBindings(exportClause)) &&