typescript 5.6.0-dev.20240604 → 5.6.0-dev.20240605

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/typescript.js CHANGED
@@ -277,7 +277,7 @@ __export(typescript_exports, {
277
277
  changeFullExtension: () => changeFullExtension,
278
278
  changesAffectModuleResolution: () => changesAffectModuleResolution,
279
279
  changesAffectingProgramStructure: () => changesAffectingProgramStructure,
280
- characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
280
+ characterCodeToRegularExpressionFlag: () => characterCodeToRegularExpressionFlag,
281
281
  childIsDecorated: () => childIsDecorated,
282
282
  classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
283
283
  classHasClassThisAssignment: () => classHasClassThisAssignment,
@@ -1612,6 +1612,7 @@ __export(typescript_exports, {
1612
1612
  isModuleBlock: () => isModuleBlock,
1613
1613
  isModuleBody: () => isModuleBody,
1614
1614
  isModuleDeclaration: () => isModuleDeclaration,
1615
+ isModuleExportName: () => isModuleExportName,
1615
1616
  isModuleExportsAccessExpression: () => isModuleExportsAccessExpression,
1616
1617
  isModuleIdentifier: () => isModuleIdentifier,
1617
1618
  isModuleName: () => isModuleName,
@@ -1929,6 +1930,9 @@ __export(typescript_exports, {
1929
1930
  missingFileModifiedTime: () => missingFileModifiedTime,
1930
1931
  modifierToFlag: () => modifierToFlag,
1931
1932
  modifiersToFlags: () => modifiersToFlags,
1933
+ moduleExportNameIsDefault: () => moduleExportNameIsDefault,
1934
+ moduleExportNameTextEscaped: () => moduleExportNameTextEscaped,
1935
+ moduleExportNameTextUnescaped: () => moduleExportNameTextUnescaped,
1932
1936
  moduleOptionDeclaration: () => moduleOptionDeclaration,
1933
1937
  moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
1934
1938
  moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
@@ -2074,7 +2078,7 @@ __export(typescript_exports, {
2074
2078
  reducePathComponents: () => reducePathComponents,
2075
2079
  refactor: () => ts_refactor_exports,
2076
2080
  regExpEscape: () => regExpEscape,
2077
- regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
2081
+ regularExpressionFlagToCharacterCode: () => regularExpressionFlagToCharacterCode,
2078
2082
  relativeComplement: () => relativeComplement,
2079
2083
  removeAllComments: () => removeAllComments,
2080
2084
  removeEmitHelper: () => removeEmitHelper,
@@ -2371,7 +2375,7 @@ module.exports = __toCommonJS(typescript_exports);
2371
2375
 
2372
2376
  // src/compiler/corePublic.ts
2373
2377
  var versionMajorMinor = "5.6";
2374
- var version = `${versionMajorMinor}.0-dev.20240604`;
2378
+ var version = `${versionMajorMinor}.0-dev.20240605`;
2375
2379
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2376
2380
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2377
2381
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -11456,7 +11460,8 @@ var Diagnostics = {
11456
11460
  Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
11457
11461
  await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block."),
11458
11462
  _0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is_enabled: diag(18055, 1 /* Error */, "_0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is__18055", "'{0}' has a string type, but must have syntactically recognizable string syntax when 'isolatedModules' is enabled."),
11459
- Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled: diag(18056, 1 /* Error */, "Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is__18056", "Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled.")
11463
+ Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled: diag(18056, 1 /* Error */, "Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is__18056", "Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled."),
11464
+ String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es2020: diag(18057, 1 /* Error */, "String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es_18057", "String literal import and export names are not supported when the '--module' flag is set to 'es2015' or 'es2020'.")
11460
11465
  };
11461
11466
 
11462
11467
  // src/compiler/scanner.ts
@@ -11616,16 +11621,16 @@ var textToToken = new Map(Object.entries({
11616
11621
  "#": 63 /* HashToken */,
11617
11622
  "`": 62 /* BacktickToken */
11618
11623
  }));
11619
- var charToRegExpFlag = new Map(Object.entries({
11620
- d: 1 /* HasIndices */,
11621
- g: 2 /* Global */,
11622
- i: 4 /* IgnoreCase */,
11623
- m: 8 /* Multiline */,
11624
- s: 16 /* DotAll */,
11625
- u: 32 /* Unicode */,
11626
- v: 64 /* UnicodeSets */,
11627
- y: 128 /* Sticky */
11628
- }));
11624
+ var charCodeToRegExpFlag = /* @__PURE__ */ new Map([
11625
+ [100 /* d */, 1 /* HasIndices */],
11626
+ [103 /* g */, 2 /* Global */],
11627
+ [105 /* i */, 4 /* IgnoreCase */],
11628
+ [109 /* m */, 8 /* Multiline */],
11629
+ [115 /* s */, 16 /* DotAll */],
11630
+ [117 /* u */, 32 /* Unicode */],
11631
+ [118 /* v */, 64 /* UnicodeSets */],
11632
+ [121 /* y */, 128 /* Sticky */]
11633
+ ]);
11629
11634
  var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
11630
11635
  [1 /* HasIndices */, 9 /* RegularExpressionFlagsHasIndices */],
11631
11636
  [16 /* DotAll */, 5 /* RegularExpressionFlagsDotAll */],
@@ -11681,12 +11686,12 @@ function tokenToString(t) {
11681
11686
  function stringToToken(s) {
11682
11687
  return textToToken.get(s);
11683
11688
  }
11684
- var regExpFlagChars = makeReverseMap(charToRegExpFlag);
11685
- function regularExpressionFlagToCharacter(f) {
11686
- return regExpFlagChars[f];
11689
+ var regExpFlagCharCodes = makeReverseMap(charCodeToRegExpFlag);
11690
+ function regularExpressionFlagToCharacterCode(f) {
11691
+ return regExpFlagCharCodes[f];
11687
11692
  }
11688
- function characterToRegularExpressionFlag(c) {
11689
- return charToRegExpFlag.get(c);
11693
+ function characterCodeToRegularExpressionFlag(ch) {
11694
+ return charCodeToRegExpFlag.get(ch);
11690
11695
  }
11691
11696
  function computeLineStarts(text) {
11692
11697
  const result = [];
@@ -13402,24 +13407,25 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13402
13407
  pos++;
13403
13408
  let regExpFlags = 0 /* None */;
13404
13409
  while (true) {
13405
- const ch = charCodeChecked(pos);
13410
+ const ch = codePointChecked(pos);
13406
13411
  if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
13407
13412
  break;
13408
13413
  }
13414
+ const size = charSize(ch);
13409
13415
  if (reportErrors2) {
13410
- const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13416
+ const flag = characterCodeToRegularExpressionFlag(ch);
13411
13417
  if (flag === void 0) {
13412
- error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
13418
+ error2(Diagnostics.Unknown_regular_expression_flag, pos, size);
13413
13419
  } else if (regExpFlags & flag) {
13414
- error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
13420
+ error2(Diagnostics.Duplicate_regular_expression_flag, pos, size);
13415
13421
  } else if (((regExpFlags | flag) & 96 /* AnyUnicodeMode */) === 96 /* AnyUnicodeMode */) {
13416
- error2(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, pos, 1);
13422
+ error2(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, pos, size);
13417
13423
  } else {
13418
13424
  regExpFlags |= flag;
13419
- checkRegularExpressionFlagAvailable(flag, pos);
13425
+ checkRegularExpressionFlagAvailability(flag, size);
13420
13426
  }
13421
13427
  }
13422
- pos++;
13428
+ pos += size;
13423
13429
  }
13424
13430
  if (reportErrors2) {
13425
13431
  scanRange(startOfRegExpBody, endOfRegExpBody - startOfRegExpBody, () => {
@@ -13634,22 +13640,23 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13634
13640
  }
13635
13641
  function scanPatternModifiers(currFlags) {
13636
13642
  while (true) {
13637
- const ch = charCodeChecked(pos);
13643
+ const ch = codePointChecked(pos);
13638
13644
  if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
13639
13645
  break;
13640
13646
  }
13641
- const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13647
+ const size = charSize(ch);
13648
+ const flag = characterCodeToRegularExpressionFlag(ch);
13642
13649
  if (flag === void 0) {
13643
- error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
13650
+ error2(Diagnostics.Unknown_regular_expression_flag, pos, size);
13644
13651
  } else if (currFlags & flag) {
13645
- error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
13652
+ error2(Diagnostics.Duplicate_regular_expression_flag, pos, size);
13646
13653
  } else if (!(flag & 28 /* Modifiers */)) {
13647
- error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
13654
+ error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, size);
13648
13655
  } else {
13649
13656
  currFlags |= flag;
13650
- checkRegularExpressionFlagAvailable(flag, pos);
13657
+ checkRegularExpressionFlagAvailability(flag, size);
13651
13658
  }
13652
- pos++;
13659
+ pos += size;
13653
13660
  }
13654
13661
  return currFlags;
13655
13662
  }
@@ -14253,6 +14260,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14253
14260
  forEach(groupNameReferences, (reference) => {
14254
14261
  if (!(groupSpecifiers == null ? void 0 : groupSpecifiers.has(reference.name))) {
14255
14262
  error2(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
14263
+ if (groupSpecifiers) {
14264
+ const suggestion = getSpellingSuggestion(reference.name, groupSpecifiers, identity);
14265
+ if (suggestion) {
14266
+ error2(Diagnostics.Did_you_mean_0, reference.pos, reference.end - reference.pos, suggestion);
14267
+ }
14268
+ }
14256
14269
  }
14257
14270
  });
14258
14271
  forEach(decimalEscapes, (escape) => {
@@ -14265,10 +14278,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14265
14278
  }
14266
14279
  });
14267
14280
  }
14268
- function checkRegularExpressionFlagAvailable(flag, pos2) {
14281
+ function checkRegularExpressionFlagAvailability(flag, size) {
14269
14282
  const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
14270
14283
  if (availableFrom && languageVersion < availableFrom) {
14271
- error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos2, 1, getNameOfScriptTarget(availableFrom));
14284
+ error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos, size, getNameOfScriptTarget(availableFrom));
14272
14285
  }
14273
14286
  }
14274
14287
  function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
@@ -16596,7 +16609,16 @@ function isJSDocTypeExpressionOrChild(node) {
16596
16609
  return !!findAncestor(node, isJSDocTypeExpression);
16597
16610
  }
16598
16611
  function isExportNamespaceAsDefaultDeclaration(node) {
16599
- return !!(isExportDeclaration(node) && node.exportClause && isNamespaceExport(node.exportClause) && node.exportClause.name.escapedText === "default");
16612
+ return !!(isExportDeclaration(node) && node.exportClause && isNamespaceExport(node.exportClause) && moduleExportNameIsDefault(node.exportClause.name));
16613
+ }
16614
+ function moduleExportNameTextUnescaped(node) {
16615
+ return node.kind === 11 /* StringLiteral */ ? node.text : unescapeLeadingUnderscores(node.escapedText);
16616
+ }
16617
+ function moduleExportNameTextEscaped(node) {
16618
+ return node.kind === 11 /* StringLiteral */ ? escapeLeadingUnderscores(node.text) : node.escapedText;
16619
+ }
16620
+ function moduleExportNameIsDefault(node) {
16621
+ return (node.kind === 11 /* StringLiteral */ ? node.text : node.escapedText) === "default" /* Default */;
16600
16622
  }
16601
16623
  function getTextOfNodeFromSourceText(sourceText, node, includeTrivia = false) {
16602
16624
  if (nodeIsMissing(node)) {
@@ -30391,6 +30413,9 @@ function isNamedExports(node) {
30391
30413
  function isExportSpecifier(node) {
30392
30414
  return node.kind === 281 /* ExportSpecifier */;
30393
30415
  }
30416
+ function isModuleExportName(node) {
30417
+ return node.kind === 80 /* Identifier */ || node.kind === 11 /* StringLiteral */;
30418
+ }
30394
30419
  function isMissingDeclaration(node) {
30395
30420
  return node.kind === 282 /* MissingDeclaration */;
30396
30421
  }
@@ -31136,6 +31161,9 @@ function getLocalNameForExternalImport(factory2, node, sourceFile) {
31136
31161
  const namespaceDeclaration = getNamespaceDeclarationNode(node);
31137
31162
  if (namespaceDeclaration && !isDefaultImport(node) && !isExportNamespaceAsDefaultDeclaration(node)) {
31138
31163
  const name = namespaceDeclaration.name;
31164
+ if (name.kind === 11 /* StringLiteral */) {
31165
+ return factory2.getGeneratedNameForNode(node);
31166
+ }
31139
31167
  return isGeneratedIdentifier(name) ? name : factory2.createIdentifier(getSourceTextOfNodeFromSourceFile(sourceFile, name) || idText(name));
31140
31168
  }
31141
31169
  if (node.kind === 272 /* ImportDeclaration */ && node.importClause) {
@@ -33498,6 +33526,9 @@ var Parser;
33498
33526
  if (token() === 161 /* FromKeyword */ && lookAhead(nextTokenIsStringLiteral)) {
33499
33527
  return false;
33500
33528
  }
33529
+ if (token() === 11 /* StringLiteral */) {
33530
+ return true;
33531
+ }
33501
33532
  return tokenIsIdentifierOrKeyword(token());
33502
33533
  case 13 /* JsxAttributes */:
33503
33534
  return tokenIsIdentifierOrKeyword(token()) || token() === 19 /* OpenBraceToken */;
@@ -37946,6 +37977,12 @@ var Parser;
37946
37977
  const name = parseIdentifier();
37947
37978
  return finishNode(factory2.createNamespaceImport(name), pos);
37948
37979
  }
37980
+ function canParseModuleExportName() {
37981
+ return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */;
37982
+ }
37983
+ function parseModuleExportName(parseName) {
37984
+ return token() === 11 /* StringLiteral */ ? parseLiteralNode() : parseName();
37985
+ }
37949
37986
  function parseNamedImportsOrExports(kind) {
37950
37987
  const pos = getNodePos();
37951
37988
  const node = kind === 275 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseImportSpecifier, 19 /* OpenBraceToken */, 20 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseExportSpecifier, 19 /* OpenBraceToken */, 20 /* CloseBraceToken */));
@@ -37966,42 +38003,51 @@ var Parser;
37966
38003
  let isTypeOnly = false;
37967
38004
  let propertyName;
37968
38005
  let canParseAsKeyword = true;
37969
- let name = parseIdentifierName();
37970
- if (name.escapedText === "type") {
38006
+ let name = parseModuleExportName(parseIdentifierName);
38007
+ if (name.kind === 80 /* Identifier */ && name.escapedText === "type") {
37971
38008
  if (token() === 130 /* AsKeyword */) {
37972
38009
  const firstAs = parseIdentifierName();
37973
38010
  if (token() === 130 /* AsKeyword */) {
37974
38011
  const secondAs = parseIdentifierName();
37975
- if (tokenIsIdentifierOrKeyword(token())) {
38012
+ if (canParseModuleExportName()) {
37976
38013
  isTypeOnly = true;
37977
38014
  propertyName = firstAs;
37978
- name = parseNameWithKeywordCheck();
38015
+ name = parseModuleExportName(parseNameWithKeywordCheck);
37979
38016
  canParseAsKeyword = false;
37980
38017
  } else {
37981
38018
  propertyName = name;
37982
38019
  name = secondAs;
37983
38020
  canParseAsKeyword = false;
37984
38021
  }
37985
- } else if (tokenIsIdentifierOrKeyword(token())) {
38022
+ } else if (canParseModuleExportName()) {
37986
38023
  propertyName = name;
37987
38024
  canParseAsKeyword = false;
37988
- name = parseNameWithKeywordCheck();
38025
+ name = parseModuleExportName(parseNameWithKeywordCheck);
37989
38026
  } else {
37990
38027
  isTypeOnly = true;
37991
38028
  name = firstAs;
37992
38029
  }
37993
- } else if (tokenIsIdentifierOrKeyword(token())) {
38030
+ } else if (canParseModuleExportName()) {
37994
38031
  isTypeOnly = true;
37995
- name = parseNameWithKeywordCheck();
38032
+ name = parseModuleExportName(parseNameWithKeywordCheck);
37996
38033
  }
37997
38034
  }
37998
38035
  if (canParseAsKeyword && token() === 130 /* AsKeyword */) {
37999
38036
  propertyName = name;
38000
38037
  parseExpected(130 /* AsKeyword */);
38001
- name = parseNameWithKeywordCheck();
38038
+ name = parseModuleExportName(parseNameWithKeywordCheck);
38002
38039
  }
38003
- if (kind === 276 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
38004
- parseErrorAt(checkIdentifierStart, checkIdentifierEnd, Diagnostics.Identifier_expected);
38040
+ if (kind === 276 /* ImportSpecifier */) {
38041
+ if (name.kind !== 80 /* Identifier */) {
38042
+ parseErrorAt(skipTrivia(sourceText, name.pos), name.end, Diagnostics.Identifier_expected);
38043
+ name = setTextRangePosEnd(createMissingNode(
38044
+ 80 /* Identifier */,
38045
+ /*reportAtCurrentPosition*/
38046
+ false
38047
+ ), name.pos, name.pos);
38048
+ } else if (checkIdentifierIsKeyword) {
38049
+ parseErrorAt(checkIdentifierStart, checkIdentifierEnd, Diagnostics.Identifier_expected);
38050
+ }
38005
38051
  }
38006
38052
  const node = kind === 276 /* ImportSpecifier */ ? factory2.createImportSpecifier(isTypeOnly, propertyName, name) : factory2.createExportSpecifier(isTypeOnly, propertyName, name);
38007
38053
  return finishNode(node, pos);
@@ -38013,7 +38059,7 @@ var Parser;
38013
38059
  }
38014
38060
  }
38015
38061
  function parseNamespaceExport(pos) {
38016
- return finishNode(factory2.createNamespaceExport(parseIdentifierName()), pos);
38062
+ return finishNode(factory2.createNamespaceExport(parseModuleExportName(parseIdentifierName)), pos);
38017
38063
  }
38018
38064
  function parseExportDeclaration(pos, hasJSDoc, modifiers) {
38019
38065
  const savedAwaitContext = inAwaitContext();
@@ -45774,6 +45820,9 @@ function getModuleInstanceStateWorker(node, visited) {
45774
45820
  }
45775
45821
  function getModuleInstanceStateForAliasTarget(specifier, visited) {
45776
45822
  const name = specifier.propertyName || specifier.name;
45823
+ if (name.kind !== 80 /* Identifier */) {
45824
+ return 1 /* Instantiated */;
45825
+ }
45777
45826
  let p = specifier.parent;
45778
45827
  while (p) {
45779
45828
  if (isBlock(p) || isModuleBlock(p) || isSourceFile(p)) {
@@ -46030,7 +46079,7 @@ function createBinder() {
46030
46079
  }
46031
46080
  function declareSymbol(symbolTable, parent3, node, includes, excludes, isReplaceableByMethod, isComputedName) {
46032
46081
  Debug.assert(isComputedName || !hasDynamicName(node));
46033
- const isDefaultExport = hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) && node.name.escapedText === "default";
46082
+ const isDefaultExport = hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) && moduleExportNameIsDefault(node.name);
46034
46083
  const name = isComputedName ? "__computed" /* Computed */ : isDefaultExport && parent3 ? "default" /* Default */ : getDeclarationName(node);
46035
46084
  let symbol;
46036
46085
  if (name === void 0) {
@@ -49918,7 +49967,8 @@ function createTypeChecker(host) {
49918
49967
  isUndefinedIdentifierExpression(node) {
49919
49968
  Debug.assert(isExpressionNode(node));
49920
49969
  return getSymbolAtLocation(node) === undefinedSymbol;
49921
- }
49970
+ },
49971
+ isDefinitelyReferenceToGlobalSymbolObject
49922
49972
  });
49923
49973
  var evaluate = createEvaluator({
49924
49974
  evaluateElementAccessExpression,
@@ -50875,6 +50925,21 @@ function createTypeChecker(host) {
50875
50925
  ];
50876
50926
  initializeTypeChecker();
50877
50927
  return checker;
50928
+ function isDefinitelyReferenceToGlobalSymbolObject(node) {
50929
+ if (!isPropertyAccessExpression(node)) return false;
50930
+ if (!isIdentifier(node.name)) return false;
50931
+ if (!isPropertyAccessExpression(node.expression) && !isIdentifier(node.expression)) return false;
50932
+ if (isIdentifier(node.expression)) {
50933
+ return idText(node.expression) === "Symbol" && getResolvedSymbol(node.expression) === (getGlobalSymbol(
50934
+ "Symbol",
50935
+ 111551 /* Value */ | 1048576 /* ExportValue */,
50936
+ /*diagnostic*/
50937
+ void 0
50938
+ ) || unknownSymbol);
50939
+ }
50940
+ if (!isIdentifier(node.expression.expression)) return false;
50941
+ return idText(node.expression.name) === "Symbol" && idText(node.expression.expression) === "globalThis" && getResolvedSymbol(node.expression.expression) === globalThisSymbol;
50942
+ }
50878
50943
  function getCachedType(key) {
50879
50944
  return key ? cachedTypes.get(key) : void 0;
50880
50945
  }
@@ -51903,7 +51968,7 @@ function createTypeChecker(host) {
51903
51968
  const isExport = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */;
51904
51969
  const message = isExport ? Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type;
51905
51970
  const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
51906
- const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
51971
+ const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" : moduleExportNameTextUnescaped(typeOnlyDeclaration.name);
51907
51972
  addRelatedInfo(error2(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
51908
51973
  }
51909
51974
  }
@@ -52147,12 +52212,12 @@ function createTypeChecker(host) {
52147
52212
  if (valueSymbol.exports) result.exports = new Map(valueSymbol.exports);
52148
52213
  return result;
52149
52214
  }
52150
- function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
52215
+ function getExportOfModule(symbol, nameText, specifier, dontResolveAlias) {
52151
52216
  var _a;
52152
52217
  if (symbol.flags & 1536 /* Module */) {
52153
- const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
52218
+ const exportSymbol = getExportsOfSymbol(symbol).get(nameText);
52154
52219
  const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
52155
- const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(name.escapedText);
52220
+ const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(nameText);
52156
52221
  markSymbolOfAliasDeclarationIfTypeOnly(
52157
52222
  specifier,
52158
52223
  exportSymbol,
@@ -52160,7 +52225,7 @@ function createTypeChecker(host) {
52160
52225
  /*overwriteEmpty*/
52161
52226
  false,
52162
52227
  exportStarDeclaration,
52163
- name.escapedText
52228
+ nameText
52164
52229
  );
52165
52230
  return resolved;
52166
52231
  }
@@ -52178,10 +52243,11 @@ function createTypeChecker(host) {
52178
52243
  const moduleSpecifier = getExternalModuleRequireArgument(node) || node.moduleSpecifier;
52179
52244
  const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier);
52180
52245
  const name = !isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name;
52181
- if (!isIdentifier(name)) {
52246
+ if (!isIdentifier(name) && name.kind !== 11 /* StringLiteral */) {
52182
52247
  return void 0;
52183
52248
  }
52184
- const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
52249
+ const nameText = moduleExportNameTextEscaped(name);
52250
+ const suppressInteropError = nameText === "default" /* Default */ && allowSyntheticDefaultImports;
52185
52251
  const targetSymbol = resolveESModuleSymbol(
52186
52252
  moduleSymbol,
52187
52253
  moduleSpecifier,
@@ -52190,7 +52256,7 @@ function createTypeChecker(host) {
52190
52256
  suppressInteropError
52191
52257
  );
52192
52258
  if (targetSymbol) {
52193
- if (name.escapedText) {
52259
+ if (nameText || name.kind === 11 /* StringLiteral */) {
52194
52260
  if (isShorthandAmbientModuleSymbol(moduleSymbol)) {
52195
52261
  return moduleSymbol;
52196
52262
  }
@@ -52198,16 +52264,16 @@ function createTypeChecker(host) {
52198
52264
  if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=" /* ExportEquals */)) {
52199
52265
  symbolFromVariable = getPropertyOfType(
52200
52266
  getTypeOfSymbol(targetSymbol),
52201
- name.escapedText,
52267
+ nameText,
52202
52268
  /*skipObjectFunctionPropertyAugment*/
52203
52269
  true
52204
52270
  );
52205
52271
  } else {
52206
- symbolFromVariable = getPropertyOfVariable(targetSymbol, name.escapedText);
52272
+ symbolFromVariable = getPropertyOfVariable(targetSymbol, nameText);
52207
52273
  }
52208
52274
  symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias);
52209
- let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
52210
- if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) {
52275
+ let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
52276
+ if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
52211
52277
  const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
52212
52278
  if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
52213
52279
  symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
@@ -52225,7 +52291,7 @@ function createTypeChecker(host) {
52225
52291
  var _a;
52226
52292
  const moduleName = getFullyQualifiedName(moduleSymbol, node);
52227
52293
  const declarationName = declarationNameToString(name);
52228
- const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
52294
+ const suggestion = isIdentifier(name) ? getSuggestedSymbolForNonexistentModule(name, targetSymbol) : void 0;
52229
52295
  if (suggestion !== void 0) {
52230
52296
  const suggestionName = symbolToString(suggestion);
52231
52297
  const diagnostic = error2(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
@@ -52247,7 +52313,7 @@ function createTypeChecker(host) {
52247
52313
  }
52248
52314
  function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
52249
52315
  var _a, _b;
52250
- const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(name.escapedText);
52316
+ const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(moduleExportNameTextEscaped(name));
52251
52317
  const exports2 = moduleSymbol.exports;
52252
52318
  if (localSymbol) {
52253
52319
  const exportedEqualsSymbol = exports2 == null ? void 0 : exports2.get("export=" /* ExportEquals */);
@@ -52279,7 +52345,7 @@ function createTypeChecker(host) {
52279
52345
  }
52280
52346
  }
52281
52347
  function getTargetOfImportSpecifier(node, dontResolveAlias) {
52282
- if (isImportSpecifier(node) && idText(node.propertyName || node.name) === "default" /* Default */) {
52348
+ if (isImportSpecifier(node) && moduleExportNameIsDefault(node.propertyName || node.name)) {
52283
52349
  const specifier = getModuleSpecifierForImportOrExport(node);
52284
52350
  const moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
52285
52351
  if (moduleSymbol) {
@@ -52323,19 +52389,23 @@ function createTypeChecker(host) {
52323
52389
  }
52324
52390
  }
52325
52391
  function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
52326
- if (idText(node.propertyName || node.name) === "default" /* Default */) {
52392
+ const name = node.propertyName || node.name;
52393
+ if (moduleExportNameIsDefault(name)) {
52327
52394
  const specifier = getModuleSpecifierForImportOrExport(node);
52328
52395
  const moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
52329
52396
  if (moduleSymbol) {
52330
52397
  return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);
52331
52398
  }
52332
52399
  }
52333
- const resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : resolveEntityName(
52334
- node.propertyName || node.name,
52335
- meaning,
52336
- /*ignoreErrors*/
52337
- false,
52338
- dontResolveAlias
52400
+ const resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : name.kind === 11 /* StringLiteral */ ? void 0 : (
52401
+ // Skip for invalid syntax like this: export { "x" }
52402
+ resolveEntityName(
52403
+ name,
52404
+ meaning,
52405
+ /*ignoreErrors*/
52406
+ false,
52407
+ dontResolveAlias
52408
+ )
52339
52409
  );
52340
52410
  markSymbolOfAliasDeclarationIfTypeOnly(
52341
52411
  node,
@@ -56932,9 +57002,10 @@ function createTypeChecker(host) {
56932
57002
  if (index >= 0) {
56933
57003
  const exportDecl = statements[index];
56934
57004
  const replacements = mapDefined(exportDecl.exportClause.elements, (e) => {
56935
- if (!e.propertyName) {
57005
+ if (!e.propertyName && e.name.kind !== 11 /* StringLiteral */) {
57006
+ const name = e.name;
56936
57007
  const indices = indicesOf(statements);
56937
- const associatedIndices = filter(indices, (i) => nodeHasName(statements[i], e.name));
57008
+ const associatedIndices = filter(indices, (i) => nodeHasName(statements[i], name));
56938
57009
  if (length(associatedIndices) && every(associatedIndices, (i) => canHaveExportModifier(statements[i]))) {
56939
57010
  for (const index2 of associatedIndices) {
56940
57011
  statements[index2] = addExportModifier(statements[index2]);
@@ -57568,7 +57639,7 @@ function createTypeChecker(host) {
57568
57639
  function getSomeTargetNameFromDeclarations(declarations) {
57569
57640
  return firstDefined(declarations, (d) => {
57570
57641
  if (isImportSpecifier(d) || isExportSpecifier(d)) {
57571
- return idText(d.propertyName || d.name);
57642
+ return moduleExportNameTextUnescaped(d.propertyName || d.name);
57572
57643
  }
57573
57644
  if (isBinaryExpression(d) || isExportAssignment(d)) {
57574
57645
  const expression = isExportAssignment(d) ? d.expression : d.right;
@@ -57586,7 +57657,7 @@ function createTypeChecker(host) {
57586
57657
  });
57587
57658
  }
57588
57659
  function serializeAsAlias(symbol, localName, modifierFlags) {
57589
- var _a2, _b, _c, _d, _e, _f;
57660
+ var _a2, _b, _c, _d, _e;
57590
57661
  const node = getDeclarationOfAliasSymbol(symbol);
57591
57662
  if (!node) return Debug.fail();
57592
57663
  const target = getMergedSymbol(getTargetOfAliasDeclaration(
@@ -57784,8 +57855,11 @@ function createTypeChecker(host) {
57784
57855
  }
57785
57856
  case 281 /* ExportSpecifier */:
57786
57857
  const specifier = node.parent.parent.moduleSpecifier;
57787
- if (specifier && ((_f = node.propertyName) == null ? void 0 : _f.escapedText) === "default" /* Default */) {
57788
- verbatimTargetName = "default" /* Default */;
57858
+ if (specifier) {
57859
+ const propertyName = node.propertyName;
57860
+ if (propertyName && moduleExportNameIsDefault(propertyName)) {
57861
+ verbatimTargetName = "default" /* Default */;
57862
+ }
57789
57863
  }
57790
57864
  serializeExportSpecifier(
57791
57865
  unescapeLeadingUnderscores(symbol.escapedName),
@@ -58498,7 +58572,7 @@ function createTypeChecker(host) {
58498
58572
  }
58499
58573
  function collectLinkedAliases(node, setVisibility) {
58500
58574
  let exportSymbol;
58501
- if (node.parent && node.parent.kind === 277 /* ExportAssignment */) {
58575
+ if (node.kind !== 11 /* StringLiteral */ && node.parent && node.parent.kind === 277 /* ExportAssignment */) {
58502
58576
  exportSymbol = resolveName(
58503
58577
  node,
58504
58578
  node,
@@ -74071,9 +74145,10 @@ function createTypeChecker(host) {
74071
74145
  return;
74072
74146
  case 281 /* ExportSpecifier */:
74073
74147
  const exportDeclaration = node.parent.parent;
74074
- if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) {
74148
+ const name = node.propertyName || node.name;
74149
+ if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier && name.kind !== 11 /* StringLiteral */) {
74075
74150
  const symbol = resolveEntityName(
74076
- node.propertyName || node.name,
74151
+ name,
74077
74152
  111551 /* Value */,
74078
74153
  /*ignoreErrors*/
74079
74154
  true,
@@ -74367,6 +74442,9 @@ function createTypeChecker(host) {
74367
74442
  function markExportSpecifierAliasReferenced(location) {
74368
74443
  if (!location.parent.parent.moduleSpecifier && !location.isTypeOnly && !location.parent.parent.isTypeOnly) {
74369
74444
  const exportedName = location.propertyName || location.name;
74445
+ if (exportedName.kind === 11 /* StringLiteral */) {
74446
+ return;
74447
+ }
74370
74448
  const symbol = resolveName(
74371
74449
  exportedName,
74372
74450
  exportedName.escapedText,
@@ -74381,7 +74459,7 @@ function createTypeChecker(host) {
74381
74459
  const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
74382
74460
  if (!target || getSymbolFlags(target) & 111551 /* Value */) {
74383
74461
  markExportAsReferenced(location);
74384
- markIdentifierAliasReferenced(location.propertyName || location.name);
74462
+ markIdentifierAliasReferenced(exportedName);
74385
74463
  }
74386
74464
  }
74387
74465
  return;
@@ -87977,6 +88055,16 @@ function createTypeChecker(host) {
87977
88055
  }
87978
88056
  return true;
87979
88057
  }
88058
+ function checkModuleExportName(name, allowStringLiteral = true) {
88059
+ if (name === void 0 || name.kind !== 11 /* StringLiteral */) {
88060
+ return;
88061
+ }
88062
+ if (!allowStringLiteral) {
88063
+ grammarErrorOnNode(name, Diagnostics.Identifier_expected);
88064
+ } else if (moduleKind === 5 /* ES2015 */ || moduleKind === 6 /* ES2020 */) {
88065
+ grammarErrorOnNode(name, Diagnostics.String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es2020);
88066
+ }
88067
+ }
87980
88068
  function checkAliasSymbol(node) {
87981
88069
  var _a, _b, _c, _d;
87982
88070
  let symbol = getSymbolOfDeclaration(node);
@@ -87988,7 +88076,7 @@ function createTypeChecker(host) {
87988
88076
  Debug.assert(node.kind !== 280 /* NamespaceExport */);
87989
88077
  if (node.kind === 281 /* ExportSpecifier */) {
87990
88078
  const diag2 = error2(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
87991
- const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText);
88079
+ const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get(moduleExportNameTextEscaped(node.propertyName || node.name));
87992
88080
  if (alreadyExportedSymbol === target) {
87993
88081
  const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
87994
88082
  if (exportingDeclaration) {
@@ -88043,7 +88131,7 @@ function createTypeChecker(host) {
88043
88131
  if (compilerOptions.verbatimModuleSyntax) {
88044
88132
  Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name");
88045
88133
  const message = compilerOptions.verbatimModuleSyntax && isInternalModuleImportEqualsDeclaration(node) ? Diagnostics.An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled : isType ? Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled : Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled;
88046
- const name = idText(node.kind === 276 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
88134
+ const name = moduleExportNameTextUnescaped(node.kind === 276 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
88047
88135
  addTypeOnlyDeclarationRelatedInfo(
88048
88136
  error2(node, message, name),
88049
88137
  isType ? void 0 : typeOnlyAlias,
@@ -88057,7 +88145,7 @@ function createTypeChecker(host) {
88057
88145
  }
88058
88146
  case 281 /* ExportSpecifier */: {
88059
88147
  if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) {
88060
- const name = idText(node.propertyName || node.name);
88148
+ const name = moduleExportNameTextUnescaped(node.propertyName || node.name);
88061
88149
  const diagnostic = isType ? error2(node, Diagnostics.Re_exporting_a_type_when_0_is_enabled_requires_using_export_type, isolatedModulesLikeFlagName) : error2(node, Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_enabled, name, isolatedModulesLikeFlagName);
88062
88150
  addTypeOnlyDeclarationRelatedInfo(diagnostic, isType ? void 0 : typeOnlyAlias, name);
88063
88151
  break;
@@ -88107,8 +88195,11 @@ function createTypeChecker(host) {
88107
88195
  function checkImportBinding(node) {
88108
88196
  checkCollisionsForDeclarationName(node, node.name);
88109
88197
  checkAliasSymbol(node);
88110
- if (node.kind === 276 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88111
- checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88198
+ if (node.kind === 276 /* ImportSpecifier */) {
88199
+ checkModuleExportName(node.propertyName);
88200
+ if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88201
+ checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88202
+ }
88112
88203
  }
88113
88204
  }
88114
88205
  function checkImportAttributes(declaration) {
@@ -88229,6 +88320,7 @@ function createTypeChecker(host) {
88229
88320
  error2(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
88230
88321
  } else if (node.exportClause) {
88231
88322
  checkAliasSymbol(node.exportClause);
88323
+ checkModuleExportName(node.exportClause.name);
88232
88324
  }
88233
88325
  if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88234
88326
  if (node.exportClause) {
@@ -88259,6 +88351,9 @@ function createTypeChecker(host) {
88259
88351
  }
88260
88352
  function checkExportSpecifier(node) {
88261
88353
  checkAliasSymbol(node);
88354
+ const hasModuleSpecifier = node.parent.parent.moduleSpecifier !== void 0;
88355
+ checkModuleExportName(node.propertyName, hasModuleSpecifier);
88356
+ checkModuleExportName(node.name);
88262
88357
  if (getEmitDeclarations(compilerOptions)) {
88263
88358
  collectLinkedAliases(
88264
88359
  node.propertyName || node.name,
@@ -88266,8 +88361,11 @@ function createTypeChecker(host) {
88266
88361
  true
88267
88362
  );
88268
88363
  }
88269
- if (!node.parent.parent.moduleSpecifier) {
88364
+ if (!hasModuleSpecifier) {
88270
88365
  const exportedName = node.propertyName || node.name;
88366
+ if (exportedName.kind === 11 /* StringLiteral */) {
88367
+ return;
88368
+ }
88271
88369
  const symbol = resolveName(
88272
88370
  exportedName,
88273
88371
  exportedName.escapedText,
@@ -88283,7 +88381,7 @@ function createTypeChecker(host) {
88283
88381
  markLinkedReferences(node, 7 /* ExportSpecifier */);
88284
88382
  }
88285
88383
  } else {
88286
- if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && idText(node.propertyName || node.name) === "default") {
88384
+ if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && moduleExportNameIsDefault(node.propertyName || node.name)) {
88287
88385
  checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88288
88386
  }
88289
88387
  }
@@ -89438,7 +89536,11 @@ function createTypeChecker(host) {
89438
89536
  }
89439
89537
  function getExportSpecifierLocalTargetSymbol(node) {
89440
89538
  if (isExportSpecifier(node)) {
89441
- return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
89539
+ const name = node.propertyName || node.name;
89540
+ return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : name.kind === 11 /* StringLiteral */ ? void 0 : (
89541
+ // Skip for invalid syntax like this: export { "x" }
89542
+ resolveEntityName(name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)
89543
+ );
89442
89544
  } else {
89443
89545
  return resolveEntityName(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
89444
89546
  }
@@ -90409,7 +90511,8 @@ function createTypeChecker(host) {
90409
90511
  resolveExternalModuleSymbol(sym);
90410
90512
  return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
90411
90513
  },
90412
- isImportRequiredByAugmentation
90514
+ isImportRequiredByAugmentation,
90515
+ isDefinitelyReferenceToGlobalSymbolObject
90413
90516
  };
90414
90517
  function isImportRequiredByAugmentation(node) {
90415
90518
  const file = getSourceFileOfNode(node);
@@ -92248,7 +92351,7 @@ function isDeclarationNameOrImportPropertyName(name) {
92248
92351
  switch (name.parent.kind) {
92249
92352
  case 276 /* ImportSpecifier */:
92250
92353
  case 281 /* ExportSpecifier */:
92251
- return isIdentifier(name);
92354
+ return isIdentifier(name) || name.kind === 11 /* StringLiteral */;
92252
92355
  default:
92253
92356
  return isDeclarationName(name);
92254
92357
  }
@@ -93493,7 +93596,7 @@ var visitEachChildTable = {
93493
93596
  return context.factory.updateImportSpecifier(
93494
93597
  node,
93495
93598
  node.isTypeOnly,
93496
- nodeVisitor(node.propertyName, visitor, isIdentifier),
93599
+ nodeVisitor(node.propertyName, visitor, isModuleExportName),
93497
93600
  Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
93498
93601
  );
93499
93602
  },
@@ -93524,8 +93627,8 @@ var visitEachChildTable = {
93524
93627
  return context.factory.updateExportSpecifier(
93525
93628
  node,
93526
93629
  node.isTypeOnly,
93527
- nodeVisitor(node.propertyName, visitor, isIdentifier),
93528
- Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
93630
+ nodeVisitor(node.propertyName, visitor, isModuleExportName),
93631
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isModuleExportName))
93529
93632
  );
93530
93633
  },
93531
93634
  // Module references
@@ -94241,7 +94344,7 @@ function containsDefaultReference(node) {
94241
94344
  return some(node.elements, isNamedDefaultReference);
94242
94345
  }
94243
94346
  function isNamedDefaultReference(e) {
94244
- return e.propertyName !== void 0 ? e.propertyName.escapedText === "default" /* Default */ : e.name.escapedText === "default" /* Default */;
94347
+ return moduleExportNameIsDefault(e.propertyName || e.name);
94245
94348
  }
94246
94349
  function chainBundle(context, transformSourceFile) {
94247
94350
  return transformSourceFileOrBundle;
@@ -94317,9 +94420,10 @@ function collectExternalModuleInfo(context, sourceFile) {
94317
94420
  hasImportDefault || (hasImportDefault = containsDefaultReference(node.exportClause));
94318
94421
  } else {
94319
94422
  const name = node.exportClause.name;
94320
- if (!uniqueExports.get(idText(name))) {
94423
+ const nameText = moduleExportNameTextUnescaped(name);
94424
+ if (!uniqueExports.get(nameText)) {
94321
94425
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
94322
- uniqueExports.set(idText(name), true);
94426
+ uniqueExports.set(nameText, true);
94323
94427
  exportedNames = append(exportedNames, name);
94324
94428
  }
94325
94429
  hasImportStar = true;
@@ -94377,20 +94481,23 @@ function collectExternalModuleInfo(context, sourceFile) {
94377
94481
  return { externalImports, exportSpecifiers, exportEquals, hasExportStarsToExportValues, exportedBindings, exportedNames, exportedFunctions, externalHelpersImportDeclaration };
94378
94482
  function addExportedNamesForExportDeclaration(node) {
94379
94483
  for (const specifier of cast(node.exportClause, isNamedExports).elements) {
94380
- if (!uniqueExports.get(idText(specifier.name))) {
94484
+ const specifierNameText = moduleExportNameTextUnescaped(specifier.name);
94485
+ if (!uniqueExports.get(specifierNameText)) {
94381
94486
  const name = specifier.propertyName || specifier.name;
94382
- if (!node.moduleSpecifier) {
94383
- exportSpecifiers.add(name, specifier);
94384
- }
94385
- const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
94386
- if (decl) {
94387
- if (decl.kind === 262 /* FunctionDeclaration */) {
94388
- addExportedFunctionDeclaration(decl, specifier.name, specifier.name.escapedText === "default" /* Default */);
94389
- continue;
94487
+ if (name.kind !== 11 /* StringLiteral */) {
94488
+ if (!node.moduleSpecifier) {
94489
+ exportSpecifiers.add(name, specifier);
94490
+ }
94491
+ const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
94492
+ if (decl) {
94493
+ if (decl.kind === 262 /* FunctionDeclaration */) {
94494
+ addExportedFunctionDeclaration(decl, specifier.name, moduleExportNameIsDefault(specifier.name));
94495
+ continue;
94496
+ }
94497
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
94390
94498
  }
94391
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
94392
94499
  }
94393
- uniqueExports.set(idText(specifier.name), true);
94500
+ uniqueExports.set(specifierNameText, true);
94394
94501
  exportedNames = append(exportedNames, specifier.name);
94395
94502
  }
94396
94503
  }
@@ -94404,9 +94511,10 @@ function collectExternalModuleInfo(context, sourceFile) {
94404
94511
  }
94405
94512
  } else {
94406
94513
  name ?? (name = node.name);
94407
- if (!uniqueExports.get(idText(name))) {
94514
+ const nameText = moduleExportNameTextUnescaped(name);
94515
+ if (!uniqueExports.get(nameText)) {
94408
94516
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
94409
- uniqueExports.set(idText(name), true);
94517
+ uniqueExports.set(nameText, true);
94410
94518
  }
94411
94519
  }
94412
94520
  }
@@ -111693,7 +111801,7 @@ function transformModule(context) {
111693
111801
  factory2.createExpressionStatement(
111694
111802
  reduceLeft(
111695
111803
  currentModuleInfo.exportedNames.slice(i, i + chunkSize),
111696
- (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev),
111804
+ (prev, nextId) => nextId.kind === 11 /* StringLiteral */ ? factory2.createAssignment(factory2.createElementAccessExpression(factory2.createIdentifier("exports"), factory2.createStringLiteral(nextId.text)), prev) : factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev),
111697
111805
  factory2.createVoidZero()
111698
111806
  )
111699
111807
  )
@@ -112016,7 +112124,10 @@ function transformModule(context) {
112016
112124
  append(statements, createUnderscoreUnderscoreESModule());
112017
112125
  }
112018
112126
  if (some(currentModuleInfo.exportedNames)) {
112019
- append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
112127
+ append(
112128
+ statements,
112129
+ factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => nextId.kind === 11 /* StringLiteral */ ? factory2.createAssignment(factory2.createElementAccessExpression(factory2.createIdentifier("exports"), factory2.createStringLiteral(nextId.text)), prev) : factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero()))
112130
+ );
112020
112131
  }
112021
112132
  for (const f of currentModuleInfo.exportedFunctions) {
112022
112133
  appendExportsOfHoistedDeclaration(statements, f);
@@ -112887,17 +112998,16 @@ function transformModule(context) {
112887
112998
  );
112888
112999
  }
112889
113000
  for (const specifier of node.exportClause.elements) {
112890
- const exportNeedsImportDefault = !!getESModuleInterop(compilerOptions) && !(getInternalEmitFlags(node) & 2 /* NeverApplyImportHelper */) && idText(specifier.propertyName || specifier.name) === "default";
112891
- const exportedValue = factory2.createPropertyAccessExpression(
112892
- exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName,
112893
- specifier.propertyName || specifier.name
112894
- );
113001
+ const specifierName = specifier.propertyName || specifier.name;
113002
+ const exportNeedsImportDefault = !!getESModuleInterop(compilerOptions) && !(getInternalEmitFlags(node) & 2 /* NeverApplyImportHelper */) && moduleExportNameIsDefault(specifierName);
113003
+ const target = exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName;
113004
+ const exportedValue = specifierName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, specifierName) : factory2.createPropertyAccessExpression(target, specifierName);
112895
113005
  statements.push(
112896
113006
  setOriginalNode(
112897
113007
  setTextRange(
112898
113008
  factory2.createExpressionStatement(
112899
113009
  createExportExpression(
112900
- factory2.getExportName(specifier),
113010
+ specifier.name.kind === 11 /* StringLiteral */ ? factory2.cloneNode(specifier.name) : factory2.getExportName(specifier),
112901
113011
  exportedValue,
112902
113012
  /*location*/
112903
113013
  void 0,
@@ -112922,7 +113032,7 @@ function transformModule(context) {
112922
113032
  factory2.cloneNode(node.exportClause.name),
112923
113033
  getHelperExpressionForExport(
112924
113034
  node,
112925
- moduleKind !== 2 /* AMD */ ? createRequireCall2(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
113035
+ moduleKind !== 2 /* AMD */ ? createRequireCall2(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : node.exportClause.name.kind === 11 /* StringLiteral */ ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
112926
113036
  )
112927
113037
  )
112928
113038
  ),
@@ -113252,10 +113362,13 @@ function transformModule(context) {
113252
113362
  return statements;
113253
113363
  }
113254
113364
  function appendExportStatement(statements, seen, exportName, expression, location, allowComments, liveBinding) {
113255
- if (!seen.has(exportName)) {
113365
+ if (exportName.kind !== 11 /* StringLiteral */) {
113366
+ if (seen.has(exportName)) {
113367
+ return statements;
113368
+ }
113256
113369
  seen.set(exportName, true);
113257
- statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
113258
113370
  }
113371
+ statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
113259
113372
  return statements;
113260
113373
  }
113261
113374
  function createUnderscoreUnderscoreESModule() {
@@ -113325,7 +113438,10 @@ function transformModule(context) {
113325
113438
  ])
113326
113439
  ]
113327
113440
  ) : factory2.createAssignment(
113328
- factory2.createPropertyAccessExpression(
113441
+ name.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(
113442
+ factory2.createIdentifier("exports"),
113443
+ factory2.cloneNode(name)
113444
+ ) : factory2.createPropertyAccessExpression(
113329
113445
  factory2.createIdentifier("exports"),
113330
113446
  factory2.cloneNode(name)
113331
113447
  ),
@@ -113461,11 +113577,9 @@ function transformModule(context) {
113461
113577
  );
113462
113578
  } else if (isImportSpecifier(importDeclaration)) {
113463
113579
  const name = importDeclaration.propertyName || importDeclaration.name;
113580
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
113464
113581
  return setTextRange(
113465
- factory2.createPropertyAccessExpression(
113466
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
113467
- factory2.cloneNode(name)
113468
- ),
113582
+ name.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(name)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(name)),
113469
113583
  /*location*/
113470
113584
  node
113471
113585
  );
@@ -113753,7 +113867,7 @@ function transformSystemModule(context) {
113753
113867
  const exportedNames = [];
113754
113868
  if (moduleInfo.exportedNames) {
113755
113869
  for (const exportedLocalName of moduleInfo.exportedNames) {
113756
- if (exportedLocalName.escapedText === "default") {
113870
+ if (moduleExportNameIsDefault(exportedLocalName)) {
113757
113871
  continue;
113758
113872
  }
113759
113873
  exportedNames.push(
@@ -113931,10 +114045,10 @@ function transformSystemModule(context) {
113931
114045
  for (const e of entry.exportClause.elements) {
113932
114046
  properties.push(
113933
114047
  factory2.createPropertyAssignment(
113934
- factory2.createStringLiteral(idText(e.name)),
114048
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(e.name)),
113935
114049
  factory2.createElementAccessExpression(
113936
114050
  parameterName,
113937
- factory2.createStringLiteral(idText(e.propertyName || e.name))
114051
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(e.propertyName || e.name))
113938
114052
  )
113939
114053
  )
113940
114054
  );
@@ -113961,7 +114075,7 @@ function transformSystemModule(context) {
113961
114075
  /*typeArguments*/
113962
114076
  void 0,
113963
114077
  [
113964
- factory2.createStringLiteral(idText(entry.exportClause.name)),
114078
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(entry.exportClause.name)),
113965
114079
  parameterName
113966
114080
  ]
113967
114081
  )
@@ -114301,7 +114415,7 @@ function transformSystemModule(context) {
114301
114415
  const exportSpecifiers = moduleInfo.exportSpecifiers.get(name);
114302
114416
  if (exportSpecifiers) {
114303
114417
  for (const exportSpecifier of exportSpecifiers) {
114304
- if (exportSpecifier.name.escapedText !== excludeName) {
114418
+ if (moduleExportNameTextUnescaped(exportSpecifier.name) !== excludeName) {
114305
114419
  statements = appendExportStatement(statements, exportSpecifier.name, name);
114306
114420
  }
114307
114421
  }
@@ -114722,13 +114836,12 @@ function transformSystemModule(context) {
114722
114836
  node
114723
114837
  );
114724
114838
  } else if (isImportSpecifier(importDeclaration)) {
114839
+ const importedName = importDeclaration.propertyName || importDeclaration.name;
114840
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
114725
114841
  return setTextRange(
114726
114842
  factory2.createPropertyAssignment(
114727
114843
  factory2.cloneNode(name),
114728
- factory2.createPropertyAccessExpression(
114729
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
114730
- factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name)
114731
- )
114844
+ importedName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(importedName)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(importedName))
114732
114845
  ),
114733
114846
  /*location*/
114734
114847
  node
@@ -114771,11 +114884,10 @@ function transformSystemModule(context) {
114771
114884
  node
114772
114885
  );
114773
114886
  } else if (isImportSpecifier(importDeclaration)) {
114887
+ const importedName = importDeclaration.propertyName || importDeclaration.name;
114888
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
114774
114889
  return setTextRange(
114775
- factory2.createPropertyAccessExpression(
114776
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
114777
- factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name)
114778
- ),
114890
+ importedName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(importedName)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(importedName)),
114779
114891
  /*location*/
114780
114892
  node
114781
114893
  );
@@ -116366,15 +116478,17 @@ function transformDeclarations(context) {
116366
116478
  if (isDeclarationAndNotVisible(input)) return;
116367
116479
  if (hasDynamicName(input)) {
116368
116480
  if (isolatedDeclarations) {
116369
- if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
116370
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
116371
- return;
116372
- } else if (
116373
- // Type declarations just need to double-check that the input computed name is an entity name expression
116374
- (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
116375
- ) {
116376
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
116377
- return;
116481
+ if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
116482
+ if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
116483
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
116484
+ return;
116485
+ } else if (
116486
+ // Type declarations just need to double-check that the input computed name is an entity name expression
116487
+ (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
116488
+ ) {
116489
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
116490
+ return;
116491
+ }
116378
116492
  }
116379
116493
  } else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
116380
116494
  return;
@@ -118334,7 +118448,8 @@ var notImplementedResolver = {
118334
118448
  getJsxFragmentFactoryEntity: notImplemented,
118335
118449
  isBindingCapturedByNode: notImplemented,
118336
118450
  getDeclarationStatementsForSourceFile: notImplemented,
118337
- isImportRequiredByAugmentation: notImplemented
118451
+ isImportRequiredByAugmentation: notImplemented,
118452
+ isDefinitelyReferenceToGlobalSymbolObject: notImplemented
118338
118453
  };
118339
118454
  var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
118340
118455
  var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -134846,7 +134961,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
134846
134961
  expression,
134847
134962
  /*includeBigInt*/
134848
134963
  false
134849
- )) {
134964
+ ) && !resolver.isDefinitelyReferenceToGlobalSymbolObject(expression)) {
134850
134965
  context.tracker.reportInferenceFallback(prop.name);
134851
134966
  result = false;
134852
134967
  }
@@ -143084,9 +143199,9 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
143084
143199
  const namespaceImportName = namespaceNameConflicts ? getUniqueName(preferredName, sourceFile) : preferredName;
143085
143200
  const neededNamedImports = /* @__PURE__ */ new Set();
143086
143201
  for (const element of toConvert.elements) {
143087
- const propertyName = (element.propertyName || element.name).text;
143202
+ const propertyName = element.propertyName || element.name;
143088
143203
  ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, (id) => {
143089
- const access = factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), propertyName);
143204
+ const access = propertyName.kind === 11 /* StringLiteral */ ? factory.createElementAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName)) : factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName));
143090
143205
  if (isShorthandPropertyAssignment(id.parent)) {
143091
143206
  changes.replaceNode(sourceFile, id.parent, factory.createPropertyAssignment(id.text, access));
143092
143207
  } else if (isExportSpecifier(id.parent)) {
@@ -143102,7 +143217,7 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
143102
143217
  shouldUseDefault ? factory.createIdentifier(namespaceImportName) : factory.createNamespaceImport(factory.createIdentifier(namespaceImportName))
143103
143218
  );
143104
143219
  if (neededNamedImports.size && isImportDeclaration(importDecl)) {
143105
- const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.createIdentifier(element.propertyName.text), factory.createIdentifier(element.name.text)));
143220
+ const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.cloneNode(element.propertyName), factory.cloneNode(element.name)));
143106
143221
  changes.insertNodeAfter(sourceFile, toConvert.parent.parent, createImport(
143107
143222
  importDecl,
143108
143223
  /*defaultImportName*/
@@ -163518,10 +163633,18 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163518
163633
  hasAction = !importStatementCompletion;
163519
163634
  }
163520
163635
  const parentNamedImportOrExport = findAncestor(location, isNamedImportsOrExports);
163521
- if ((parentNamedImportOrExport == null ? void 0 : parentNamedImportOrExport.kind) === 275 /* NamedImports */) {
163522
- const possibleToken = stringToToken(name);
163523
- if (parentNamedImportOrExport && possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
163524
- insertText = `${name} as ${name}_`;
163636
+ if (parentNamedImportOrExport) {
163637
+ const languageVersion = getEmitScriptTarget(host.getCompilationSettings());
163638
+ if (!isIdentifierText(name, languageVersion)) {
163639
+ insertText = JSON.stringify(name);
163640
+ if (parentNamedImportOrExport.kind === 275 /* NamedImports */) {
163641
+ insertText += " as " + generateIdentifierForArbitraryString(name, languageVersion);
163642
+ }
163643
+ } else if (parentNamedImportOrExport.kind === 275 /* NamedImports */) {
163644
+ const possibleToken = stringToToken(name);
163645
+ if (possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
163646
+ insertText = `${name} as ${name}_`;
163647
+ }
163525
163648
  }
163526
163649
  }
163527
163650
  return {
@@ -163544,6 +163667,23 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163544
163667
  ...includeSymbol ? { symbol } : void 0
163545
163668
  };
163546
163669
  }
163670
+ function generateIdentifierForArbitraryString(text, languageVersion) {
163671
+ let needsUnderscore = false;
163672
+ let identifier = "";
163673
+ let ch;
163674
+ for (let i = 0; i < text.length; i += ch !== void 0 && ch >= 65536 ? 2 : 1) {
163675
+ ch = text.codePointAt(i);
163676
+ if (ch !== void 0 && (i === 0 ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
163677
+ if (needsUnderscore) identifier += "_";
163678
+ identifier += String.fromCodePoint(ch);
163679
+ needsUnderscore = false;
163680
+ } else {
163681
+ needsUnderscore = true;
163682
+ }
163683
+ }
163684
+ if (needsUnderscore) identifier += "_";
163685
+ return identifier || "_";
163686
+ }
163547
163687
  function isClassLikeMemberCompletion(symbol, location, sourceFile) {
163548
163688
  if (isInJSFile(location)) {
163549
163689
  return false;
@@ -165375,7 +165515,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
165375
165515
  completionKind = 3 /* MemberLike */;
165376
165516
  isNewIdentifierLocation = false;
165377
165517
  const exports2 = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol);
165378
- const existing = new Set(namedImportsOrExports.elements.filter((n) => !isCurrentlyEditingNode(n)).map((n) => (n.propertyName || n.name).escapedText));
165518
+ const existing = new Set(namedImportsOrExports.elements.filter((n) => !isCurrentlyEditingNode(n)).map((n) => moduleExportNameTextEscaped(n.propertyName || n.name)));
165379
165519
  const uniques = exports2.filter((e) => e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName));
165380
165520
  symbols = concatenate(symbols, uniques);
165381
165521
  if (!uniques.length) {
@@ -165866,6 +166006,9 @@ function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, js
165866
166006
  if (isIdentifierText(name, target, jsxIdentifierExpected ? 1 /* JSX */ : 0 /* Standard */) || symbol.valueDeclaration && isPrivateIdentifierClassElementDeclaration(symbol.valueDeclaration)) {
165867
166007
  return validNameResult;
165868
166008
  }
166009
+ if (symbol.flags & 2097152 /* Alias */) {
166010
+ return { name, needsConvertPropertyAccess: true };
166011
+ }
165869
166012
  switch (kind) {
165870
166013
  case 3 /* MemberLike */:
165871
166014
  return originIsComputedPropertyName(origin) ? { name: origin.symbolName, needsConvertPropertyAccess: false } : void 0;
@@ -166561,6 +166704,21 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
166561
166704
  }
166562
166705
  const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
166563
166706
  return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
166707
+ case 276 /* ImportSpecifier */:
166708
+ case 281 /* ExportSpecifier */:
166709
+ const specifier = parent2;
166710
+ if (specifier.propertyName && node !== specifier.propertyName) {
166711
+ return;
166712
+ }
166713
+ const namedImportsOrExports = specifier.parent;
166714
+ const { moduleSpecifier } = namedImportsOrExports.kind === 275 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent;
166715
+ if (!moduleSpecifier) return;
166716
+ const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier);
166717
+ if (!moduleSpecifierSymbol) return;
166718
+ const exports2 = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol);
166719
+ const existing = new Set(namedImportsOrExports.elements.map((n) => moduleExportNameTextEscaped(n.propertyName || n.name)));
166720
+ const uniques = exports2.filter((e) => e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName));
166721
+ return { kind: 1 /* Properties */, symbols: uniques, hasIndexSignature: false };
166564
166722
  default:
166565
166723
  return fromContextualType() || fromContextualType(0 /* None */);
166566
166724
  }
@@ -167531,12 +167689,12 @@ function getSearchesFromDirectImports(directImports, exportSymbol, exportKind, c
167531
167689
  }
167532
167690
  for (const element of namedBindings.elements) {
167533
167691
  const { name, propertyName } = element;
167534
- if (!isNameMatch((propertyName || name).escapedText)) {
167692
+ if (!isNameMatch(moduleExportNameTextEscaped(propertyName || name))) {
167535
167693
  continue;
167536
167694
  }
167537
167695
  if (propertyName) {
167538
167696
  singleReferences.push(propertyName);
167539
- if (!isForRename || name.escapedText === exportSymbol.escapedName) {
167697
+ if (!isForRename || moduleExportNameTextEscaped(name) === exportSymbol.escapedName) {
167540
167698
  addSearch(name, checker.getSymbolAtLocation(name));
167541
167699
  }
167542
167700
  } else {
@@ -168794,8 +168952,8 @@ var Core;
168794
168952
  function shouldAddSingleReference(singleRef, state) {
168795
168953
  if (!hasMatchingMeaning(singleRef, state)) return false;
168796
168954
  if (state.options.use !== 2 /* Rename */) return true;
168797
- if (!isIdentifier(singleRef)) return false;
168798
- return !(isImportOrExportSpecifier(singleRef.parent) && singleRef.escapedText === "default" /* Default */);
168955
+ if (!isIdentifier(singleRef) && !isImportOrExportSpecifier(singleRef.parent)) return false;
168956
+ return !(isImportOrExportSpecifier(singleRef.parent) && moduleExportNameIsDefault(singleRef));
168799
168957
  }
168800
168958
  function searchForImportedSymbol(symbol, state) {
168801
168959
  if (!symbol.declarations) return;
@@ -168957,7 +169115,7 @@ var Core;
168957
169115
  case 15 /* NoSubstitutionTemplateLiteral */:
168958
169116
  case 11 /* StringLiteral */: {
168959
169117
  const str = node;
168960
- return (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isCallExpression(node.parent) && isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node) && str.text.length === searchSymbolName.length;
169118
+ return str.text.length === searchSymbolName.length && (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isCallExpression(node.parent) && isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node || isImportOrExportSpecifier(node.parent));
168961
169119
  }
168962
169120
  case 9 /* NumericLiteral */:
168963
169121
  return isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length;
@@ -169023,7 +169181,7 @@ var Core;
169023
169181
  return;
169024
169182
  }
169025
169183
  if (isExportSpecifier(parent2)) {
169026
- Debug.assert(referenceLocation.kind === 80 /* Identifier */);
169184
+ Debug.assert(referenceLocation.kind === 80 /* Identifier */ || referenceLocation.kind === 11 /* StringLiteral */);
169027
169185
  getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent2, search, state, addReferencesHere);
169028
169186
  return;
169029
169187
  }
@@ -169073,7 +169231,7 @@ var Core;
169073
169231
  return;
169074
169232
  }
169075
169233
  if (!propertyName) {
169076
- if (!(state.options.use === 2 /* Rename */ && name.escapedText === "default" /* Default */)) {
169234
+ if (!(state.options.use === 2 /* Rename */ && moduleExportNameIsDefault(name))) {
169077
169235
  addRef();
169078
169236
  }
169079
169237
  } else if (referenceLocation === propertyName) {
@@ -169089,7 +169247,7 @@ var Core;
169089
169247
  }
169090
169248
  }
169091
169249
  if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
169092
- const isDefaultExport = referenceLocation.escapedText === "default" || exportSpecifier.name.escapedText === "default";
169250
+ const isDefaultExport = moduleExportNameIsDefault(referenceLocation) || moduleExportNameIsDefault(exportSpecifier.name);
169093
169251
  const exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
169094
169252
  const exportSymbol = Debug.checkDefined(exportSpecifier.symbol);
169095
169253
  const exportInfo = getExportInfo(exportSymbol, exportKind, state.checker);
@@ -170046,7 +170204,7 @@ function getSymbol(node, checker, stopAtAlias) {
170046
170204
  return { symbol, failedAliasResolution };
170047
170205
  }
170048
170206
  function shouldSkipAlias(node, declaration) {
170049
- if (node.kind !== 80 /* Identifier */) {
170207
+ if (node.kind !== 80 /* Identifier */ && (node.kind !== 11 /* StringLiteral */ || !isImportOrExportSpecifier(node.parent))) {
170050
170208
  return false;
170051
170209
  }
170052
170210
  if (node.parent === declaration) {
@@ -172059,7 +172217,7 @@ function hasModuleDeclarationMatchingSpecifier(sourceFile, moduleSpecifier) {
172059
172217
  return isString(moduleSpecifierText) && some(sourceFile.moduleAugmentations, (moduleName) => isStringLiteral(moduleName) && moduleName.text === moduleSpecifierText);
172060
172218
  }
172061
172219
  function getNewImportSpecifiers(namedImports) {
172062
- return flatMap(namedImports, (namedImport) => map(tryGetNamedBindingElements(namedImport), (importSpecifier) => importSpecifier.name && importSpecifier.propertyName && importSpecifier.name.escapedText === importSpecifier.propertyName.escapedText ? factory.updateImportSpecifier(
172220
+ return flatMap(namedImports, (namedImport) => map(tryGetNamedBindingElements(namedImport), (importSpecifier) => importSpecifier.name && importSpecifier.propertyName && moduleExportNameTextEscaped(importSpecifier.name) === moduleExportNameTextEscaped(importSpecifier.propertyName) ? factory.updateImportSpecifier(
172063
172221
  importSpecifier,
172064
172222
  importSpecifier.isTypeOnly,
172065
172223
  /*propertyName*/
@@ -178560,7 +178718,7 @@ __export(ts_exports2, {
178560
178718
  changeFullExtension: () => changeFullExtension,
178561
178719
  changesAffectModuleResolution: () => changesAffectModuleResolution,
178562
178720
  changesAffectingProgramStructure: () => changesAffectingProgramStructure,
178563
- characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
178721
+ characterCodeToRegularExpressionFlag: () => characterCodeToRegularExpressionFlag,
178564
178722
  childIsDecorated: () => childIsDecorated,
178565
178723
  classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
178566
178724
  classHasClassThisAssignment: () => classHasClassThisAssignment,
@@ -179895,6 +180053,7 @@ __export(ts_exports2, {
179895
180053
  isModuleBlock: () => isModuleBlock,
179896
180054
  isModuleBody: () => isModuleBody,
179897
180055
  isModuleDeclaration: () => isModuleDeclaration,
180056
+ isModuleExportName: () => isModuleExportName,
179898
180057
  isModuleExportsAccessExpression: () => isModuleExportsAccessExpression,
179899
180058
  isModuleIdentifier: () => isModuleIdentifier,
179900
180059
  isModuleName: () => isModuleName,
@@ -180212,6 +180371,9 @@ __export(ts_exports2, {
180212
180371
  missingFileModifiedTime: () => missingFileModifiedTime,
180213
180372
  modifierToFlag: () => modifierToFlag,
180214
180373
  modifiersToFlags: () => modifiersToFlags,
180374
+ moduleExportNameIsDefault: () => moduleExportNameIsDefault,
180375
+ moduleExportNameTextEscaped: () => moduleExportNameTextEscaped,
180376
+ moduleExportNameTextUnescaped: () => moduleExportNameTextUnescaped,
180215
180377
  moduleOptionDeclaration: () => moduleOptionDeclaration,
180216
180378
  moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
180217
180379
  moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
@@ -180357,7 +180519,7 @@ __export(ts_exports2, {
180357
180519
  reducePathComponents: () => reducePathComponents,
180358
180520
  refactor: () => ts_refactor_exports,
180359
180521
  regExpEscape: () => regExpEscape,
180360
- regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
180522
+ regularExpressionFlagToCharacterCode: () => regularExpressionFlagToCharacterCode,
180361
180523
  relativeComplement: () => relativeComplement,
180362
180524
  removeAllComments: () => removeAllComments,
180363
180525
  removeEmitHelper: () => removeEmitHelper,
@@ -192992,7 +193154,7 @@ if (typeof console !== "undefined") {
192992
193154
  changeFullExtension,
192993
193155
  changesAffectModuleResolution,
192994
193156
  changesAffectingProgramStructure,
192995
- characterToRegularExpressionFlag,
193157
+ characterCodeToRegularExpressionFlag,
192996
193158
  childIsDecorated,
192997
193159
  classElementOrClassElementParameterIsDecorated,
192998
193160
  classHasClassThisAssignment,
@@ -194327,6 +194489,7 @@ if (typeof console !== "undefined") {
194327
194489
  isModuleBlock,
194328
194490
  isModuleBody,
194329
194491
  isModuleDeclaration,
194492
+ isModuleExportName,
194330
194493
  isModuleExportsAccessExpression,
194331
194494
  isModuleIdentifier,
194332
194495
  isModuleName,
@@ -194644,6 +194807,9 @@ if (typeof console !== "undefined") {
194644
194807
  missingFileModifiedTime,
194645
194808
  modifierToFlag,
194646
194809
  modifiersToFlags,
194810
+ moduleExportNameIsDefault,
194811
+ moduleExportNameTextEscaped,
194812
+ moduleExportNameTextUnescaped,
194647
194813
  moduleOptionDeclaration,
194648
194814
  moduleResolutionIsEqualTo,
194649
194815
  moduleResolutionNameAndModeGetter,
@@ -194789,7 +194955,7 @@ if (typeof console !== "undefined") {
194789
194955
  reducePathComponents,
194790
194956
  refactor,
194791
194957
  regExpEscape,
194792
- regularExpressionFlagToCharacter,
194958
+ regularExpressionFlagToCharacterCode,
194793
194959
  relativeComplement,
194794
194960
  removeAllComments,
194795
194961
  removeEmitHelper,