typescript 5.1.0-dev.20230324 → 5.1.0-dev.20230325

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.
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.1";
57
- var version = `${versionMajorMinor}.0-dev.20230324`;
57
+ var version = `${versionMajorMinor}.0-dev.20230325`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -5126,7 +5126,6 @@ var Diagnostics = {
5126
5126
  _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."),
5127
5127
  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."),
5128
5128
  Invalid_reference_directive_syntax: diag(1084, 1 /* Error */, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."),
5129
- 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}'."),
5130
5129
  _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."),
5131
5130
  _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."),
5132
5131
  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."),
@@ -5157,7 +5156,7 @@ var Diagnostics = {
5157
5156
  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."),
5158
5157
  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."),
5159
5158
  An_export_assignment_cannot_have_modifiers: diag(1120, 1 /* Error */, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."),
5160
- 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."),
5159
+ 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}'."),
5161
5160
  Variable_declaration_list_cannot_be_empty: diag(1123, 1 /* Error */, "Variable_declaration_list_cannot_be_empty_1123", "Variable declaration list cannot be empty."),
5162
5161
  Digit_expected: diag(1124, 1 /* Error */, "Digit_expected_1124", "Digit expected."),
5163
5162
  Hexadecimal_digit_expected: diag(1125, 1 /* Error */, "Hexadecimal_digit_expected_1125", "Hexadecimal digit expected."),
@@ -5468,6 +5467,9 @@ var Diagnostics = {
5468
5467
  _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."),
5469
5468
  _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."),
5470
5469
  Decorator_used_before_export_here: diag(1486, 1 /* Error */, "Decorator_used_before_export_here_1486", "Decorator used before 'export' here."),
5470
+ 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}'."),
5471
+ Escape_sequence_0_is_not_allowed: diag(1488, 1 /* Error */, "Escape_sequence_0_is_not_allowed_1488", "Escape sequence '{0}' is not allowed."),
5472
+ 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."),
5471
5473
  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."),
5472
5474
  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."),
5473
5475
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -6808,8 +6810,6 @@ var Diagnostics = {
6808
6810
  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."),
6809
6811
  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."),
6810
6812
  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."),
6811
- 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}'."),
6812
- 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}'."),
6813
6813
  Report_errors_in_js_files: diag(8019, 3 /* Message */, "Report_errors_in_js_files_8019", "Report errors in .js files."),
6814
6814
  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."),
6815
6815
  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."),
@@ -7734,7 +7734,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
7734
7734
  isReservedWord: () => token >= 82 /* FirstReservedWord */ && token <= 117 /* LastReservedWord */,
7735
7735
  isUnterminated: () => (tokenFlags & 4 /* Unterminated */) !== 0,
7736
7736
  getCommentDirectives: () => commentDirectives,
7737
- getNumericLiteralFlags: () => tokenFlags & 1008 /* NumericLiteralFlags */,
7737
+ getNumericLiteralFlags: () => tokenFlags & 25584 /* NumericLiteralFlags */,
7738
7738
  getTokenFlags: () => tokenFlags,
7739
7739
  reScanGreaterToken,
7740
7740
  reScanAsteriskEqualsToken,
@@ -7775,11 +7775,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
7775
7775
  });
7776
7776
  }
7777
7777
  return scanner;
7778
- function error(message, errPos = pos, length3) {
7778
+ function error(message, errPos = pos, length3, arg0) {
7779
7779
  if (onError) {
7780
7780
  const oldPos = pos;
7781
7781
  pos = errPos;
7782
- onError(message, length3 || 0);
7782
+ onError(message, length3 || 0, arg0);
7783
7783
  pos = oldPos;
7784
7784
  }
7785
7785
  }
@@ -7796,10 +7796,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
7796
7796
  allowSeparator = false;
7797
7797
  isPreviousTokenSeparator = true;
7798
7798
  result += text.substring(start2, pos);
7799
- } else if (isPreviousTokenSeparator) {
7800
- error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
7801
7799
  } else {
7802
- error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
7800
+ tokenFlags |= 16384 /* ContainsInvalidSeparator */;
7801
+ if (isPreviousTokenSeparator) {
7802
+ error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
7803
+ } else {
7804
+ error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
7805
+ }
7803
7806
  }
7804
7807
  pos++;
