typescript 5.3.0-dev.20230809 → 5.3.0-dev.20230811

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.3";
21
- var version = `${versionMajorMinor}.0-dev.20230809`;
21
+ var version = `${versionMajorMinor}.0-dev.20230811`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -7511,6 +7511,7 @@ var Diagnostics = {
7511
7511
  Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, 1 /* Error */, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"),
7512
7512
  _0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17019, 1 /* Error */, "_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17019", "'{0}' at the end of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
7513
7513
  _0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17020, 1 /* Error */, "_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17020", "'{0}' at the start of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
7514
+ Unicode_escape_sequence_cannot_appear_here: diag(17021, 1 /* Error */, "Unicode_escape_sequence_cannot_appear_here_17021", "Unicode escape sequence cannot appear here."),
7514
7515
  Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, 1 /* Error */, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"),
7515
7516
  The_files_list_in_config_file_0_is_empty: diag(18002, 1 /* Error */, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."),
7516
7517
  No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, 1 /* Error */, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),
@@ -27273,6 +27274,12 @@ var Parser;
27273
27274
  function parseIdentifierName(diagnosticMessage) {
27274
27275
  return createIdentifier(tokenIsIdentifierOrKeyword(token()), diagnosticMessage);
27275
27276
  }
27277
+ function parseIdentifierNameErrorOnUnicodeEscapeSequence() {
27278
+ if (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape()) {
27279
+ parseErrorAtCurrentToken(Diagnostics.Unicode_escape_sequence_cannot_appear_here);
27280
+ }
27281
+ return createIdentifier(tokenIsIdentifierOrKeyword(token()));
27282
+ }
27276
27283
  function isLiteralPropertyName() {
27277
27284
  return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */;
27278
27285
  }
@@ -27899,7 +27906,9 @@ var Parser;
27899
27906
  parseRightSideOfDot(
27900
27907
  allowReservedWords,
27901
27908
  /*allowPrivateIdentifiers*/
27902
- false
27909
+ false,
27910
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
27911
+ true
27903
27912
  )
27904
27913
  ),
27905
27914
  pos
@@ -27910,7 +27919,7 @@ var Parser;
27910
27919
  function createQualifiedName(entity, name) {
27911
27920
  return finishNode(factory2.createQualifiedName(entity, name), entity.pos);
27912
27921
  }
27913
- function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers) {
27922
+ function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers, allowUnicodeEscapeSequenceInIdentifierName) {
27914
27923
  if (scanner.hasPrecedingLineBreak() && tokenIsIdentifierOrKeyword(token())) {
27915
27924
  const matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
27916
27925
  if (matchesPattern) {
@@ -27931,7 +27940,10 @@ var Parser;
27931
27940
  Diagnostics.Identifier_expected
27932
27941
  );
27933
27942
  }
27934
- return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
27943
+ if (allowIdentifierNames) {
27944
+ return allowUnicodeEscapeSequenceInIdentifierName ? parseIdentifierName() : parseIdentifierNameErrorOnUnicodeEscapeSequence();
27945
+ }
27946
+ return parseIdentifier();
27935
27947
  }
27936
27948
  function parseTemplateSpans(isTaggedTemplate) {
27937
27949
  const pos = getNodePos();
@@ -29706,6 +29718,8 @@ var Parser;
29706
29718
  /*allowIdentifierNames*/
29707
29719
  true,
29708
29720
  /*allowPrivateIdentifiers*/
29721
+ true,
29722
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
29709
29723
  true
29710
29724
  )), pos);
29711
29725
  }
@@ -29873,6 +29887,8 @@ var Parser;
29873
29887
  /*allowIdentifierNames*/
29874
29888
  true,
29875
29889
  /*allowPrivateIdentifiers*/
29890
+ false,
29891
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
29876
29892
  false
29877
29893
  )), pos);
29878
29894
  }
@@ -29882,10 +29898,10 @@ var Parser;
29882
29898
  const pos = getNodePos();
29883
29899
  scanJsxIdentifier();
29884
29900
  const isThis = token() === 110 /* ThisKeyword */;
29885
- const tagName = parseIdentifierName();
29901
+ const tagName = parseIdentifierNameErrorOnUnicodeEscapeSequence();
29886
29902
  if (parseOptional(59 /* ColonToken */)) {
29887
29903
  scanJsxIdentifier();
29888
- return finishNode(factory2.createJsxNamespacedName(tagName, parseIdentifierName()), pos);
29904
+ return finishNode(factory2.createJsxNamespacedName(tagName, parseIdentifierNameErrorOnUnicodeEscapeSequence()), pos);
29889
29905
  }
29890
29906
  return isThis ? finishNode(factory2.createToken(110 /* ThisKeyword */), pos) : tagName;
29891
29907
  }
@@ -29946,10 +29962,10 @@ var Parser;
29946
29962
  function parseJsxAttributeName() {
29947
29963
  const pos = getNodePos();
29948
29964
  scanJsxIdentifier();
29949
- const attrName = parseIdentifierName();
29965
+ const attrName = parseIdentifierNameErrorOnUnicodeEscapeSequence();
29950
29966
  if (parseOptional(59 /* ColonToken */)) {
29951
29967
  scanJsxIdentifier();
29952
- return finishNode(factory2.createJsxNamespacedName(attrName, parseIdentifierName()), pos);
29968
+ return finishNode(factory2.createJsxNamespacedName(attrName, parseIdentifierNameErrorOnUnicodeEscapeSequence()), pos);
29953
29969
  }
29954
29970
  return attrName;
29955
29971
  }
