@typescript-deploys/pr-build 5.1.0-pr-53192-9 → 5.1.0-pr-51837-45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.1";
26
- var version = `${versionMajorMinor}.0-insiders.20230310`;
26
+ var version = `${versionMajorMinor}.0-insiders.20230311`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -1306,7 +1306,7 @@ function trimEndImpl(s) {
1306
1306
  return s.slice(0, end + 1);
1307
1307
  }
1308
1308
  function isNodeLikeSystem() {
1309
- return typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object";
1309
+ return typeof process !== "undefined" && !!process.nextTick && !process.browser && typeof module === "object";
1310
1310
  }
1311
1311
 
1312
1312
  // src/compiler/debug.ts
@@ -3743,7 +3743,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3743
3743
  TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
3744
3744
  TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
3745
3745
  TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
3746
- TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
3746
+ TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323363] = "NotPrimitiveUnion";
3747
3747
  return TypeFlags2;
3748
3748
  })(TypeFlags || {});
3749
3749
  var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
@@ -4914,7 +4914,7 @@ var sys = (() => {
4914
4914
  getAccessibleSortedChildDirectories: (path) => getAccessibleFileSystemEntries(path).directories,
4915
4915
  realpath,
4916
4916
  tscWatchFile: process.env.TSC_WATCHFILE,
4917
- useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
4917
+ useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
4918
4918
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
4919
4919
  inodeWatching: isLinuxOrMacOs,
4920
4920
  sysLog
@@ -5000,8 +5000,10 @@ var sys = (() => {
5000
5000
  process.stdout.write("\x1Bc");
5001
5001
  },
5002
5002
  setBlocking: () => {
5003
- if (process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) {
5004
- process.stdout._handle.setBlocking(true);
5003
+ var _a2;
5004
+ const handle = (_a2 = process.stdout) == null ? void 0 : _a2._handle;
5005
+ if (handle && handle.setBlocking) {
5006
+ handle.setBlocking(true);
5005
5007
  }
5006
5008
  },
5007
5009
  bufferFrom,
@@ -5787,7 +5789,6 @@ var Diagnostics = {
5787
5789
  _0_modifier_cannot_appear_on_an_index_signature: diag(1071, 1 /* Error */, "_0_modifier_cannot_appear_on_an_index_signature_1071", "'{0}' modifier cannot appear on an index signature."),
5788
5790
  A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, 1 /* Error */, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."),
5789
5791
  Invalid_reference_directive_syntax: diag(1084, 1 /* Error */, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."),
5790
- Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, 1 /* Error */, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."),
5791
5792
  _0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, 1 /* Error */, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."),
5792
5793
  _0_modifier_cannot_appear_on_a_parameter: diag(1090, 1 /* Error */, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."),
5793
5794
  Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, 1 /* Error */, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."),
@@ -5818,7 +5819,7 @@ var Diagnostics = {
5818
5819
  An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: diag(1118, 1 /* Error */, "An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118", "An object literal cannot have multiple get/set accessors with the same name."),
5819
5820
  An_object_literal_cannot_have_property_and_accessor_with_the_same_name: diag(1119, 1 /* Error */, "An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119", "An object literal cannot have property and accessor with the same name."),
5820
5821
  An_export_assignment_cannot_have_modifiers: diag(1120, 1 /* Error */, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."),
5821
- Octal_literals_are_not_allowed_in_strict_mode: diag(1121, 1 /* Error */, "Octal_literals_are_not_allowed_in_strict_mode_1121", "Octal literals are not allowed in strict mode."),
5822
+ Octal_literals_are_not_allowed_Use_the_syntax_0: diag(1121, 1 /* Error */, "Octal_literals_are_not_allowed_Use_the_syntax_0_1121", "Octal literals are not allowed. Use the syntax '{0}'."),
5822
5823
  Variable_declaration_list_cannot_be_empty: diag(1123, 1 /* Error */, "Variable_declaration_list_cannot_be_empty_1123", "Variable declaration list cannot be empty."),
5823
5824
  Digit_expected: diag(1124, 1 /* Error */, "Digit_expected_1124", "Digit expected."),
5824
5825
  Hexadecimal_digit_expected: diag(1125, 1 /* Error */, "Hexadecimal_digit_expected_1125", "Hexadecimal digit expected."),
@@ -6128,6 +6129,9 @@ var Diagnostics = {
6128
6129
  _0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1484, 1 /* Error */, "_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled_1484", "'{0}' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
6129
6130
  _0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1485, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimMo_1485", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
6130
6131
  Decorator_used_before_export_here: diag(1486, 1 /* Error */, "Decorator_used_before_export_here_1486", "Decorator used before 'export' here."),
6132
+ Octal_escape_sequences_are_not_allowed_Use_the_syntax_0: diag(1487, 1 /* Error */, "Octal_escape_sequences_are_not_allowed_Use_the_syntax_0_1487", "Octal escape sequences are not allowed. Use the syntax '{0}'."),
6133
+ Escape_sequence_0_is_not_allowed: diag(1488, 1 /* Error */, "Escape_sequence_0_is_not_allowed_1488", "Escape sequence '{0}' is not allowed."),
6134
+ Decimals_with_leading_zeros_are_not_allowed: diag(1489, 1 /* Error */, "Decimals_with_leading_zeros_are_not_allowed_1489", "Decimals with leading zeros are not allowed."),
6131
6135
  The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
6132
6136
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
6133
6137
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -7464,8 +7468,6 @@ var Diagnostics = {
7464
7468
  Parameter_modifiers_can_only_be_used_in_TypeScript_files: diag(8012, 1 /* Error */, "Parameter_modifiers_can_only_be_used_in_TypeScript_files_8012", "Parameter modifiers can only be used in TypeScript files."),
7465
7469
  Non_null_assertions_can_only_be_used_in_TypeScript_files: diag(8013, 1 /* Error */, "Non_null_assertions_can_only_be_used_in_TypeScript_files_8013", "Non-null assertions can only be used in TypeScript files."),
7466
7470
  Type_assertion_expressions_can_only_be_used_in_TypeScript_files: diag(8016, 1 /* Error */, "Type_assertion_expressions_can_only_be_used_in_TypeScript_files_8016", "Type assertion expressions can only be used in TypeScript files."),
7467
- Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: diag(8017, 1 /* Error */, "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", "Octal literal types must use ES2015 syntax. Use the syntax '{0}'."),
7468
- Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: diag(8018, 1 /* Error */, "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'."),
7469
7471
  Report_errors_in_js_files: diag(8019, 3 /* Message */, "Report_errors_in_js_files_8019", "Report errors in .js files."),
7470
7472
  JSDoc_types_can_only_be_used_inside_documentation_comments: diag(8020, 1 /* Error */, "JSDoc_types_can_only_be_used_inside_documentation_comments_8020", "JSDoc types can only be used inside documentation comments."),
7471
7473
  JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags: diag(8021, 1 /* Error */, "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021", "JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags."),
@@ -8447,7 +8449,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8447
8449
  isReservedWord: () => token >= 82 /* FirstReservedWord */ && token <= 117 /* LastReservedWord */,
8448
8450
  isUnterminated: () => (tokenFlags & 4 /* Unterminated */) !== 0,
8449
8451
  getCommentDirectives: () => commentDirectives,
8450
- getNumericLiteralFlags: () => tokenFlags & 1008 /* NumericLiteralFlags */,
8452
+ getNumericLiteralFlags: () => tokenFlags & 25584 /* NumericLiteralFlags */,
8451
8453
  getTokenFlags: () => tokenFlags,
8452
8454
  reScanGreaterToken,
8453
8455
  reScanAsteriskEqualsToken,
@@ -8488,11 +8490,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8488
8490
  });
8489
8491
  }
8490
8492
  return scanner;
8491
- function error(message, errPos = pos, length3) {
8493
+ function error(message, errPos = pos, length3, arg0) {
8492
8494
  if (onError) {
8493
8495
  const oldPos = pos;
8494
8496
  pos = errPos;
8495
- onError(message, length3 || 0);
8497
+ onError(message, length3 || 0, arg0);
8496
8498
  pos = oldPos;
8497
8499
  }
8498
8500
  }
@@ -8509,10 +8511,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8509
8511
  allowSeparator = false;
8510
8512
  isPreviousTokenSeparator = true;
8511
8513
  result += text.substring(start2, pos);
8512
- } else if (isPreviousTokenSeparator) {
8513
- error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
8514
8514
  } else {
8515
- error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
8515
+ tokenFlags |= 16384 /* ContainsInvalidSeparator */;
8516
+ if (isPreviousTokenSeparator) {
8517
+ error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
8518
+ } else {
8519
+ error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
8520
+ }
8516
8521
  }
8517
8522
  pos++;
8518
8523
  start2 = pos;
@@ -8527,13 +8532,38 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8527
8532
  break;
8528
8533
  }
8529
8534
  if (text.charCodeAt(pos - 1) === 95 /* _ */) {
8535
+ tokenFlags |= 16384 /* ContainsInvalidSeparator */;
8530
8536
  error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
8531
8537
  }
8532
8538
  return result + text.substring(start2, pos);
8533
8539
  }
8534
8540
  function scanNumber() {
8535
- const start2 = pos;
8536
- const mainFragment = scanNumberFragment();
8541
+ let start2 = pos;
8542
+ let mainFragment;
8543
+ if (text.charCodeAt(pos) === 48 /* _0 */) {
8544
+ pos++;
8545
+ if (text.charCodeAt(pos) === 95 /* _ */) {
8546
+ tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */;
8547
+ error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
8548
+ pos--;
8549
+ mainFragment = scanNumberFragment();
8550
+ } else if (!scanDigits()) {
8551
+ tokenFlags |= 8192 /* ContainsLeadingZero */;
8552
+ mainFragment = "" + +tokenValue;
8553
+ } else if (!tokenValue) {
8554
+ mainFragment = "0";
8555
+ } else {
8556
+ tokenValue = "" + parseInt(tokenValue, 8);
8557
+ tokenFlags |= 32 /* Octal */;
8558
+ const withMinus = token === 40 /* MinusToken */;
8559
+ const literal = (withMinus ? "-" : "") + "0o" + (+tokenValue).toString(8);
8560
+ start2 -= +withMinus;
8561
+ error(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start2, pos - start2, literal);
8562
+ return { type: 8 /* NumericLiteral */, value: tokenValue };
8563
+ }
8564
+ } else {
8565
+ mainFragment = scanNumberFragment();
8566
+ }
8537
8567
  let decimalFragment;
8538
8568
  let scientificFragment;
8539
8569
  if (text.charCodeAt(pos) === 46 /* dot */) {
@@ -8567,6 +8597,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8567
8597
  } else {
8568
8598
  result = text.substring(start2, end2);
8569
8599
  }
8600
+ if (tokenFlags & 8192 /* ContainsLeadingZero */) {
8601
+ error(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start2, end2 - start2);
8602
+ return { type: 8 /* NumericLiteral */, value: "" + +result };
8603
+ }
8570
8604
  if (decimalFragment !== void 0 || tokenFlags & 16 /* Scientific */) {
8571
8605
  checkForIdentifierStartAfterNumericLiteral(start2, decimalFragment === void 0 && !!(tokenFlags & 16 /* Scientific */));
8572
8606
  return {
@@ -8598,12 +8632,17 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8598
8632
  pos = identifierStart;
8599
8633
  }
8600
8634
  }
8601
- function scanOctalDigits() {
8635
+ function scanDigits() {
8602
8636
  const start2 = pos;
8603
- while (isOctalDigit(text.charCodeAt(pos))) {
8637
+ let isOctal = true;
8638
+ while (isDigit(text.charCodeAt(pos))) {
8639
+ if (!isOctalDigit(text.charCodeAt(pos))) {
8640
+ isOctal = false;
8641
+ }
8604
8642
  pos++;
8605
8643
  }
8606
- return +text.substring(start2, pos);
8644
+ tokenValue = text.substring(start2, pos);
8645
+ return isOctal;
8607
8646
  }
8608
8647
  function scanExactNumberOfHexDigits(count, canHaveSeparators) {
8609
8648
  const valueString = scanHexDigits(
@@ -8681,7 +8720,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8681
8720
  }
8682
8721
  if (ch === 92 /* backslash */ && !jsxAttributeString) {
8683
8722
  result += text.substring(start2, pos);
8684
- result += scanEscapeSequence();
8723
+ result += scanEscapeSequence(
8724
+ /*shouldEmitInvalidEscapeError*/
8725
+ true
8726
+ );
8685
8727
  start2 = pos;
8686
8728
  continue;
8687
8729
  }
@@ -8695,7 +8737,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8695
8737
  }
8696
8738
  return result;
8697
8739
  }
8698
- function scanTemplateAndSetTokenValue(isTaggedTemplate) {
8740
+ function scanTemplateAndSetTokenValue(shouldEmitInvalidEscapeError) {
8699
8741
  const startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */;
8700
8742
  pos++;
8701
8743
  let start2 = pos;
@@ -8724,7 +8766,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8724
8766
  }
8725
8767
  if (currChar === 92 /* backslash */) {
8726
8768
  contents += text.substring(start2, pos);
8727
- contents += scanEscapeSequence(isTaggedTemplate);
8769
+ contents += scanEscapeSequence(shouldEmitInvalidEscapeError);
8728
8770
  start2 = pos;
8729
8771
  continue;
8730
8772
  }
@@ -8744,7 +8786,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8744
8786
  tokenValue = contents;
8745
8787
  return resultingToken;
8746
8788
  }
8747
- function scanEscapeSequence(isTaggedTemplate) {
8789
+ function scanEscapeSequence(shouldEmitInvalidEscapeError) {
8748
8790
  const start2 = pos;
8749
8791
  pos++;
8750
8792
  if (pos >= end) {
@@ -8755,12 +8797,37 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8755
8797
  pos++;
8756
8798
  switch (ch) {
8757
8799
  case 48 /* _0 */:
8758
- if (isTaggedTemplate && pos < end && isDigit(text.charCodeAt(pos))) {
8800
+ if (pos >= end || !isDigit(text.charCodeAt(pos))) {
8801
+ return "\0";
8802
+ }
8803
+ case 49 /* _1 */:
8804
+ case 50 /* _2 */:
8805
+ case 51 /* _3 */:
8806
+ if (pos < end && isOctalDigit(text.charCodeAt(pos))) {
8807
+ pos++;
8808
+ }
8809
+ case 52 /* _4 */:
8810
+ case 53 /* _5 */:
8811
+ case 54 /* _6 */:
8812
+ case 55 /* _7 */:
8813
+ if (pos < end && isOctalDigit(text.charCodeAt(pos))) {
8759
8814
  pos++;
8760
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8761
- return text.substring(start2, pos);
8762
8815
  }
8763
- return "\0";
8816
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8817
+ if (shouldEmitInvalidEscapeError) {
8818
+ const code = parseInt(text.substring(start2 + 1, pos), 8);
8819
+ error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + padLeft(code.toString(16), 2, "0"));
8820
+ return String.fromCharCode(code);
8821
+ }
8822
+ return text.substring(start2, pos);
8823
+ case 56 /* _8 */:
8824
+ case 57 /* _9 */:
8825
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8826
+ if (shouldEmitInvalidEscapeError) {
8827
+ error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
8828
+ return String.fromCharCode(ch);
8829
+ }
8830
+ return text.substring(start2, pos);
8764
8831
  case 98 /* b */:
8765
8832
  return "\b";
8766
8833
  case 116 /* t */:
@@ -8778,59 +8845,69 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8778
8845
  case 34 /* doubleQuote */:
8779
8846
  return '"';
8780
8847
  case 117 /* u */:
8781
- if (isTaggedTemplate) {
8782
- for (let escapePos = pos; escapePos < pos + 4; escapePos++) {
8783
- if (escapePos < end && !isHexDigit(text.charCodeAt(escapePos)) && text.charCodeAt(escapePos) !== 123 /* openBrace */) {
8784
- pos = escapePos;
8785
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8786
- return text.substring(start2, pos);
8787
- }
8788
- }
8789
- }
8790
8848
  if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
8791
8849
  pos++;
8792
- if (isTaggedTemplate && !isHexDigit(text.charCodeAt(pos))) {
8850
+ const escapedValueString = scanMinimumNumberOfHexDigits(
8851
+ 1,
8852
+ /*canHaveSeparators*/
8853
+ false
8854
+ );
8855
+ const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8856
+ if (escapedValue < 0) {
8857
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8858
+ if (shouldEmitInvalidEscapeError) {
8859
+ error(Diagnostics.Hexadecimal_digit_expected);
8860
+ }
8861
+ return text.substring(start2, pos);
8862
+ }
8863
+ if (!isCodePoint(escapedValue)) {
8793
8864
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8865
+ if (shouldEmitInvalidEscapeError) {
8866
+ error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
8867
+ }
8794
8868
  return text.substring(start2, pos);
8795
8869
  }
8796
- if (isTaggedTemplate) {
8797
- const savePos = pos;
8798
- const escapedValueString = scanMinimumNumberOfHexDigits(
8799
- 1,
8800
- /*canHaveSeparators*/
8801
- false
8802
- );
8803
- const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8804
- if (!isCodePoint(escapedValue) || text.charCodeAt(pos) !== 125 /* closeBrace */) {
8805
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8806
- return text.substring(start2, pos);
8807
- } else {
8808
- pos = savePos;
8870
+ if (pos >= end) {
8871
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8872
+ if (shouldEmitInvalidEscapeError) {
8873
+ error(Diagnostics.Unexpected_end_of_text);
8874
+ }
8875
+ return text.substring(start2, pos);
8876
+ }
8877
+ if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
8878
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8879
+ if (shouldEmitInvalidEscapeError) {
8880
+ error(Diagnostics.Unterminated_Unicode_escape_sequence);
8809
8881
  }
8882
+ return text.substring(start2, pos);
8810
8883
  }
8884
+ pos++;
8811
8885
  tokenFlags |= 8 /* ExtendedUnicodeEscape */;
8812
- return scanExtendedUnicodeEscape();
8886
+ return utf16EncodeAsString(escapedValue);
8813
8887
  }
8814
- tokenFlags |= 1024 /* UnicodeEscape */;
8815
- return scanHexadecimalEscape(
8816
- /*numDigits*/
8817
- 4
8818
- );
8819
- case 120 /* x */:
8820
- if (isTaggedTemplate) {
8821
- if (!isHexDigit(text.charCodeAt(pos))) {
8888
+ for (; pos < start2 + 6; pos++) {
8889
+ if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8822
8890
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8891
+ if (shouldEmitInvalidEscapeError) {
8892
+ error(Diagnostics.Hexadecimal_digit_expected);
8893
+ }
8823
8894
  return text.substring(start2, pos);
8824
- } else if (!isHexDigit(text.charCodeAt(pos + 1))) {
8825
- pos++;
8895
+ }
8896
+ }
8897
+ tokenFlags |= 1024 /* UnicodeEscape */;
8898
+ return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
8899
+ case 120 /* x */:
8900
+ for (; pos < start2 + 4; pos++) {
8901
+ if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8826
8902
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8903
+ if (shouldEmitInvalidEscapeError) {
8904
+ error(Diagnostics.Hexadecimal_digit_expected);
8905
+ }
8827
8906
  return text.substring(start2, pos);
8828
8907
  }
8829
8908
  }
8830
- return scanHexadecimalEscape(
8831
- /*numDigits*/
8832
- 2
8833
- );
8909
+ tokenFlags |= 4096 /* HexEscape */;
8910
+ return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
8834
8911
  case 13 /* carriageReturn */:
8835
8912
  if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) {
8836
8913
  pos++;
@@ -8843,19 +8920,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8843
8920
  return String.fromCharCode(ch);
8844
8921
  }
8845
8922
  }
8846
- function scanHexadecimalEscape(numDigits) {
8847
- const escapedValue = scanExactNumberOfHexDigits(
8848
- numDigits,
8849
- /*canHaveSeparators*/
8850
- false
8851
- );
8852
- if (escapedValue >= 0) {
8853
- return String.fromCharCode(escapedValue);
8854
- } else {
8855
- error(Diagnostics.Hexadecimal_digit_expected);
8856
- return "";
8857
- }
8858
- }
8859
8923
  function scanExtendedUnicodeEscape() {
8860
8924
  const escapedValueString = scanMinimumNumberOfHexDigits(
8861
8925
  1,
@@ -9084,7 +9148,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9084
9148
  return token = 10 /* StringLiteral */;
9085
9149
  case 96 /* backtick */:
9086
9150
  return token = scanTemplateAndSetTokenValue(
9087
- /* isTaggedTemplate */
9151
+ /*shouldEmitInvalidEscapeError*/
9088
9152
  false
9089
9153
  );
9090
9154
  case 37 /* percent */:
@@ -9259,11 +9323,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9259
9323
  tokenFlags |= 256 /* OctalSpecifier */;
9260
9324
  return token = checkBigIntSuffix();
9261
9325
  }
9262
- if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) {
9263
- tokenValue = "" + scanOctalDigits();
9264
- tokenFlags |= 32 /* Octal */;
9265
- return token = 8 /* NumericLiteral */;
9266
- }
9267
9326
  case 49 /* _1 */:
9268
9327
  case 50 /* _2 */:
9269
9328
  case 51 /* _3 */:
@@ -9580,14 +9639,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9580
9639
  return void 0;
9581
9640
  }
9582
9641
  function reScanTemplateToken(isTaggedTemplate) {
9583
- Debug.assert(token === 19 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'");
9584
9642
  pos = tokenStart;
9585
- return token = scanTemplateAndSetTokenValue(isTaggedTemplate);
9643
+ return token = scanTemplateAndSetTokenValue(!isTaggedTemplate);
9586
9644
  }
9587
9645
  function reScanTemplateHeadOrNoSubstitutionTemplate() {
9588
9646
  pos = tokenStart;
9589
9647
  return token = scanTemplateAndSetTokenValue(
9590
- /* isTaggedTemplate */
9648
+ /*shouldEmitInvalidEscapeError*/
9591
9649
  true
9592
9650
  );
9593
9651
  }
@@ -12077,8 +12135,13 @@ function canUseOriginalText(node, flags) {
12077
12135
  if (nodeIsSynthesized(node) || !node.parent || flags & 4 /* TerminateUnterminatedLiterals */ && node.isUnterminated) {
12078
12136
  return false;
12079
12137
  }
12080
- if (isNumericLiteral(node) && node.numericLiteralFlags & 512 /* ContainsSeparator */) {
12081
- return !!(flags & 8 /* AllowNumericSeparator */);
12138
+ if (isNumericLiteral(node)) {
12139
+ if (node.numericLiteralFlags & 26656 /* IsInvalid */) {
12140
+ return false;
12141
+ }
12142
+ if (node.numericLiteralFlags & 512 /* ContainsSeparator */) {
12143
+ return !!(flags & 8 /* AllowNumericSeparator */);
12144
+ }
12082
12145
  }
12083
12146
  return !isBigIntLiteral(node);
12084
12147
  }
@@ -12595,15 +12658,6 @@ function isPartOfTypeNode(node) {
12595
12658
  }
12596
12659
  return false;
12597
12660
  }
12598
- function isChildOfNodeWithKind(node, kind) {
12599
- while (node) {
12600
- if (node.kind === kind) {
12601
- return true;
12602
- }
12603
- node = node.parent;
12604
- }
12605
- return false;
12606
- }
12607
12661
  function forEachReturnStatement(body, visitor) {
12608
12662
  return traverse(body);
12609
12663
  function traverse(node) {
@@ -19853,7 +19907,7 @@ function createNodeFactory(flags, baseFactory2) {
19853
19907
  return node.head !== head || node.templateSpans !== templateSpans ? update(createTemplateExpression(head, templateSpans), node) : node;
19854
19908
  }
19855
19909
  function checkTemplateLiteralLikeNode(kind, text, rawText, templateFlags = 0 /* None */) {
19856
- Debug.assert(!(templateFlags & ~2048 /* TemplateLiteralLikeFlags */), "Unsupported template flags.");
19910
+ Debug.assert(!(templateFlags & ~7176 /* TemplateLiteralLikeFlags */), "Unsupported template flags.");
19857
19911
  let cooked = void 0;
19858
19912
  if (rawText !== void 0 && rawText !== text) {
19859
19913
  cooked = getCookedText(kind, rawText);
@@ -19882,7 +19936,7 @@ function createNodeFactory(flags, baseFactory2) {
19882
19936
  const node = createBaseToken(kind);
19883
19937
  node.text = text;
19884
19938
  node.rawText = rawText;
19885
- node.templateFlags = templateFlags & 2048 /* TemplateLiteralLikeFlags */;
19939
+ node.templateFlags = templateFlags & 7176 /* TemplateLiteralLikeFlags */;
19886
19940
  node.transformFlags = getTransformFlagsOfTemplateLiteralLike(node.templateFlags);
19887
19941
  return node;
19888
19942
  }
@@ -19890,7 +19944,7 @@ function createNodeFactory(flags, baseFactory2) {
19890
19944
  const node = createBaseDeclaration(kind);
19891
19945
  node.text = text;
19892
19946
  node.rawText = rawText;
19893
- node.templateFlags = templateFlags & 2048 /* TemplateLiteralLikeFlags */;
19947
+ node.templateFlags = templateFlags & 7176 /* TemplateLiteralLikeFlags */;
19894
19948
  node.transformFlags = getTransformFlagsOfTemplateLiteralLike(node.templateFlags);
19895
19949
  return node;
19896
19950
  }
@@ -26557,8 +26611,8 @@ var Parser;
26557
26611
  function parseErrorAtRange(range, message, arg0) {
26558
26612
  parseErrorAt(range.pos, range.end, message, arg0);
26559
26613
  }
26560
- function scanError(message, length2) {
26561
- parseErrorAtPosition(scanner.getTokenEnd(), length2, message);
26614
+ function scanError(message, length2, arg0) {
26615
+ parseErrorAtPosition(scanner.getTokenEnd(), length2, message, arg0);
26562
26616
  }
26563
26617
  function getNodePos() {
26564
26618
  return scanner.getTokenFullStart();
@@ -26597,9 +26651,6 @@ var Parser;
26597
26651
  function reScanTemplateToken(isTaggedTemplate) {
26598
26652
  return currentToken = scanner.reScanTemplateToken(isTaggedTemplate);
26599
26653
  }
26600
- function reScanTemplateHeadOrNoSubstitutionTemplate() {
26601
- return currentToken = scanner.reScanTemplateHeadOrNoSubstitutionTemplate();
26602
- }
26603
26654
  function reScanLessThanToken() {
26604
26655
  return currentToken = scanner.reScanLessThanToken();
26605
26656
  }
@@ -27666,8 +27717,11 @@ var Parser;
27666
27717
  return parseLiteralLikeNode(token());
27667
27718
  }
27668
27719
  function parseTemplateHead(isTaggedTemplate) {
27669
- if (isTaggedTemplate) {
27670
- reScanTemplateHeadOrNoSubstitutionTemplate();
27720
+ if (!isTaggedTemplate && scanner.getTokenFlags() & 26656 /* IsInvalid */) {
27721
+ reScanTemplateToken(
27722
+ /*isTaggedTemplate*/
27723
+ false
27724
+ );
27671
27725
  }
27672
27726
  const fragment = parseLiteralLikeNode(token());
27673
27727
  Debug.assert(fragment.kind === 15 /* TemplateHead */, "Template head has wrong token kind");
@@ -27685,8 +27739,7 @@ var Parser;
27685
27739
  }
27686
27740
  function parseLiteralLikeNode(kind) {
27687
27741
  const pos = getNodePos();
27688
- const node = isTemplateLiteralKind(kind) ? factory2.createTemplateLiteralLikeNode(kind, scanner.getTokenValue(), getTemplateLiteralRawText(kind), scanner.getTokenFlags() & 2048 /* TemplateLiteralLikeFlags */) : (
27689
- // Octal literals are not allowed in strict mode or ES5
27742
+ const node = isTemplateLiteralKind(kind) ? factory2.createTemplateLiteralLikeNode(kind, scanner.getTokenValue(), getTemplateLiteralRawText(kind), scanner.getTokenFlags() & 7176 /* TemplateLiteralLikeFlags */) : (
27690
27743
  // Note that theoretically the following condition would hold true literals like 009,
27691
27744
  // which is not octal. But because of how the scanner separates the tokens, we would
27692
27745
  // never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
@@ -29741,7 +29794,10 @@ var Parser;
29741
29794
  const tagExpression = factory2.createTaggedTemplateExpression(
29742
29795
  tag,
29743
29796
  typeArguments,
29744
- token() === 14 /* NoSubstitutionTemplateLiteral */ ? (reScanTemplateHeadOrNoSubstitutionTemplate(), parseLiteralNode()) : parseTemplateExpression(
29797
+ token() === 14 /* NoSubstitutionTemplateLiteral */ ? (reScanTemplateToken(
29798
+ /*isTaggedTemplate*/
29799
+ true
29800
+ ), parseLiteralNode()) : parseTemplateExpression(
29745
29801
  /*isTaggedTemplate*/
29746
29802
  true
29747
29803
  )
@@ -29829,10 +29885,16 @@ var Parser;
29829
29885
  }
29830
29886
  function parsePrimaryExpression() {
29831
29887
  switch (token()) {
29888
+ case 14 /* NoSubstitutionTemplateLiteral */:
29889
+ if (scanner.getTokenFlags() & 26656 /* IsInvalid */) {
29890
+ reScanTemplateToken(
29891
+ /*isTaggedTemplate*/
29892
+ false
29893
+ );
29894
+ }
29832
29895
  case 8 /* NumericLiteral */:
29833
29896
  case 9 /* BigIntLiteral */:
29834
29897
  case 10 /* StringLiteral */:
29835
- case 14 /* NoSubstitutionTemplateLiteral */:
29836
29898
  return parseLiteralNode();
29837
29899
  case 109 /* ThisKeyword */:
29838
29900
  case 107 /* SuperKeyword */:
@@ -36574,6 +36636,10 @@ function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
36574
36636
  originalPath: pathsAreEqual ? void 0 : fileName
36575
36637
  };
36576
36638
  }
36639
+ function getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState) {
36640
+ const nameForLookup = endsWith(typeRoot, "/node_modules/@types") || endsWith(typeRoot, "/node_modules/@types/") ? mangleScopedPackageNameWithTrace(typeReferenceDirectiveName, moduleResolutionState) : typeReferenceDirectiveName;
36641
+ return combinePaths(typeRoot, nameForLookup);
36642
+ }
36577
36643
  function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
36578
36644
  Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
36579
36645
  const traceEnabled = isTraceEnabled(options, host);
@@ -36692,7 +36758,7 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
36692
36758
  trace(host, Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
36693
36759
  }
36694
36760
  return firstDefined(typeRoots, (typeRoot) => {
36695
- const candidate = combinePaths(typeRoot, typeReferenceDirectiveName);
36761
+ const candidate = getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState);
36696
36762
  const directoryExists = directoryProbablyExists(typeRoot, host);
36697
36763
  if (!directoryExists && traceEnabled) {
36698
36764
  trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
@@ -38678,7 +38744,7 @@ function resolveFromTypeRoot(moduleName, state) {
38678
38744
  if (!state.compilerOptions.typeRoots)
38679
38745
  return;
38680
38746
  for (const typeRoot of state.compilerOptions.typeRoots) {
38681
- const candidate = combinePaths(typeRoot, moduleName);
38747
+ const candidate = getCandidateFromTypeRoot(typeRoot, moduleName, state);
38682
38748
  const directoryExists = directoryProbablyExists(typeRoot, state.host);
38683
38749
  if (!directoryExists && state.traceEnabled) {
38684
38750
  trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
@@ -40550,11 +40616,6 @@ function createBinder() {
40550
40616
  }
40551
40617
  }
40552
40618
  }
40553
- function checkStrictModeNumericLiteral(node) {
40554
- if (languageVersion < 1 /* ES5 */ && inStrictMode && node.numericLiteralFlags & 32 /* Octal */) {
40555
- file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode));
40556
- }
40557
- }
40558
40619
  function checkStrictModePostfixUnaryExpression(node) {
40559
40620
  if (inStrictMode) {
40560
40621
  checkStrictModeEvalOrArguments(node, node.operand);
@@ -40746,8 +40807,6 @@ function createBinder() {
40746
40807
  return checkStrictModeCatchClause(node);
40747
40808
  case 218 /* DeleteExpression */:
40748
40809
  return checkStrictModeDeleteExpression(node);
40749
- case 8 /* NumericLiteral */:
40750
- return checkStrictModeNumericLiteral(node);
40751
40810
  case 223 /* PostfixUnaryExpression */:
40752
40811
  return checkStrictModePostfixUnaryExpression(node);
40753
40812
  case 222 /* PrefixUnaryExpression */:
@@ -55995,7 +56054,7 @@ function createTypeChecker(host) {
55995
56054
  origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes);
55996
56055
  }
55997
56056
  }
55998
- const objectFlags = (includes & 36323331 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0);
56057
+ const objectFlags = (includes & 36323363 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0);
55999
56058
  return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
56000
56059
  }
56001
56060
  function getUnionOrIntersectionTypePredicate(signatures, kind) {
@@ -56120,7 +56179,7 @@ function createTypeChecker(host) {
56120
56179
  function eachUnionContains(unionTypes2, type) {
56121
56180
  for (const u of unionTypes2) {
56122
56181
  if (!containsType(u.types, type)) {
56123
- const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & (32 /* Enum */ | 256 /* NumberLiteral */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
56182
+ const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
56124
56183
  if (!primitive || !containsType(u.types, primitive)) {
56125
56184
  return false;
56126
56185
  }
@@ -56147,6 +56206,9 @@ function createTypeChecker(host) {
56147
56206
  }
56148
56207
  return false;
56149
56208
  }
56209
+ function eachIsUnionContaining(types, flag) {
56210
+ return every(types, (t) => !!(t.flags & 1048576 /* Union */) && some(t.types, (tt) => !!(tt.flags & flag)));
56211
+ }
56150
56212
  function removeFromEach(types, flag) {
56151
56213
  for (let i = 0; i < types.length; i++) {
56152
56214
  types[i] = filterType(types[i], (t) => !(t.flags & flag));
@@ -56235,11 +56297,11 @@ function createTypeChecker(host) {
56235
56297
  if (includes & 1048576 /* Union */) {
56236
56298
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
56237
56299
  result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
56238
- } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) {
56300
+ } else if (eachIsUnionContaining(typeSet, 32768 /* Undefined */)) {
56239
56301
  const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
56240
56302
  removeFromEach(typeSet, 32768 /* Undefined */);
56241
56303
  result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
56242
- } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
56304
+ } else if (eachIsUnionContaining(typeSet, 65536 /* Null */)) {
56243
56305
  removeFromEach(typeSet, 65536 /* Null */);
56244
56306
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
56245
56307
  } else {
@@ -58642,20 +58704,8 @@ function createTypeChecker(host) {
58642
58704
  return result;
58643
58705
  }
58644
58706
  const moreThanOneRealChildren = length(validChildren) > 1;
58645
- let arrayLikeTargetParts;
58646
- let nonArrayLikeTargetParts;
58647
- const iterableType = getGlobalIterableType(
58648
- /*reportErrors*/
58649
- false
58650
- );
58651
- if (iterableType !== emptyGenericType) {
58652
- const anyIterable = createIterableType(anyType);
58653
- arrayLikeTargetParts = filterType(childrenTargetType, (t) => isTypeAssignableTo(t, anyIterable));
58654
- nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isTypeAssignableTo(t, anyIterable));
58655
- } else {
58656
- arrayLikeTargetParts = filterType(childrenTargetType, isArrayOrTupleLikeType);
58657
- nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isArrayOrTupleLikeType(t));
58658
- }
58707
+ const arrayLikeTargetParts = filterType(childrenTargetType, isAssignableToAvailableAnyIterable);
58708
+ const nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isAssignableToAvailableAnyIterable(t));
58659
58709
  if (moreThanOneRealChildren) {
58660
58710
  if (arrayLikeTargetParts !== neverType) {
58661
58711
  const realSource = createTupleType(checkJsxChildren(containingElement, 0 /* Normal */));
@@ -59779,11 +59829,6 @@ function createTypeChecker(host) {
59779
59829
  if (containsType(targetTypes, source2)) {
59780
59830
  return -1 /* True */;
59781
59831
  }
59782
- if (getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 1024 /* EnumLiteral */) && (source2.flags & (128 /* StringLiteral */ | 512 /* BooleanLiteral */ | 2048 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256 /* NumberLiteral */)) {
59783
- const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType;
59784
- const primitive = source2.flags & 128 /* StringLiteral */ ? stringType : source2.flags & 256 /* NumberLiteral */ ? numberType : source2.flags & 2048 /* BigIntLiteral */ ? bigintType : void 0;
59785
- return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 /* True */ : 0 /* False */;
59786
- }
59787
59832
  const match = getMatchingUnionConstituentForType(target2, source2);
59788
59833
  if (match) {
59789
59834
  const related = isRelatedTo(
@@ -61946,6 +61991,13 @@ function createTypeChecker(host) {
61946
61991
  function isArrayOrTupleLikeType(type) {
61947
61992
  return isArrayLikeType(type) || isTupleLikeType(type);
61948
61993
  }
61994
+ function isAssignableToAvailableAnyIterable(type) {
61995
+ const anyIterable = getGlobalIterableType(
61996
+ /*reportErrors*/
61997
+ false
61998
+ ) !== emptyGenericType && createIterableType(anyType);
61999
+ return anyIterable ? isTypeAssignableTo(type, anyIterable) : isArrayOrTupleLikeType(type);
62000
+ }
61949
62001
  function getTupleElementType(type, index) {
61950
62002
  const propType = getTypeOfPropertyOfType(type, "" + index);
61951
62003
  if (propType) {
@@ -66699,7 +66751,7 @@ function createTypeChecker(host) {
66699
66751
  return void 0;
66700
66752
  }
66701
66753
  function getContextualTypeForElementExpression(arrayContextualType, index) {
66702
- return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
66754
+ return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(filterType(arrayContextualType, (t) => !!getIndexTypeOfType(t, numberType) || isAssignableToAvailableAnyIterable(t)), "" + index) || mapType(
66703
66755
  arrayContextualType,
66704
66756
  (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
66705
66757
  t,
@@ -82552,25 +82604,6 @@ function createTypeChecker(host) {
82552
82604
  return false;
82553
82605
  }
82554
82606
  function checkGrammarNumericLiteral(node) {
82555
- if (node.numericLiteralFlags & 32 /* Octal */) {
82556
- let diagnosticMessage;
82557
- if (languageVersion >= 1 /* ES5 */) {
82558
- diagnosticMessage = Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0;
82559
- } else if (isChildOfNodeWithKind(node, 199 /* LiteralType */)) {
82560
- diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
82561
- } else if (isChildOfNodeWithKind(node, 303 /* EnumMember */)) {
82562
- diagnosticMessage = Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0;
82563
- }
82564
- if (diagnosticMessage) {
82565
- const withMinus = isPrefixUnaryExpression(node.parent) && node.parent.operator === 40 /* MinusToken */;
82566
- const literal = (withMinus ? "-" : "") + "0o" + node.text;
82567
- return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal);
82568
- }
82569
- }
82570
- checkNumericLiteralValueSize(node);
82571
- return false;
82572
- }
82573
- function checkNumericLiteralValueSize(node) {
82574
82607
  const isFractional = getTextOfNode(node).indexOf(".") !== -1;
82575
82608
  const isScientific = node.numericLiteralFlags & 16 /* Scientific */;
82576
82609
  if (isFractional || isScientific) {
@@ -85509,7 +85542,7 @@ function processTaggedTemplateExpression(context, node, visitor, currentSourceFi
85509
85542
  );
85510
85543
  }
85511
85544
  function createTemplateCooked(factory2, template) {
85512
- return template.templateFlags ? factory2.createVoidZero() : factory2.createStringLiteral(template.text);
85545
+ return template.templateFlags & 26656 /* IsInvalid */ ? factory2.createVoidZero() : factory2.createStringLiteral(template.text);
85513
85546
  }
85514
85547
  function getRawLiteral(factory2, node, currentSourceFile) {
85515
85548
  let text = node.rawText;
@@ -108678,7 +108711,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108678
108711
  /*jsxAttributeEscape*/
108679
108712
  false
108680
108713
  );
108681
- return !expression.numericLiteralFlags && !stringContains(text, tokenToString(24 /* DotToken */));
108714
+ return !(expression.numericLiteralFlags & 448 /* WithSpecifier */) && !stringContains(text, tokenToString(24 /* DotToken */)) && !stringContains(text, String.fromCharCode(69 /* E */)) && !stringContains(text, String.fromCharCode(101 /* e */));
108682
108715
  } else if (isAccessExpression(expression)) {
108683
108716
  const constantValue = getConstantValue(expression);
108684
108717
  return typeof constantValue === "number" && isFinite(constantValue) && Math.floor(constantValue) === constantValue;
@@ -112926,7 +112959,6 @@ var plainJSErrors = /* @__PURE__ */ new Set([
112926
112959
  Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
112927
112960
  Diagnostics.Invalid_use_of_0_in_strict_mode.code,
112928
112961
  Diagnostics.A_label_is_not_allowed_here.code,
112929
- Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
112930
112962
  Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
112931
112963
  // grammar errors
112932
112964
  Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,