@typescript-deploys/pr-build 5.1.0-pr-53098-13 → 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
@@ -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) {
8793
8857
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8858
+ if (shouldEmitInvalidEscapeError) {
8859
+ error(Diagnostics.Hexadecimal_digit_expected);
8860
+ }
8794
8861
  return text.substring(start2, pos);
8795
8862
  }
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;
8863
+ if (!isCodePoint(escapedValue)) {
8864
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8865
+ if (shouldEmitInvalidEscapeError) {
8866
+ error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
8867
+ }
8868
+ return text.substring(start2, pos);
8869
+ }
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 */:
@@ -42675,7 +42734,6 @@ function createTypeChecker(host) {
42675
42734
  var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
42676
42735
  var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
42677
42736
  var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
42678
- var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
42679
42737
  var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
42680
42738
  var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
42681
42739
  var checkBinaryExpression = createCheckBinaryExpression();
@@ -53944,13 +54002,6 @@ function createTypeChecker(host) {
53944
54002
  function isConflictingPrivateProperty(prop) {
53945
54003
  return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */);
53946
54004
  }
53947
- function isGenericReducibleType(type) {
53948
- return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type));
53949
- }
53950
- function isReducibleIntersection(type) {
53951
- const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
53952
- return getReducedType(uniqueFilled) !== uniqueFilled;
53953
- }
53954
54005
  function elaborateNeverIntersection(errorInfo, type) {
53955
54006
  if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
53956
54007
  const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
@@ -56320,10 +56371,10 @@ function createTypeChecker(host) {
56320
56371
  }
56321
56372
  return links.resolvedType;
56322
56373
  }
56323
- function createIndexType(type, indexFlags) {
56374
+ function createIndexType(type, stringsOnly) {
56324
56375
  const result = createType(4194304 /* Index */);
56325
56376
  result.type = type;
56326
- result.indexFlags = indexFlags;
56377
+ result.stringsOnly = stringsOnly;
56327
56378
  return result;
56328
56379
  }
56329
56380
  function createOriginIndexType(type) {
@@ -56331,23 +56382,31 @@ function createTypeChecker(host) {
56331
56382
  result.type = type;
56332
56383
  return result;
56333
56384
  }
56334
- function getIndexTypeForGenericType(type, indexFlags) {
56335
- return indexFlags & 1 /* StringsOnly */ ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, 1 /* StringsOnly */)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, 0 /* None */));
56385
+ function getIndexTypeForGenericType(type, stringsOnly) {
56386
+ return stringsOnly ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(
56387
+ type,
56388
+ /*stringsOnly*/
56389
+ true
56390
+ )) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(
56391
+ type,
56392
+ /*stringsOnly*/
56393
+ false
56394
+ ));
56336
56395
  }
56337
- function getIndexTypeForMappedType(type, indexFlags) {
56396
+ function getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) {
56338
56397
  const typeParameter = getTypeParameterFromMappedType(type);
56339
56398
  const constraintType = getConstraintTypeFromMappedType(type);
56340
56399
  const nameType = getNameTypeFromMappedType(type.target || type);
56341
- if (!nameType && !(indexFlags & 2 /* NoIndexSignatures */)) {
56400
+ if (!nameType && !noIndexSignatures) {
56342
56401
  return constraintType;
56343
56402
  }
56344
56403
  const keyTypes = [];
56345
56404
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
56346
56405
  if (!isGenericIndexType(constraintType)) {
56347
56406
  const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
56348
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
56407
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, stringsOnly, addMemberForKeyType);
56349
56408
  } else {
56350
- return getIndexTypeForGenericType(type, indexFlags);
56409
+ return getIndexTypeForGenericType(type, stringsOnly);
56351
56410
  }
56352
56411
  } else {
56353
56412
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
@@ -56355,7 +56414,7 @@ function createTypeChecker(host) {
56355
56414
  if (isGenericIndexType(constraintType)) {
56356
56415
  forEachType(constraintType, addMemberForKeyType);
56357
56416
  }
56358
- const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
56417
+ const result = noIndexSignatures ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
56359
56418
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
56360
56419
  return constraintType;
56361
56420
  }
@@ -56408,15 +56467,19 @@ function createTypeChecker(host) {
56408
56467
  origin
56409
56468
  );
56410
56469
  }