@@ -30037,6 +30053,8 @@ var Parser;
30037
30053
  /*allowIdentifierNames*/
30038
30054
  true,
30039
30055
  /*allowPrivateIdentifiers*/
30056
+ true,
30057
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
30040
30058
  true
30041
30059
  );
30042
30060
  const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
@@ -56518,7 +56536,10 @@ function createTypeChecker(host) {
56518
56536
  }
56519
56537
  }
56520
56538
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
56521
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
56539
+ const templates = filter(
56540
+ types,
56541
+ (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types))
56542
+ );
56522
56543
  if (templates.length) {
56523
56544
  let i = types.length;
56524
56545
  while (i > 0) {
@@ -56923,15 +56944,19 @@ function createTypeChecker(host) {
56923
56944
  function getConstituentCountOfTypes(types) {
56924
56945
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
56925
56946
  }
56926
- function areIntersectedTypesAvoidingPrimitiveReduction(t1, t2) {
56927
- return !!(t1.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && t2 === emptyTypeLiteralType;
56947
+ function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
56948
+ if (types.length !== 2) {
56949
+ return false;
56950
+ }
56951
+ const [t1, t2] = types;
56952
+ return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
56928
56953
  }
56929
56954
  function getTypeFromIntersectionTypeNode(node) {
56930
56955
  const links = getNodeLinks(node);
56931
56956
  if (!links.resolvedType) {
56932
56957
  const aliasSymbol = getAliasSymbolForTypeNode(node);
56933
56958
  const types = map(node.types, getTypeFromTypeNode);
56934
- const noSupertypeReduction = types.length === 2 && (areIntersectedTypesAvoidingPrimitiveReduction(types[0], types[1]) || areIntersectedTypesAvoidingPrimitiveReduction(types[1], types[0]));
56959
+ const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
56935
56960
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
56936
56961
  }
56937
56962
  return links.resolvedType;
@@ -63389,6 +63414,9 @@ function createTypeChecker(host) {
63389
63414
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
63390
63415
  return true;
63391
63416
  }
63417
+ if (target.flags & 2097152 /* Intersection */) {
63418
+ return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
63419
+ }
63392
63420
  if (source.flags & 128 /* StringLiteral */) {
63393
63421
  const value = source.value;
63394
63422
  return !!(target.flags & 8 /* Number */ && isValidNumberString(
@@ -63399,7 +63427,7 @@ function createTypeChecker(host) {
63399
63427
  value,
63400
63428
  /*roundTripOnly*/
63401
63429
  false
63402
- ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target));
63430
+ ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
63403
63431
  }
63404
63432
  if (source.flags & 134217728 /* TemplateLiteral */) {
63405
63433
  const texts = source.texts;
package/lib/tsserver.js CHANGED
@@ -2331,7 +2331,7 @@ module.exports = __toCommonJS(server_exports);
2331
2331
 
2332
2332
  // src/compiler/corePublic.ts
2333
2333
  var versionMajorMinor = "5.3";
2334
- var version = `${versionMajorMinor}.0-dev.20230809`;
2334
+ var version = `${versionMajorMinor}.0-dev.20230811`;
2335
2335
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2336
2336
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2337
2337
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -11034,6 +11034,7 @@ var Diagnostics = {
11034
11034
  Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, 1 /* Error */, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"),
11035
11035
  _0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17019, 1 /* Error */, "_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17019", "'{0}' at the end of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
11036
11036
  _0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17020, 1 /* Error */, "_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17020", "'{0}' at the start of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
11037
+ Unicode_escape_sequence_cannot_appear_here: diag(17021, 1 /* Error */, "Unicode_escape_sequence_cannot_appear_here_17021", "Unicode escape sequence cannot appear here."),
11037
11038
  Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, 1 /* Error */, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"),
11038
11039
  The_files_list_in_config_file_0_is_empty: diag(18002, 1 /* Error */, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."),
11039
11040
  No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, 1 /* Error */, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),
@@ -31673,6 +31674,12 @@ var Parser;
31673
31674
  function parseIdentifierName(diagnosticMessage) {
31674
31675
  return createIdentifier(tokenIsIdentifierOrKeyword(token()), diagnosticMessage);
31675
31676
  }
31677
+ function parseIdentifierNameErrorOnUnicodeEscapeSequence() {
31678
+ if (scanner2.hasUnicodeEscape() || scanner2.hasExtendedUnicodeEscape()) {
31679
+ parseErrorAtCurrentToken(Diagnostics.Unicode_escape_sequence_cannot_appear_here);
31680
+ }
31681
+ return createIdentifier(tokenIsIdentifierOrKeyword(token()));
31682
+ }
31676
31683
  function isLiteralPropertyName() {
31677
31684
  return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */;
31678
31685
  }
@@ -32299,7 +32306,9 @@ var Parser;
32299
32306
  parseRightSideOfDot(
32300
32307
  allowReservedWords,
32301
32308
  /*allowPrivateIdentifiers*/
32302
- false
32309
+ false,
32310
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
32311
+ true
32303
32312
  )
32304
32313
  ),
32305
32314
  pos
@@ -32310,7 +32319,7 @@ var Parser;
32310
32319
  function createQualifiedName(entity, name) {
32311
32320
  return finishNode(factory2.createQualifiedName(entity, name), entity.pos);
32312
32321
  }
32313
- function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers) {
32322
+ function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers, allowUnicodeEscapeSequenceInIdentifierName) {
32314
32323
  if (scanner2.hasPrecedingLineBreak() && tokenIsIdentifierOrKeyword(token())) {
32315
32324
  const matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
32316
32325
  if (matchesPattern) {
@@ -32331,7 +32340,10 @@ var Parser;
32331
32340
  Diagnostics.Identifier_expected
32332
32341
  );
32333
32342
  }
32334
- return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
32343
+ if (allowIdentifierNames) {
32344
+ return allowUnicodeEscapeSequenceInIdentifierName ? parseIdentifierName() : parseIdentifierNameErrorOnUnicodeEscapeSequence();
32345
+ }
32346
+ return parseIdentifier();
32335
32347
  }
32336
32348
  function parseTemplateSpans(isTaggedTemplate) {
32337
32349
  const pos = getNodePos();
@@ -34106,6 +34118,8 @@ var Parser;
34106
34118
  /*allowIdentifierNames*/
34107
34119
  true,
34108
34120
  /*allowPrivateIdentifiers*/
34121
+ true,
34122
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
34109
34123
  true
34110
34124
  )), pos);
34111
34125
  }
@@ -34273,6 +34287,8 @@ var Parser;
34273
34287
  /*allowIdentifierNames*/
34274
34288
  true,
34275
34289
  /*allowPrivateIdentifiers*/
34290
+ false,
34291
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
34276
34292
  false
34277
34293
  )), pos);