7805
7808
  start2 = pos;
@@ -7814,13 +7817,39 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
7814
7817
  break;
7815
7818
  }
7816
7819
  if (text.charCodeAt(pos - 1) === 95 /* _ */) {
7820
+ tokenFlags |= 16384 /* ContainsInvalidSeparator */;
7817
7821
  error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
7818
7822
  }
7819
7823
  return result + text.substring(start2, pos);
7820
7824
  }
7821
7825
  function scanNumber() {
7822
- const start2 = pos;
7823
- const mainFragment = scanNumberFragment();
7826
+ let start2 = pos;
7827
+ let mainFragment;
7828
+ if (text.charCodeAt(pos) === 48 /* _0 */) {
7829
+ pos++;
7830
+ if (text.charCodeAt(pos) === 95 /* _ */) {
7831
+ tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */;
7832
+ error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
7833
+ pos--;
7834
+ mainFragment = scanNumberFragment();
7835
+ } else if (!scanDigits()) {
7836
+ tokenFlags |= 8192 /* ContainsLeadingZero */;
7837
+ mainFragment = "" + +tokenValue;
7838
+ } else if (!tokenValue) {
7839
+ mainFragment = "0";
7840
+ } else {
7841
+ tokenValue = "" + parseInt(tokenValue, 8);
7842
+ tokenFlags |= 32 /* Octal */;
7843
+ const withMinus = token === 40 /* MinusToken */;
7844
+ const literal = (withMinus ? "-" : "") + "0o" + (+tokenValue).toString(8);
7845
+ if (withMinus)
7846
+ start2--;
7847
+ error(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start2, pos - start2, literal);
7848
+ return { type: 8 /* NumericLiteral */, value: tokenValue };
7849
+ }
7850
+ } else {
7851
+ mainFragment = scanNumberFragment();
7852
+ }
7824
7853
  let decimalFragment;
7825
7854
  let scientificFragment;
7826
7855
  if (text.charCodeAt(pos) === 46 /* dot */) {
@@ -7854,6 +7883,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
7854
7883
  } else {
7855
7884
  result = text.substring(start2, end2);
7856
7885
  }
7886
+ if (tokenFlags & 8192 /* ContainsLeadingZero */) {
7887
+ error(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start2, end2 - start2);
7888
+ return { type: 8 /* NumericLiteral */, value: "" + +result };
7889
+ }
7857
7890
  if (decimalFragment !== void 0 || tokenFlags & 16 /* Scientific */) {
7858
7891
  checkForIdentifierStartAfterNumericLiteral(start2, decimalFragment === void 0 && !!(tokenFlags & 16 /* Scientific */));
7859
7892
  return {
@@ -7885,12 +7918,17 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
7885
7918
  pos = identifierStart;
7886
7919
  }
7887
7920
  }
7888
- function scanOctalDigits() {
7921
+ function scanDigits() {
7889
7922
  const start2 = pos;
7890
- while (isOctalDigit(text.charCodeAt(pos))) {
7923
+ let isOctal = true;
7924
+ while (isDigit(text.charCodeAt(pos))) {
7925
+ if (!isOctalDigit(text.charCodeAt(pos))) {
7926
+ isOctal = false;
7927
+ }
7891
7928
  pos++;
7892
7929
  }
7893
- return +text.substring(start2, pos);
7930
+ tokenValue = text.substring(start2, pos);
7931
+ return isOctal;
7894
7932
  }
7895
7933
  function scanExactNumberOfHexDigits(count, canHaveSeparators) {
7896
7934
  const valueString = scanHexDigits(
@@ -7968,7 +8006,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
7968
8006
  }
7969
8007
  if (ch === 92 /* backslash */ && !jsxAttributeString) {
7970
8008
  result += text.substring(start2, pos);
7971
- result += scanEscapeSequence();
8009
+ result += scanEscapeSequence(
8010
+ /*shouldEmitInvalidEscapeError*/
8011
+ true
8012
+ );
7972
8013
  start2 = pos;
7973
8014
  continue;
7974
8015
  }
@@ -7982,7 +8023,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
7982
8023
  }
7983
8024
  return result;
7984
8025
  }
7985
- function scanTemplateAndSetTokenValue(isTaggedTemplate) {
8026
+ function scanTemplateAndSetTokenValue(shouldEmitInvalidEscapeError) {
7986
8027
  const startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */;
7987
8028
  pos++;
7988
8029
  let start2 = pos;
@@ -8011,7 +8052,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8011
8052
  }
8012
8053
  if (currChar === 92 /* backslash */) {
8013
8054
  contents += text.substring(start2, pos);
8014
- contents += scanEscapeSequence(isTaggedTemplate);
8055
+ contents += scanEscapeSequence(shouldEmitInvalidEscapeError);
8015
8056
  start2 = pos;
8016
8057
  continue;
8017
8058
  }
@@ -8031,7 +8072,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8031
8072
  tokenValue = contents;
8032
8073
  return resultingToken;
8033
8074
  }
8034
- function scanEscapeSequence(isTaggedTemplate) {
8075
+ function scanEscapeSequence(shouldEmitInvalidEscapeError) {
8035
8076
  const start2 = pos;
8036
8077
  pos++;
8037
8078
  if (pos >= end) {
@@ -8042,12 +8083,37 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8042
8083
  pos++;
8043
8084
  switch (ch) {
8044
8085
  case 48 /* _0 */:
8045
- if (isTaggedTemplate && pos < end && isDigit(text.charCodeAt(pos))) {
8086
+ if (pos >= end || !isDigit(text.charCodeAt(pos))) {
8087
+ return "\0";
8088
+ }
8089
+ case 49 /* _1 */:
8090
+ case 50 /* _2 */:
8091
+ case 51 /* _3 */:
8092
+ if (pos < end && isOctalDigit(text.charCodeAt(pos))) {
8093
+ pos++;
8094
+ }
8095
+ case 52 /* _4 */:
8096
+ case 53 /* _5 */:
8097
+ case 54 /* _6 */:
8098
+ case 55 /* _7 */:
8099
+ if (pos < end && isOctalDigit(text.charCodeAt(pos))) {
8046
8100
  pos++;
8047
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8048
- return text.substring(start2, pos);
8049
8101
  }
8050
- return "\0";
8102
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8103
+ if (shouldEmitInvalidEscapeError) {
8104
+ const code = parseInt(text.substring(start2 + 1, pos), 8);
8105
+ error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + padLeft(code.toString(16), 2, "0"));
8106
+ return String.fromCharCode(code);
8107
+ }
8108
+ return text.substring(start2, pos);
8109
+ case 56 /* _8 */:
8110
+ case 57 /* _9 */:
8111
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8112
+ if (shouldEmitInvalidEscapeError) {
8113
+ error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
8114
+ return String.fromCharCode(ch);
8115
+ }
8116
+ return text.substring(start2, pos);
8051
8117
  case 98 /* b */:
8052
8118
  return "\b";
8053
8119
  case 116 /* t */:
@@ -8065,59 +8131,69 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8065
8131
  case 34 /* doubleQuote */:
8066
8132
  return '"';
8067
8133
  case 117 /* u */:
8068
- if (isTaggedTemplate) {
8069
- for (let escapePos = pos; escapePos < pos + 4; escapePos++) {
8070
- if (escapePos < end && !isHexDigit(text.charCodeAt(escapePos)) && text.charCodeAt(escapePos) !== 123 /* openBrace */) {
8071
- pos = escapePos;
8072
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8073
- return text.substring(start2, pos);
8074
- }
8075
- }
8076
- }
8077
8134
  if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
8078
8135
  pos++;
8079
- if (isTaggedTemplate && !isHexDigit(text.charCodeAt(pos))) {
8136
+ const escapedValueString = scanMinimumNumberOfHexDigits(
8137
+ 1,
8138
+ /*canHaveSeparators*/
8139
+ false
8140
+ );
8141
+ const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8142
+ if (escapedValue < 0) {
8080
8143
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8144
+ if (shouldEmitInvalidEscapeError) {
8145
+ error(Diagnostics.Hexadecimal_digit_expected);
8146
+ }
8081
8147
  return text.substring(start2, pos);
8082
8148
  }
8083
- if (isTaggedTemplate) {
8084
- const savePos = pos;
8085
- const escapedValueString = scanMinimumNumberOfHexDigits(
8086
- 1,
8087
- /*canHaveSeparators*/
8088
- false
8089
- );
8090
- const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8091
- if (!isCodePoint(escapedValue) || text.charCodeAt(pos) !== 125 /* closeBrace */) {
8092
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8093
- return text.substring(start2, pos);
8094
- } else {
8095
- pos = savePos;
8149
+ if (!isCodePoint(escapedValue)) {
8150
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8151
+ if (shouldEmitInvalidEscapeError) {
8152
+ error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
8153
+ }
8154
+ return text.substring(start2, pos);
8155
+ }
8156
+ if (pos >= end) {
8157
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8158
+ if (shouldEmitInvalidEscapeError) {
8159
+ error(Diagnostics.Unexpected_end_of_text);
8160
+ }
8161
+ return text.substring(start2, pos);
8162
+ }
8163
+ if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
8164
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
8165
+ if (shouldEmitInvalidEscapeError) {
8166
+ error(Diagnostics.Unterminated_Unicode_escape_sequence);
8096
8167
  }
8168
+ return text.substring(start2, pos);
8097
8169
  }
8170
+ pos++;
8098
8171
  tokenFlags |= 8 /* ExtendedUnicodeEscape */;
8099
- return scanExtendedUnicodeEscape();
8172
+ return utf16EncodeAsString(escapedValue);
8100
8173
  }
8101
- tokenFlags |= 1024 /* UnicodeEscape */;
8102
- return scanHexadecimalEscape(
8103
- /*numDigits*/
8104
- 4
8105
- );
8106
- case 120 /* x */:
8107
- if (isTaggedTemplate) {
8108
- if (!isHexDigit(text.charCodeAt(pos))) {
8174
+ for (; pos < start2 + 6; pos++) {
8175
+ if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8109
8176
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8177
+ if (shouldEmitInvalidEscapeError) {
8178
+ error(Diagnostics.Hexadecimal_digit_expected);
8179
+ }
8110
8180
  return text.substring(start2, pos);
8111
- } else if (!isHexDigit(text.charCodeAt(pos + 1))) {
8112
- pos++;
8181
+ }
8182
+ }
8183
+ tokenFlags |= 1024 /* UnicodeEscape */;
8184
+ return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
8185
+ case 120 /* x */:
8186
+ for (; pos < start2 + 4; pos++) {
8187
+ if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8113
8188
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8189
+ if (shouldEmitInvalidEscapeError) {
8190
+ error(Diagnostics.Hexadecimal_digit_expected);
8191
+ }
8114
8192
  return text.substring(start2, pos);
8115
8193
  }
8116
8194
  }
8117
- return scanHexadecimalEscape(
8118
- /*numDigits*/
8119
- 2
8120
- );
8195
+ tokenFlags |= 4096 /* HexEscape */;
8196
+ return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
8121
8197
  case 13 /* carriageReturn */:
8122
8198
  if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) {
8123
8199
  pos++;
@@ -8130,19 +8206,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8130
8206
  return String.fromCharCode(ch);
8131
8207
  }
8132
8208
  }
8133
- function scanHexadecimalEscape(numDigits) {
8134
- const escapedValue = scanExactNumberOfHexDigits(
8135
- numDigits,
8136
- /*canHaveSeparators*/
8137
- false
8138
- );
8139
- if (escapedValue >= 0) {
8140
- return String.fromCharCode(escapedValue);
8141
- } else {
8142
- error(Diagnostics.Hexadecimal_digit_expected);
8143
- return "";
8144
- }
8145
- }
8146
8209
  function scanExtendedUnicodeEscape() {
8147
8210
  const escapedValueString = scanMinimumNumberOfHexDigits(
8148
8211
  1,
@@ -8371,7 +8434,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8371
8434
  return token = 10 /* StringLiteral */;
8372
8435
  case 96 /* backtick */:
8373
8436
  return token = scanTemplateAndSetTokenValue(
8374
- /*isTaggedTemplate*/
8437
+ /*shouldEmitInvalidEscapeError*/
8375
8438
  false
8376
8439
  );
8377
8440
  case 37 /* percent */:
@@ -8546,11 +8609,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8546
8609
  tokenFlags |= 256 /* OctalSpecifier */;
8547
8610
  return token = checkBigIntSuffix();
8548
8611
  }
8549
- if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) {
8550
- tokenValue = "" + scanOctalDigits();
8551
- tokenFlags |= 32 /* Octal */;
8552
- return token = 8 /* NumericLiteral */;
8553
- }
8554
8612
  case 49 /* _1 */:
8555
8613
  case 50 /* _2 */:
8556
8614
  case 51 /* _3 */:
@@ -8867,14 +8925,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8867
8925
  return void 0;
8868
8926
  }
8869
8927
  function reScanTemplateToken(isTaggedTemplate) {
8870
- Debug.assert(token === 19 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'");
8871
8928
  pos = tokenStart;
8872
- return token = scanTemplateAndSetTokenValue(isTaggedTemplate);
8929
+ return token = scanTemplateAndSetTokenValue(!isTaggedTemplate);
8873
8930
  }
8874
8931
  function reScanTemplateHeadOrNoSubstitutionTemplate() {
8875
8932
  pos = tokenStart;
8876
8933
  return token = scanTemplateAndSetTokenValue(
8877
- /*isTaggedTemplate*/
8934
+ /*shouldEmitInvalidEscapeError*/
8878
8935
  true
8879
8936
  );
8880
8937
  }
@@ -14211,7 +14268,7 @@ function createNodeFactory(flags, baseFactory2) {
14211
14268
  return node.head !== head || node.templateSpans !== templateSpans ? update(createTemplateExpression(head, templateSpans), node) : node;
14212
14269
  }
14213
14270
  function checkTemplateLiteralLikeNode(kind, text, rawText, templateFlags = 0 /* None */) {
14214
- Debug.assert(!(templateFlags & ~2048 /* TemplateLiteralLikeFlags */), "Unsupported template flags.");
14271
+ Debug.assert(!(templateFlags & ~7176 /* TemplateLiteralLikeFlags */), "Unsupported template flags.");
14215
14272
  let cooked = void 0;
14216
14273
  if (rawText !== void 0 && rawText !== text) {
14217
14274
  cooked = getCookedText(kind, rawText);
@@ -14240,7 +14297,7 @@ function createNodeFactory(flags, baseFactory2) {
14240
14297
  const node = createBaseToken(kind);
14241
14298
  node.text = text;
14242
14299
  node.rawText = rawText;
14243
- node.templateFlags = templateFlags & 2048 /* TemplateLiteralLikeFlags */;
14300
+ node.templateFlags = templateFlags & 7176 /* TemplateLiteralLikeFlags */;
14244
14301
  node.transformFlags = getTransformFlagsOfTemplateLiteralLike(node.templateFlags);
14245
14302
  return node;
14246
14303
  }
@@ -14248,7 +14305,7 @@ function createNodeFactory(flags, baseFactory2) {
14248
14305
  const node = createBaseDeclaration(kind);
14249
14306
  node.text = text;
14250
14307
  node.rawText = rawText;
14251
- node.templateFlags = templateFlags & 2048 /* TemplateLiteralLikeFlags */;
14308
+ node.templateFlags = templateFlags & 7176 /* TemplateLiteralLikeFlags */;
14252
14309
  node.transformFlags = getTransformFlagsOfTemplateLiteralLike(node.templateFlags);
14253
14310
  return node;
14254
14311
  }
@@ -18588,8 +18645,8 @@ var Parser;
18588
18645
  function parseErrorAtRange(range, message, ...args) {
18589
18646
  parseErrorAt(range.pos, range.end, message, ...args);
18590
18647
  }
18591
- function scanError(message, length2) {
18592
- parseErrorAtPosition(scanner.getTokenEnd(), length2, message);
18648
+ function scanError(message, length2, arg0) {
18649
+ parseErrorAtPosition(scanner.getTokenEnd(), length2, message, arg0);
18593
18650
  }
18594
18651
  function getNodePos() {
18595
18652
  return scanner.getTokenFullStart();
@@ -18628,9 +18685,6 @@ var Parser;
18628
18685
  function reScanTemplateToken(isTaggedTemplate) {
18629
18686
  return currentToken = scanner.reScanTemplateToken(isTaggedTemplate);
18630
18687
  }
18631
- function reScanTemplateHeadOrNoSubstitutionTemplate() {
18632
- return currentToken = scanner.reScanTemplateHeadOrNoSubstitutionTemplate();
18633
- }
18634
18688
  function reScanLessThanToken() {
18635
18689
  return currentToken = scanner.reScanLessThanToken();
18636
18690
  }
@@ -19702,8 +19756,11 @@ var Parser;
19702
19756
  return parseLiteralLikeNode(token());
19703
19757
  }
19704
19758
  function parseTemplateHead(isTaggedTemplate) {
19705
- if (isTaggedTemplate) {
19706
- reScanTemplateHeadOrNoSubstitutionTemplate();
19759
+ if (!isTaggedTemplate && scanner.getTokenFlags() & 26656 /* IsInvalid */) {
19760
+ reScanTemplateToken(
19761
+ /*isTaggedTemplate*/
19762
+ false
19763
+ );
19707
19764
  }
19708
19765
  const fragment = parseLiteralLikeNode(token());
19709
19766
  Debug.assert(fragment.kind === 15 /* TemplateHead */, "Template head has wrong token kind");
@@ -19721,8 +19778,7 @@ var Parser;
19721
19778
  }
19722
19779
  function parseLiteralLikeNode(kind) {
19723
19780
  const pos = getNodePos();
19724
- const node = isTemplateLiteralKind(kind) ? factory2.createTemplateLiteralLikeNode(kind, scanner.getTokenValue(), getTemplateLiteralRawText(kind), scanner.getTokenFlags() & 2048 /* TemplateLiteralLikeFlags */) : (
19725
- // Octal literals are not allowed in strict mode or ES5
19781
+ const node = isTemplateLiteralKind(kind) ? factory2.createTemplateLiteralLikeNode(kind, scanner.getTokenValue(), getTemplateLiteralRawText(kind), scanner.getTokenFlags() & 7176 /* TemplateLiteralLikeFlags */) : (
19726
19782
  // Note that theoretically the following condition would hold true literals like 009,
19727
19783
  // which is not octal. But because of how the scanner separates the tokens, we would
19728
19784
  // never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
@@ -21778,7 +21834,10 @@ var Parser;
21778
21834
  const tagExpression = factory2.createTaggedTemplateExpression(
21779
21835
  tag,
21780
21836
  typeArguments,
21781
- token() === 14 /* NoSubstitutionTemplateLiteral */ ? (reScanTemplateHeadOrNoSubstitutionTemplate(), parseLiteralNode()) : parseTemplateExpression(
21837
+ token() === 14 /* NoSubstitutionTemplateLiteral */ ? (reScanTemplateToken(
21838
+ /*isTaggedTemplate*/
21839
+ true
21840
+ ), parseLiteralNode()) : parseTemplateExpression(
21782
21841
  /*isTaggedTemplate*/
21783
21842
  true
21784
21843
  )
@@ -21866,10 +21925,16 @@ var Parser;
21866
21925
  }
21867
21926
  function parsePrimaryExpression() {
21868
21927
  switch (token()) {
21928
+ case 14 /* NoSubstitutionTemplateLiteral */:
21929
+ if (scanner.getTokenFlags() & 26656 /* IsInvalid */) {
21930
+ reScanTemplateToken(
21931
+ /*isTaggedTemplate*/
21932
+ false
21933
+ );
21934
+ }
21869
21935
  case 8 /* NumericLiteral */:
21870
21936
  case 9 /* BigIntLiteral */:
21871
21937
  case 10 /* StringLiteral */:
21872
- case 14 /* NoSubstitutionTemplateLiteral */:
21873
21938
  return parseLiteralNode();
21874
21939
  case 109 /* ThisKeyword */:
21875
21940
  case 107 /* SuperKeyword */:
@@ -30512,7 +30577,6 @@ var plainJSErrors = /* @__PURE__ */ new Set([
30512
30577
  Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
30513
30578
  Diagnostics.Invalid_use_of_0_in_strict_mode.code,
30514
30579
  Diagnostics.A_label_is_not_allowed_here.code,
30515
- Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
30516
30580
  Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
30517
30581
  // grammar errors
30518
30582
  Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.1.0-dev.20230324",
5
+ "version": "5.1.0-dev.20230325",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -113,5 +113,5 @@
113
113
  "node": "14.21.1",
114
114
  "npm": "8.19.3"
115
115
  },
116
- "gitHead": "24373d80eca53cb2c973c09d2e3e78db1c24ee4d"
116
+ "gitHead": "a7a0a673db4f3df28687230c239f8aa2d87f176d"
117
117
  }