56411
- function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
56412
- return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
56470
+ function isPossiblyReducibleByInstantiation(type) {
56471
+ const uniqueFilled = getUniqueLiteralFilledInstantiation(type);
56472
+ return getReducedType(uniqueFilled) !== uniqueFilled;
56473
+ }
56474
+ function shouldDeferIndexType(type) {
56475
+ return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
56413
56476
  }
56414
- function getIndexType(type, indexFlags = defaultIndexFlags) {
56477
+ function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
56415
56478
  type = getReducedType(type);
56416
- return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(
56479
+ return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type, stringsOnly) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, stringsOnly, noIndexSignatures))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, stringsOnly, noIndexSignatures))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(
56417
56480
  type,
56418
- (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
56419
- indexFlags === defaultIndexFlags
56481
+ (noIndexSignatures ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (stringsOnly ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
56482
+ stringsOnly === keyofStringsOnly && !noIndexSignatures
56420
56483
  );
56421
56484
  }
56422
56485
  function getExtractStringType(type) {
@@ -56956,13 +57019,12 @@ function createTypeChecker(host) {
56956
57019
  if (objectType === wildcardType || indexType === wildcardType) {
56957
57020
  return wildcardType;
56958
57021
  }
56959
- objectType = getReducedType(objectType);
56960
57022
  if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
56961
57023
  indexType = stringType;
56962
57024
  }
56963
57025
  if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
56964
57026
  accessFlags |= 1 /* IncludeUndefined */;
56965
- if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) {
57027
+ if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) {
56966
57028
  if (objectType.flags & 3 /* AnyOrUnknown */) {
56967
57029
  return objectType;
56968
57030
  }
@@ -58148,6 +58210,9 @@ function createTypeChecker(host) {
58148
58210
  }
58149
58211
  return type;
58150
58212
  }
58213
+ function getUniqueLiteralFilledInstantiation(type) {
58214
+ return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
58215
+ }
58151
58216
  function getPermissiveInstantiation(type) {
58152
58217
  return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
58153
58218
  }
@@ -58639,20 +58704,8 @@ function createTypeChecker(host) {
58639
58704
  return result;
58640
58705
  }
58641
58706
  const moreThanOneRealChildren = length(validChildren) > 1;
58642
- let arrayLikeTargetParts;
58643
- let nonArrayLikeTargetParts;
58644
- const iterableType = getGlobalIterableType(
58645
- /*reportErrors*/
58646
- false
58647
- );
58648
- if (iterableType !== emptyGenericType) {
58649
- const anyIterable = createIterableType(anyType);
58650
- arrayLikeTargetParts = filterType(childrenTargetType, (t) => isTypeAssignableTo(t, anyIterable));
58651
- nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isTypeAssignableTo(t, anyIterable));
58652
- } else {
58653
- arrayLikeTargetParts = filterType(childrenTargetType, isArrayOrTupleLikeType);
58654
- nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isArrayOrTupleLikeType(t));
58655
- }
58707
+ const arrayLikeTargetParts = filterType(childrenTargetType, isAssignableToAvailableAnyIterable);
58708
+ const nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isAssignableToAvailableAnyIterable(t));
58656
58709
  if (moreThanOneRealChildren) {
58657
58710
  if (arrayLikeTargetParts !== neverType) {
58658
58711
  const realSource = createTupleType(checkJsxChildren(containingElement, 0 /* Normal */));
@@ -60342,7 +60395,7 @@ function createTypeChecker(host) {
60342
60395
  } else {
60343
60396
  const constraint = getSimplifiedTypeOrConstraint(targetType);
60344
60397
  if (constraint) {
60345
- if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
60398
+ if (isRelatedTo(source2, getIndexType(constraint, target2.stringsOnly), 2 /* Target */, reportErrors2) === -1 /* True */) {
60346
60399
  return -1 /* True */;
60347
60400
  }
60348
60401
  } else if (isGenericMappedType(targetType)) {
@@ -60423,7 +60476,13 @@ function createTypeChecker(host) {
60423
60476
  }
60424
60477
  if (!isGenericMappedType(source2)) {
60425
60478
  const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2);
60426
- const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
60479
+ const sourceKeys = getIndexType(
60480
+ source2,
60481
+ /*stringsOnly*/
60482
+ void 0,
60483
+ /*noIndexSignatures*/
60484
+ true
60485
+ );
60427
60486
  const includeOptional = modifiers & 4 /* IncludeOptional */;
60428
60487
  const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
60429
60488
  if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
@@ -61932,6 +61991,13 @@ function createTypeChecker(host) {
61932
61991
  function isArrayOrTupleLikeType(type) {
61933
61992
  return isArrayLikeType(type) || isTupleLikeType(type);
61934
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
+ }
61935
62001
  function getTupleElementType(type, index) {
61936
62002
  const propType = getTypeOfPropertyOfType(type, "" + index);
61937
62003
  if (propType) {
@@ -66685,7 +66751,7 @@ function createTypeChecker(host) {
66685
66751
  return void 0;
66686
66752
  }
66687
66753
  function getContextualTypeForElementExpression(arrayContextualType, index) {
66688
- return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
66754
+ return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(filterType(arrayContextualType, (t) => !!getIndexTypeOfType(t, numberType) || isAssignableToAvailableAnyIterable(t)), "" + index) || mapType(
66689
66755
  arrayContextualType,
66690
66756
  (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
66691
66757
  t,
@@ -74656,7 +74722,11 @@ function createTypeChecker(host) {
74656
74722
  }
74657
74723
  const objectType = type.objectType;
74658
74724
  const indexType = type.indexType;
74659
- if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
74725
+ if (isTypeAssignableTo(indexType, getIndexType(
74726
+ objectType,
74727
+ /*stringsOnly*/
74728
+ false
74729
+ ))) {
74660
74730
  if (accessNode.kind === 210 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
74661
74731
  error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
74662
74732
  }
@@ -82534,25 +82604,6 @@ function createTypeChecker(host) {
82534
82604
  return false;
82535
82605
  }
82536
82606
  function checkGrammarNumericLiteral(node) {
82537
- if (node.numericLiteralFlags & 32 /* Octal */) {
82538
- let diagnosticMessage;
82539
- if (languageVersion >= 1 /* ES5 */) {
82540
- diagnosticMessage = Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0;
82541
- } else if (isChildOfNodeWithKind(node, 199 /* LiteralType */)) {
82542
- diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
82543
- } else if (isChildOfNodeWithKind(node, 303 /* EnumMember */)) {
82544
- diagnosticMessage = Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0;
82545
- }
82546
- if (diagnosticMessage) {
82547
- const withMinus = isPrefixUnaryExpression(node.parent) && node.parent.operator === 40 /* MinusToken */;
82548
- const literal = (withMinus ? "-" : "") + "0o" + node.text;
82549
- return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal);
82550
- }
82551
- }
82552
- checkNumericLiteralValueSize(node);
82553
- return false;
82554
- }
82555
- function checkNumericLiteralValueSize(node) {
82556
82607
  const isFractional = getTextOfNode(node).indexOf(".") !== -1;
82557
82608
  const isScientific = node.numericLiteralFlags & 16 /* Scientific */;
82558
82609
  if (isFractional || isScientific) {
@@ -85491,7 +85542,7 @@ function processTaggedTemplateExpression(context, node, visitor, currentSourceFi
85491
85542
  );
85492
85543
  }
85493
85544
  function createTemplateCooked(factory2, template) {
85494
- return template.templateFlags ? factory2.createVoidZero() : factory2.createStringLiteral(template.text);
85545
+ return template.templateFlags & 26656 /* IsInvalid */ ? factory2.createVoidZero() : factory2.createStringLiteral(template.text);
85495
85546
  }
85496
85547
  function getRawLiteral(factory2, node, currentSourceFile) {
85497
85548
  let text = node.rawText;
@@ -108660,7 +108711,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108660
108711
  /*jsxAttributeEscape*/
108661
108712
  false
108662
108713
  );
108663
- 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 */));
108664
108715
  } else if (isAccessExpression(expression)) {
108665
108716
  const constantValue = getConstantValue(expression);
108666
108717
  return typeof constantValue === "number" && isFinite(constantValue) && Math.floor(constantValue) === constantValue;
@@ -112908,7 +112959,6 @@ var plainJSErrors = /* @__PURE__ */ new Set([
112908
112959
  Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
112909
112960
  Diagnostics.Invalid_use_of_0_in_strict_mode.code,
112910
112961
  Diagnostics.A_label_is_not_allowed_here.code,
112911
- Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
112912
112962
  Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
112913
112963
  // grammar errors
112914
112964
  Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,