34278
34294
  }
@@ -34282,10 +34298,10 @@ var Parser;
34282
34298
  const pos = getNodePos();
34283
34299
  scanJsxIdentifier();
34284
34300
  const isThis2 = token() === 110 /* ThisKeyword */;
34285
- const tagName = parseIdentifierName();
34301
+ const tagName = parseIdentifierNameErrorOnUnicodeEscapeSequence();
34286
34302
  if (parseOptional(59 /* ColonToken */)) {
34287
34303
  scanJsxIdentifier();
34288
- return finishNode(factory2.createJsxNamespacedName(tagName, parseIdentifierName()), pos);
34304
+ return finishNode(factory2.createJsxNamespacedName(tagName, parseIdentifierNameErrorOnUnicodeEscapeSequence()), pos);
34289
34305
  }
34290
34306
  return isThis2 ? finishNode(factory2.createToken(110 /* ThisKeyword */), pos) : tagName;
34291
34307
  }
@@ -34346,10 +34362,10 @@ var Parser;
34346
34362
  function parseJsxAttributeName() {
34347
34363
  const pos = getNodePos();
34348
34364
  scanJsxIdentifier();
34349
- const attrName = parseIdentifierName();
34365
+ const attrName = parseIdentifierNameErrorOnUnicodeEscapeSequence();
34350
34366
  if (parseOptional(59 /* ColonToken */)) {
34351
34367
  scanJsxIdentifier();
34352
- return finishNode(factory2.createJsxNamespacedName(attrName, parseIdentifierName()), pos);
34368
+ return finishNode(factory2.createJsxNamespacedName(attrName, parseIdentifierNameErrorOnUnicodeEscapeSequence()), pos);
34353
34369
  }
34354
34370
  return attrName;
34355
34371
  }
@@ -34437,6 +34453,8 @@ var Parser;
34437
34453
  /*allowIdentifierNames*/
34438
34454
  true,
34439
34455
  /*allowPrivateIdentifiers*/
34456
+ true,
34457
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
34440
34458
  true
34441
34459
  );
34442
34460
  const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
@@ -61227,7 +61245,10 @@ function createTypeChecker(host) {
61227
61245
  }
61228
61246
  }
61229
61247
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
61230
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
61248
+ const templates = filter(
61249
+ types,
61250
+ (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types))
61251
+ );
61231
61252
  if (templates.length) {
61232
61253
  let i = types.length;
61233
61254
  while (i > 0) {
@@ -61632,15 +61653,19 @@ function createTypeChecker(host) {
61632
61653
  function getConstituentCountOfTypes(types) {
61633
61654
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
61634
61655
  }
61635
- function areIntersectedTypesAvoidingPrimitiveReduction(t1, t2) {
61636
- return !!(t1.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && t2 === emptyTypeLiteralType;
61656
+ function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
61657
+ if (types.length !== 2) {
61658
+ return false;
61659
+ }
61660
+ const [t1, t2] = types;
61661
+ return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
61637
61662
  }
61638
61663
  function getTypeFromIntersectionTypeNode(node) {
61639
61664
  const links = getNodeLinks(node);
61640
61665
  if (!links.resolvedType) {
61641
61666
  const aliasSymbol = getAliasSymbolForTypeNode(node);
61642
61667
  const types = map(node.types, getTypeFromTypeNode);
61643
- const noSupertypeReduction = types.length === 2 && (areIntersectedTypesAvoidingPrimitiveReduction(types[0], types[1]) || areIntersectedTypesAvoidingPrimitiveReduction(types[1], types[0]));
61668
+ const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
61644
61669
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
61645
61670
  }
61646
61671
  return links.resolvedType;
@@ -68098,6 +68123,9 @@ function createTypeChecker(host) {
68098
68123
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
68099
68124
  return true;
68100
68125
  }
68126
+ if (target.flags & 2097152 /* Intersection */) {
68127
+ return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
68128
+ }
68101
68129
  if (source.flags & 128 /* StringLiteral */) {
68102
68130
  const value = source.value;
68103
68131
  return !!(target.flags & 8 /* Number */ && isValidNumberString(
@@ -68108,7 +68136,7 @@ function createTypeChecker(host) {
68108
68136
  value,
68109
68137
  /*roundTripOnly*/
68110
68138
  false
68111
- ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target));
68139
+ ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
68112
68140
  }
68113
68141
  if (source.flags & 134217728 /* TemplateLiteral */) {
68114
68142
  const texts = source.texts;
@@ -147399,7 +147427,7 @@ function symbolReferenceIsAlsoMissingAwait(reference, diagnostics, sourceFile, c
147399
147427
  checker.getTypeAtLocation(errorNode).flags & 1 /* Any */;
147400
147428
  }
147401
147429
  function isInsideAwaitableBody(node) {
147402
- return node.kind & 65536 /* AwaitContext */ || !!findAncestor(node, (ancestor) => ancestor.parent && isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || isBlock(ancestor) && (ancestor.parent.kind === 262 /* FunctionDeclaration */ || ancestor.parent.kind === 218 /* FunctionExpression */ || ancestor.parent.kind === 219 /* ArrowFunction */ || ancestor.parent.kind === 174 /* MethodDeclaration */));
147430
+ return node.flags & 65536 /* AwaitContext */ || !!findAncestor(node, (ancestor) => ancestor.parent && isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || isBlock(ancestor) && (ancestor.parent.kind === 262 /* FunctionDeclaration */ || ancestor.parent.kind === 218 /* FunctionExpression */ || ancestor.parent.kind === 219 /* ArrowFunction */ || ancestor.parent.kind === 174 /* MethodDeclaration */));
147403
147431
  }
147404
147432
  function makeChange3(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) {
147405
147433
  if (isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) {
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.3";
38
- version = `${versionMajorMinor}.0-dev.20230809`;
38
+ version = `${versionMajorMinor}.0-dev.20230811`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -8813,6 +8813,7 @@ ${lanes.join("\n")}
8813
8813
  Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, 1 /* Error */, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"),
8814
8814
  _0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17019, 1 /* Error */, "_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17019", "'{0}' at the end of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
8815
8815
  _0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17020, 1 /* Error */, "_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17020", "'{0}' at the start of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
8816
+ Unicode_escape_sequence_cannot_appear_here: diag(17021, 1 /* Error */, "Unicode_escape_sequence_cannot_appear_here_17021", "Unicode escape sequence cannot appear here."),
8816
8817
  Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, 1 /* Error */, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"),
8817
8818
  The_files_list_in_config_file_0_is_empty: diag(18002, 1 /* Error */, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."),
8818
8819
  No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, 1 /* Error */, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),
@@ -29742,6 +29743,12 @@ ${lanes.join("\n")}
29742
29743
  function parseIdentifierName(diagnosticMessage) {
29743
29744
  return createIdentifier(tokenIsIdentifierOrKeyword(token()), diagnosticMessage);
29744
29745
  }
29746
+ function parseIdentifierNameErrorOnUnicodeEscapeSequence() {
29747
+ if (scanner2.hasUnicodeEscape() || scanner2.hasExtendedUnicodeEscape()) {
29748
+ parseErrorAtCurrentToken(Diagnostics.Unicode_escape_sequence_cannot_appear_here);
29749
+ }
29750
+ return createIdentifier(tokenIsIdentifierOrKeyword(token()));
29751
+ }
29745
29752
  function isLiteralPropertyName() {
29746
29753
  return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */;
29747
29754
  }
@@ -30368,7 +30375,9 @@ ${lanes.join("\n")}
30368
30375
  parseRightSideOfDot(
30369
30376
  allowReservedWords,
30370
30377
  /*allowPrivateIdentifiers*/
30371
- false
30378
+ false,
30379
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
30380
+ true
30372
30381
  )
30373
30382
  ),
30374
30383
  pos
@@ -30379,7 +30388,7 @@ ${lanes.join("\n")}
30379
30388
  function createQualifiedName(entity, name) {
30380
30389
  return finishNode(factory2.createQualifiedName(entity, name), entity.pos);
30381
30390
  }
30382
- function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers) {
30391
+ function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers, allowUnicodeEscapeSequenceInIdentifierName) {
30383
30392
  if (scanner2.hasPrecedingLineBreak() && tokenIsIdentifierOrKeyword(token())) {
30384
30393
  const matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
30385
30394
  if (matchesPattern) {
@@ -30400,7 +30409,10 @@ ${lanes.join("\n")}
30400
30409
  Diagnostics.Identifier_expected
30401
30410
  );
30402
30411
  }
30403
- return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
30412
+ if (allowIdentifierNames) {
30413
+ return allowUnicodeEscapeSequenceInIdentifierName ? parseIdentifierName() : parseIdentifierNameErrorOnUnicodeEscapeSequence();
30414
+ }
30415
+ return parseIdentifier();
30404
30416
  }
30405
30417
  function parseTemplateSpans(isTaggedTemplate) {
30406
30418
  const pos = getNodePos();
@@ -32175,6 +32187,8 @@ ${lanes.join("\n")}
32175
32187
  /*allowIdentifierNames*/
32176
32188
  true,
32177
32189
  /*allowPrivateIdentifiers*/
32190
+ true,
32191
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
32178
32192
  true
32179
32193
  )), pos);
32180
32194
  }
@@ -32342,6 +32356,8 @@ ${lanes.join("\n")}
32342
32356
  /*allowIdentifierNames*/
32343
32357
  true,
32344
32358
  /*allowPrivateIdentifiers*/
32359
+ false,
32360
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
32345
32361
  false
32346
32362
  )), pos);
32347
32363
  }
@@ -32351,10 +32367,10 @@ ${lanes.join("\n")}
32351
32367
  const pos = getNodePos();
32352
32368
  scanJsxIdentifier();
32353
32369
  const isThis2 = token() === 110 /* ThisKeyword */;
32354
- const tagName = parseIdentifierName();
32370
+ const tagName = parseIdentifierNameErrorOnUnicodeEscapeSequence();
32355
32371
  if (parseOptional(59 /* ColonToken */)) {
32356
32372
  scanJsxIdentifier();
32357
- return finishNode(factory2.createJsxNamespacedName(tagName, parseIdentifierName()), pos);
32373
+ return finishNode(factory2.createJsxNamespacedName(tagName, parseIdentifierNameErrorOnUnicodeEscapeSequence()), pos);
32358
32374
  }
32359
32375
  return isThis2 ? finishNode(factory2.createToken(110 /* ThisKeyword */), pos) : tagName;
32360
32376
  }
@@ -32415,10 +32431,10 @@ ${lanes.join("\n")}
32415
32431
  function parseJsxAttributeName() {
32416
32432
  const pos = getNodePos();
32417
32433
  scanJsxIdentifier();
32418
- const attrName = parseIdentifierName();
32434
+ const attrName = parseIdentifierNameErrorOnUnicodeEscapeSequence();
32419
32435
  if (parseOptional(59 /* ColonToken */)) {
32420
32436
  scanJsxIdentifier();
32421
- return finishNode(factory2.createJsxNamespacedName(attrName, parseIdentifierName()), pos);
32437
+ return finishNode(factory2.createJsxNamespacedName(attrName, parseIdentifierNameErrorOnUnicodeEscapeSequence()), pos);
32422
32438
  }
32423
32439
  return attrName;
32424
32440
  }
@@ -32506,6 +32522,8 @@ ${lanes.join("\n")}
32506
32522
  /*allowIdentifierNames*/
32507
32523
  true,
32508
32524
  /*allowPrivateIdentifiers*/
32525
+ true,
32526
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
32509
32527
  true
32510
32528
  );
32511
32529
  const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
@@ -58990,7 +59008,10 @@ ${lanes.join("\n")}
58990
59008
  }
58991
59009
  }
58992
59010
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
58993
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
59011
+ const templates = filter(
59012
+ types,
59013
+ (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types))
59014
+ );
58994
59015
  if (templates.length) {
58995
59016
  let i = types.length;
58996
59017
  while (i > 0) {
@@ -59395,15 +59416,19 @@ ${lanes.join("\n")}
59395
59416
  function getConstituentCountOfTypes(types) {
59396
59417
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
59397
59418
  }
59398
- function areIntersectedTypesAvoidingPrimitiveReduction(t1, t2) {
59399
- return !!(t1.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && t2 === emptyTypeLiteralType;
59419
+ function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
59420
+ if (types.length !== 2) {
59421
+ return false;
59422
+ }
59423
+ const [t1, t2] = types;
59424
+ return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
59400
59425
  }
59401
59426
  function getTypeFromIntersectionTypeNode(node) {
59402
59427
  const links = getNodeLinks(node);
59403
59428
  if (!links.resolvedType) {
59404
59429
  const aliasSymbol = getAliasSymbolForTypeNode(node);
59405
59430
  const types = map(node.types, getTypeFromTypeNode);
59406
- const noSupertypeReduction = types.length === 2 && (areIntersectedTypesAvoidingPrimitiveReduction(types[0], types[1]) || areIntersectedTypesAvoidingPrimitiveReduction(types[1], types[0]));
59431
+ const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
59407
59432
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
59408
59433
  }
59409
59434
  return links.resolvedType;
@@ -65861,6 +65886,9 @@ ${lanes.join("\n")}
65861
65886
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
65862
65887
  return true;
65863
65888
  }
65889
+ if (target.flags & 2097152 /* Intersection */) {
65890
+ return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
65891
+ }
65864
65892
  if (source.flags & 128 /* StringLiteral */) {
65865
65893
  const value = source.value;
65866
65894
  return !!(target.flags & 8 /* Number */ && isValidNumberString(
@@ -65871,7 +65899,7 @@ ${lanes.join("\n")}
65871
65899
  value,
65872
65900
  /*roundTripOnly*/
65873
65901
  false
65874
- ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target));
65902
+ ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
65875
65903
  }
65876
65904
  if (source.flags & 134217728 /* TemplateLiteral */) {
65877
65905
  const texts = source.texts;
@@ -145996,7 +146024,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
145996
146024
  checker.getTypeAtLocation(errorNode).flags & 1 /* Any */;
145997
146025
  }
145998
146026
  function isInsideAwaitableBody(node) {
145999
- return node.kind & 65536 /* AwaitContext */ || !!findAncestor(node, (ancestor) => ancestor.parent && isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || isBlock(ancestor) && (ancestor.parent.kind === 262 /* FunctionDeclaration */ || ancestor.parent.kind === 218 /* FunctionExpression */ || ancestor.parent.kind === 219 /* ArrowFunction */ || ancestor.parent.kind === 174 /* MethodDeclaration */));
146027
+ return node.flags & 65536 /* AwaitContext */ || !!findAncestor(node, (ancestor) => ancestor.parent && isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || isBlock(ancestor) && (ancestor.parent.kind === 262 /* FunctionDeclaration */ || ancestor.parent.kind === 218 /* FunctionExpression */ || ancestor.parent.kind === 219 /* ArrowFunction */ || ancestor.parent.kind === 174 /* MethodDeclaration */));
146000
146028
  }
146001
146029
  function makeChange3(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) {
146002
146030
  if (isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) {
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.3";
38
- version = `${versionMajorMinor}.0-dev.20230809`;
38
+ version = `${versionMajorMinor}.0-dev.20230811`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -8813,6 +8813,7 @@ ${lanes.join("\n")}
8813
8813
  Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, 1 /* Error */, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"),
8814
8814
  _0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17019, 1 /* Error */, "_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17019", "'{0}' at the end of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
8815
8815
  _0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17020, 1 /* Error */, "_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17020", "'{0}' at the start of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
8816
+ Unicode_escape_sequence_cannot_appear_here: diag(17021, 1 /* Error */, "Unicode_escape_sequence_cannot_appear_here_17021", "Unicode escape sequence cannot appear here."),
8816
8817
  Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, 1 /* Error */, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"),
8817
8818
  The_files_list_in_config_file_0_is_empty: diag(18002, 1 /* Error */, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."),
8818
8819
  No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, 1 /* Error */, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),
@@ -29742,6 +29743,12 @@ ${lanes.join("\n")}
29742
29743
  function parseIdentifierName(diagnosticMessage) {
29743
29744
  return createIdentifier(tokenIsIdentifierOrKeyword(token()), diagnosticMessage);
29744
29745
  }
29746
+ function parseIdentifierNameErrorOnUnicodeEscapeSequence() {
29747
+ if (scanner2.hasUnicodeEscape() || scanner2.hasExtendedUnicodeEscape()) {
29748
+ parseErrorAtCurrentToken(Diagnostics.Unicode_escape_sequence_cannot_appear_here);
29749
+ }
29750
+ return createIdentifier(tokenIsIdentifierOrKeyword(token()));
29751
+ }
29745
29752
  function isLiteralPropertyName() {
29746
29753
  return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */;
29747
29754
  }
@@ -30368,7 +30375,9 @@ ${lanes.join("\n")}
30368
30375
  parseRightSideOfDot(
30369
30376
  allowReservedWords,
30370
30377
  /*allowPrivateIdentifiers*/
30371
- false
30378
+ false,
30379
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
30380
+ true
30372
30381
  )
30373
30382
  ),
30374
30383
  pos
@@ -30379,7 +30388,7 @@ ${lanes.join("\n")}
30379
30388
  function createQualifiedName(entity, name) {
30380
30389
  return finishNode(factory2.createQualifiedName(entity, name), entity.pos);
30381
30390
  }
30382
- function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers) {
30391
+ function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers, allowUnicodeEscapeSequenceInIdentifierName) {
30383
30392
  if (scanner2.hasPrecedingLineBreak() && tokenIsIdentifierOrKeyword(token())) {
30384
30393
  const matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
30385
30394
  if (matchesPattern) {
@@ -30400,7 +30409,10 @@ ${lanes.join("\n")}
30400
30409
  Diagnostics.Identifier_expected
30401
30410
  );
30402
30411
  }
30403
- return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
30412
+ if (allowIdentifierNames) {
30413
+ return allowUnicodeEscapeSequenceInIdentifierName ? parseIdentifierName() : parseIdentifierNameErrorOnUnicodeEscapeSequence();
30414
+ }
30415
+ return parseIdentifier();
30404
30416
  }
30405
30417
  function parseTemplateSpans(isTaggedTemplate) {
30406
30418
  const pos = getNodePos();
@@ -32175,6 +32187,8 @@ ${lanes.join("\n")}
32175
32187
  /*allowIdentifierNames*/
32176
32188
  true,
32177
32189
  /*allowPrivateIdentifiers*/
32190
+ true,
32191
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
32178
32192
  true
32179
32193
  )), pos);
32180
32194
  }
@@ -32342,6 +32356,8 @@ ${lanes.join("\n")}
32342
32356
  /*allowIdentifierNames*/
32343
32357
  true,
32344
32358
  /*allowPrivateIdentifiers*/
32359
+ false,
32360
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
32345
32361
  false
32346
32362
  )), pos);
32347
32363
  }
@@ -32351,10 +32367,10 @@ ${lanes.join("\n")}
32351
32367
  const pos = getNodePos();
32352
32368
  scanJsxIdentifier();
32353
32369
  const isThis2 = token() === 110 /* ThisKeyword */;
32354
- const tagName = parseIdentifierName();
32370
+ const tagName = parseIdentifierNameErrorOnUnicodeEscapeSequence();
32355
32371
  if (parseOptional(59 /* ColonToken */)) {
32356
32372
  scanJsxIdentifier();
32357
- return finishNode(factory2.createJsxNamespacedName(tagName, parseIdentifierName()), pos);
32373
+ return finishNode(factory2.createJsxNamespacedName(tagName, parseIdentifierNameErrorOnUnicodeEscapeSequence()), pos);
32358
32374
  }
32359
32375
  return isThis2 ? finishNode(factory2.createToken(110 /* ThisKeyword */), pos) : tagName;
32360
32376
  }
@@ -32415,10 +32431,10 @@ ${lanes.join("\n")}
32415
32431
  function parseJsxAttributeName() {
32416
32432
  const pos = getNodePos();
32417
32433
  scanJsxIdentifier();
32418
- const attrName = parseIdentifierName();
32434
+ const attrName = parseIdentifierNameErrorOnUnicodeEscapeSequence();
32419
32435
  if (parseOptional(59 /* ColonToken */)) {
32420
32436
  scanJsxIdentifier();
32421
- return finishNode(factory2.createJsxNamespacedName(attrName, parseIdentifierName()), pos);
32437
+ return finishNode(factory2.createJsxNamespacedName(attrName, parseIdentifierNameErrorOnUnicodeEscapeSequence()), pos);
32422
32438
  }
32423
32439
  return attrName;
32424
32440
  }
@@ -32506,6 +32522,8 @@ ${lanes.join("\n")}
32506
32522
  /*allowIdentifierNames*/
32507
32523
  true,
32508
32524
  /*allowPrivateIdentifiers*/
32525
+ true,
32526
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
32509
32527
  true
32510
32528
  );
32511
32529
  const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
@@ -58990,7 +59008,10 @@ ${lanes.join("\n")}
58990
59008
  }
58991
59009
  }
58992
59010
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
58993
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
59011
+ const templates = filter(
59012
+ types,
59013
+ (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types))
59014
+ );
58994
59015
  if (templates.length) {
58995
59016
  let i = types.length;
58996
59017
  while (i > 0) {
@@ -59395,15 +59416,19 @@ ${lanes.join("\n")}
59395
59416
  function getConstituentCountOfTypes(types) {
59396
59417
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
59397
59418
  }
59398
- function areIntersectedTypesAvoidingPrimitiveReduction(t1, t2) {
59399
- return !!(t1.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && t2 === emptyTypeLiteralType;
59419
+ function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
59420
+ if (types.length !== 2) {
59421
+ return false;
59422
+ }
59423
+ const [t1, t2] = types;
59424
+ return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
59400
59425
  }
59401
59426
  function getTypeFromIntersectionTypeNode(node) {
59402
59427
  const links = getNodeLinks(node);
59403
59428
  if (!links.resolvedType) {
59404
59429
  const aliasSymbol = getAliasSymbolForTypeNode(node);
59405
59430
  const types = map(node.types, getTypeFromTypeNode);
59406
- const noSupertypeReduction = types.length === 2 && (areIntersectedTypesAvoidingPrimitiveReduction(types[0], types[1]) || areIntersectedTypesAvoidingPrimitiveReduction(types[1], types[0]));
59431
+ const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
59407
59432
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
59408
59433
  }
59409
59434
  return links.resolvedType;
@@ -65861,6 +65886,9 @@ ${lanes.join("\n")}
65861
65886
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
65862
65887
  return true;
65863
65888
  }
65889
+ if (target.flags & 2097152 /* Intersection */) {
65890
+ return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
65891
+ }
65864
65892
  if (source.flags & 128 /* StringLiteral */) {
65865
65893
  const value = source.value;
65866
65894
  return !!(target.flags & 8 /* Number */ && isValidNumberString(
@@ -65871,7 +65899,7 @@ ${lanes.join("\n")}
65871
65899
  value,
65872
65900
  /*roundTripOnly*/
65873
65901
  false
65874
- ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target));
65902
+ ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
65875
65903
  }
65876
65904
  if (source.flags & 134217728 /* TemplateLiteral */) {
65877
65905
  const texts = source.texts;
@@ -146011,7 +146039,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
146011
146039
  checker.getTypeAtLocation(errorNode).flags & 1 /* Any */;
146012
146040
  }
146013
146041
  function isInsideAwaitableBody(node) {
146014
- return node.kind & 65536 /* AwaitContext */ || !!findAncestor(node, (ancestor) => ancestor.parent && isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || isBlock(ancestor) && (ancestor.parent.kind === 262 /* FunctionDeclaration */ || ancestor.parent.kind === 218 /* FunctionExpression */ || ancestor.parent.kind === 219 /* ArrowFunction */ || ancestor.parent.kind === 174 /* MethodDeclaration */));
146042
+ return node.flags & 65536 /* AwaitContext */ || !!findAncestor(node, (ancestor) => ancestor.parent && isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || isBlock(ancestor) && (ancestor.parent.kind === 262 /* FunctionDeclaration */ || ancestor.parent.kind === 218 /* FunctionExpression */ || ancestor.parent.kind === 219 /* ArrowFunction */ || ancestor.parent.kind === 174 /* MethodDeclaration */));
146015
146043
  }
146016
146044
  function makeChange3(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) {
146017
146045
  if (isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) {
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.3";
57
- var version = `${versionMajorMinor}.0-dev.20230809`;
57
+ var version = `${versionMajorMinor}.0-dev.20230811`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -6885,6 +6885,7 @@ var Diagnostics = {
6885
6885
  Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, 1 /* Error */, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"),
6886
6886
  _0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17019, 1 /* Error */, "_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17019", "'{0}' at the end of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
6887
6887
  _0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17020, 1 /* Error */, "_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17020", "'{0}' at the start of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
6888
+ Unicode_escape_sequence_cannot_appear_here: diag(17021, 1 /* Error */, "Unicode_escape_sequence_cannot_appear_here_17021", "Unicode escape sequence cannot appear here."),
6888
6889
  Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, 1 /* Error */, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"),
6889
6890
  The_files_list_in_config_file_0_is_empty: diag(18002, 1 /* Error */, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."),
6890
6891
  No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, 1 /* Error */, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),
@@ -19159,6 +19160,12 @@ var Parser;
19159
19160
  function parseIdentifierName(diagnosticMessage) {
19160
19161
  return createIdentifier(tokenIsIdentifierOrKeyword(token()), diagnosticMessage);
19161
19162
  }
19163
+ function parseIdentifierNameErrorOnUnicodeEscapeSequence() {
19164
+ if (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape()) {
19165
+ parseErrorAtCurrentToken(Diagnostics.Unicode_escape_sequence_cannot_appear_here);
19166
+ }
19167
+ return createIdentifier(tokenIsIdentifierOrKeyword(token()));
19168
+ }
19162
19169
  function isLiteralPropertyName() {
19163
19170
  return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */;
19164
19171
  }
@@ -19785,7 +19792,9 @@ var Parser;
19785
19792
  parseRightSideOfDot(
19786
19793
  allowReservedWords,
19787
19794
  /*allowPrivateIdentifiers*/
19788
- false
19795
+ false,
19796
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
19797
+ true
19789
19798
  )
19790
19799
  ),
19791
19800
  pos
@@ -19796,7 +19805,7 @@ var Parser;
19796
19805
  function createQualifiedName(entity, name) {
19797
19806
  return finishNode(factory2.createQualifiedName(entity, name), entity.pos);
19798
19807
  }
19799
- function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers) {
19808
+ function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers, allowUnicodeEscapeSequenceInIdentifierName) {
19800
19809
  if (scanner.hasPrecedingLineBreak() && tokenIsIdentifierOrKeyword(token())) {
19801
19810
  const matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
19802
19811
  if (matchesPattern) {
@@ -19817,7 +19826,10 @@ var Parser;
19817
19826
  Diagnostics.Identifier_expected
19818
19827
  );
19819
19828
  }
19820
- return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
19829
+ if (allowIdentifierNames) {
19830
+ return allowUnicodeEscapeSequenceInIdentifierName ? parseIdentifierName() : parseIdentifierNameErrorOnUnicodeEscapeSequence();
19831
+ }
19832
+ return parseIdentifier();
19821
19833
  }
19822
19834
  function parseTemplateSpans(isTaggedTemplate) {
19823
19835
  const pos = getNodePos();
@@ -21592,6 +21604,8 @@ var Parser;
21592
21604
  /*allowIdentifierNames*/
21593
21605
  true,
21594
21606
  /*allowPrivateIdentifiers*/
21607
+ true,
21608
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
21595
21609
  true
21596
21610
  )), pos);
21597
21611
  }
@@ -21759,6 +21773,8 @@ var Parser;
21759
21773
  /*allowIdentifierNames*/
21760
21774
  true,
21761
21775
  /*allowPrivateIdentifiers*/
21776
+ false,
21777
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
21762
21778
  false
21763
21779
  )), pos);
21764
21780
  }
@@ -21768,10 +21784,10 @@ var Parser;
21768
21784
  const pos = getNodePos();
21769
21785
  scanJsxIdentifier();
21770
21786
  const isThis = token() === 110 /* ThisKeyword */;
21771
- const tagName = parseIdentifierName();
21787
+ const tagName = parseIdentifierNameErrorOnUnicodeEscapeSequence();
21772
21788
  if (parseOptional(59 /* ColonToken */)) {
21773
21789
  scanJsxIdentifier();
21774
- return finishNode(factory2.createJsxNamespacedName(tagName, parseIdentifierName()), pos);
21790
+ return finishNode(factory2.createJsxNamespacedName(tagName, parseIdentifierNameErrorOnUnicodeEscapeSequence()), pos);
21775
21791
  }
21776
21792
  return isThis ? finishNode(factory2.createToken(110 /* ThisKeyword */), pos) : tagName;
21777
21793
  }
@@ -21832,10 +21848,10 @@ var Parser;
21832
21848
  function parseJsxAttributeName() {
21833
21849
  const pos = getNodePos();
21834
21850
  scanJsxIdentifier();
21835
- const attrName = parseIdentifierName();
21851
+ const attrName = parseIdentifierNameErrorOnUnicodeEscapeSequence();
21836
21852
  if (parseOptional(59 /* ColonToken */)) {
21837
21853
  scanJsxIdentifier();
21838
- return finishNode(factory2.createJsxNamespacedName(attrName, parseIdentifierName()), pos);
21854
+ return finishNode(factory2.createJsxNamespacedName(attrName, parseIdentifierNameErrorOnUnicodeEscapeSequence()), pos);
21839
21855
  }
21840
21856
  return attrName;
21841
21857
  }
@@ -21923,6 +21939,8 @@ var Parser;
21923
21939
  /*allowIdentifierNames*/
21924
21940
  true,
21925
21941
  /*allowPrivateIdentifiers*/
21942
+ true,
21943
+ /*allowUnicodeEscapeSequenceInIdentifierName*/
21926
21944
  true
21927
21945
  );
21928
21946
  const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
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.3.0-dev.20230809",
5
+ "version": "5.3.0-dev.20230811",
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": "20.1.0",
114
114
  "npm": "8.19.4"
115
115
  },
116
- "gitHead": "b4cd9d8fdd1a3a9a8324069a7a6f4336538aa688"
116
+ "gitHead": "28cd1fbd13b8d09259e7a7086aa258c0221c38ac"
117
117
  }