typescript 5.5.0-dev.20240603 → 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/tsc.js CHANGED
@@ -17,8 +17,8 @@ and limitations under the License.
17
17
  "use strict";
18
18
 
19
19
  // src/compiler/corePublic.ts
20
- var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-dev.20240603`;
20
+ var versionMajorMinor = "5.6";
21
+ var version = `${versionMajorMinor}.0-dev.20240605`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -7873,7 +7873,8 @@ var Diagnostics = {
7873
7873
  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."),
7874
7874
  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."),
7875
7875
  _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."),
7876
- 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.")
7876
+ 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."),
7877
+ 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'.")
7877
7878
  };
7878
7879
 
7879
7880
  // src/compiler/scanner.ts
@@ -8033,16 +8034,16 @@ var textToToken = new Map(Object.entries({
8033
8034
  "#": 63 /* HashToken */,
8034
8035
  "`": 62 /* BacktickToken */
8035
8036
  }));
8036
- var charToRegExpFlag = new Map(Object.entries({
8037
- d: 1 /* HasIndices */,
8038
- g: 2 /* Global */,
8039
- i: 4 /* IgnoreCase */,
8040
- m: 8 /* Multiline */,
8041
- s: 16 /* DotAll */,
8042
- u: 32 /* Unicode */,
8043
- v: 64 /* UnicodeSets */,
8044
- y: 128 /* Sticky */
8045
- }));
8037
+ var charCodeToRegExpFlag = /* @__PURE__ */ new Map([
8038
+ [100 /* d */, 1 /* HasIndices */],
8039
+ [103 /* g */, 2 /* Global */],
8040
+ [105 /* i */, 4 /* IgnoreCase */],
8041
+ [109 /* m */, 8 /* Multiline */],
8042
+ [115 /* s */, 16 /* DotAll */],
8043
+ [117 /* u */, 32 /* Unicode */],
8044
+ [118 /* v */, 64 /* UnicodeSets */],
8045
+ [121 /* y */, 128 /* Sticky */]
8046
+ ]);
8046
8047
  var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
8047
8048
  [1 /* HasIndices */, 9 /* RegularExpressionFlagsHasIndices */],
8048
8049
  [16 /* DotAll */, 5 /* RegularExpressionFlagsDotAll */],
@@ -8098,9 +8099,9 @@ function tokenToString(t) {
8098
8099
  function stringToToken(s) {
8099
8100
  return textToToken.get(s);
8100
8101
  }
8101
- var regExpFlagChars = makeReverseMap(charToRegExpFlag);
8102
- function characterToRegularExpressionFlag(c) {
8103
- return charToRegExpFlag.get(c);
8102
+ var regExpFlagCharCodes = makeReverseMap(charCodeToRegExpFlag);
8103
+ function characterCodeToRegularExpressionFlag(ch) {
8104
+ return charCodeToRegExpFlag.get(ch);
8104
8105
  }
8105
8106
  function computeLineStarts(text) {
8106
8107
  const result = [];
@@ -9795,24 +9796,25 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9795
9796
  pos++;
9796
9797
  let regExpFlags = 0 /* None */;
9797
9798
  while (true) {
9798
- const ch = charCodeChecked(pos);
9799
+ const ch = codePointChecked(pos);
9799
9800
  if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
9800
9801
  break;
9801
9802
  }
9803
+ const size = charSize(ch);
9802
9804
  if (reportErrors2) {
9803
- const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
9805
+ const flag = characterCodeToRegularExpressionFlag(ch);
9804
9806
  if (flag === void 0) {
9805
- error(Diagnostics.Unknown_regular_expression_flag, pos, 1);
9807
+ error(Diagnostics.Unknown_regular_expression_flag, pos, size);
9806
9808
  } else if (regExpFlags & flag) {
9807
- error(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
9809
+ error(Diagnostics.Duplicate_regular_expression_flag, pos, size);
9808
9810
  } else if (((regExpFlags | flag) & 96 /* AnyUnicodeMode */) === 96 /* AnyUnicodeMode */) {
9809
- error(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, pos, 1);
9811
+ error(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, pos, size);
9810
9812
  } else {
9811
9813
  regExpFlags |= flag;
9812
- checkRegularExpressionFlagAvailable(flag, pos);
9814
+ checkRegularExpressionFlagAvailability(flag, size);
9813
9815
  }
9814
9816
  }
9815
- pos++;
9817
+ pos += size;
9816
9818
  }
9817
9819
  if (reportErrors2) {
9818
9820
  scanRange(startOfRegExpBody, endOfRegExpBody - startOfRegExpBody, () => {
@@ -10027,22 +10029,23 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10027
10029
  }
10028
10030
  function scanPatternModifiers(currFlags) {
10029
10031
  while (true) {
10030
- const ch = charCodeChecked(pos);
10032
+ const ch = codePointChecked(pos);
10031
10033
  if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
10032
10034
  break;
10033
10035
  }
10034
- const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
10036
+ const size = charSize(ch);
10037
+ const flag = characterCodeToRegularExpressionFlag(ch);
10035
10038
  if (flag === void 0) {
10036
- error(Diagnostics.Unknown_regular_expression_flag, pos, 1);
10039
+ error(Diagnostics.Unknown_regular_expression_flag, pos, size);
10037
10040
  } else if (currFlags & flag) {
10038
- error(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
10041
+ error(Diagnostics.Duplicate_regular_expression_flag, pos, size);
10039
10042
  } else if (!(flag & 28 /* Modifiers */)) {
10040
- error(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
10043
+ error(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, size);
10041
10044
  } else {
10042
10045
  currFlags |= flag;
10043
- checkRegularExpressionFlagAvailable(flag, pos);
10046
+ checkRegularExpressionFlagAvailability(flag, size);
10044
10047
  }
10045
- pos++;
10048
+ pos += size;
10046
10049
  }
10047
10050
  return currFlags;
10048
10051
  }
@@ -10646,6 +10649,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10646
10649
  forEach(groupNameReferences, (reference) => {
10647
10650
  if (!(groupSpecifiers == null ? void 0 : groupSpecifiers.has(reference.name))) {
10648
10651
  error(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
10652
+ if (groupSpecifiers) {
10653
+ const suggestion = getSpellingSuggestion(reference.name, groupSpecifiers, identity);
10654
+ if (suggestion) {
10655
+ error(Diagnostics.Did_you_mean_0, reference.pos, reference.end - reference.pos, suggestion);
10656
+ }
10657
+ }
10649
10658
  }
10650
10659
  });
10651
10660
  forEach(decimalEscapes, (escape) => {
@@ -10658,10 +10667,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10658
10667
  }
10659
10668
  });
10660
10669
  }
10661
- function checkRegularExpressionFlagAvailable(flag, pos2) {
10670
+ function checkRegularExpressionFlagAvailability(flag, size) {
10662
10671
  const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
10663
10672
  if (availableFrom && languageVersion < availableFrom) {
10664
- error(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos2, 1, getNameOfScriptTarget(availableFrom));
10673
+ error(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos, size, getNameOfScriptTarget(availableFrom));
10665
10674
  }
10666
10675
  }
10667
10676
  function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
@@ -12777,7 +12786,16 @@ function isJSDocTypeExpressionOrChild(node) {
12777
12786
  return !!findAncestor(node, isJSDocTypeExpression);
12778
12787
  }
12779
12788
  function isExportNamespaceAsDefaultDeclaration(node) {
12780
- return !!(isExportDeclaration(node) && node.exportClause && isNamespaceExport(node.exportClause) && node.exportClause.name.escapedText === "default");
12789
+ return !!(isExportDeclaration(node) && node.exportClause && isNamespaceExport(node.exportClause) && moduleExportNameIsDefault(node.exportClause.name));
12790
+ }
12791
+ function moduleExportNameTextUnescaped(node) {
12792
+ return node.kind === 11 /* StringLiteral */ ? node.text : unescapeLeadingUnderscores(node.escapedText);
12793
+ }
12794
+ function moduleExportNameTextEscaped(node) {
12795
+ return node.kind === 11 /* StringLiteral */ ? escapeLeadingUnderscores(node.text) : node.escapedText;
12796
+ }
12797
+ function moduleExportNameIsDefault(node) {
12798
+ return (node.kind === 11 /* StringLiteral */ ? node.text : node.escapedText) === "default" /* Default */;
12781
12799
  }
12782
12800
  function getTextOfNodeFromSourceText(sourceText, node, includeTrivia = false) {
12783
12801
  if (nodeIsMissing(node)) {
@@ -26045,6 +26063,9 @@ function isNamedExports(node) {
26045
26063
  function isExportSpecifier(node) {
26046
26064
  return node.kind === 281 /* ExportSpecifier */;
26047
26065
  }
26066
+ function isModuleExportName(node) {
26067
+ return node.kind === 80 /* Identifier */ || node.kind === 11 /* StringLiteral */;
26068
+ }
26048
26069
  function isNotEmittedStatement(node) {
26049
26070
  return node.kind === 353 /* NotEmittedStatement */;
26050
26071
  }
@@ -26743,6 +26764,9 @@ function getLocalNameForExternalImport(factory2, node, sourceFile) {
26743
26764
  const namespaceDeclaration = getNamespaceDeclarationNode(node);
26744
26765
  if (namespaceDeclaration && !isDefaultImport(node) && !isExportNamespaceAsDefaultDeclaration(node)) {
26745
26766
  const name = namespaceDeclaration.name;
26767
+ if (name.kind === 11 /* StringLiteral */) {
26768
+ return factory2.getGeneratedNameForNode(node);
26769
+ }
26746
26770
  return isGeneratedIdentifier(name) ? name : factory2.createIdentifier(getSourceTextOfNodeFromSourceFile(sourceFile, name) || idText(name));
26747
26771
  }
26748
26772
  if (node.kind === 272 /* ImportDeclaration */ && node.importClause) {
@@ -29078,6 +29102,9 @@ var Parser;
29078
29102
  if (token() === 161 /* FromKeyword */ && lookAhead(nextTokenIsStringLiteral)) {
29079
29103
  return false;
29080
29104
  }
29105
+ if (token() === 11 /* StringLiteral */) {
29106
+ return true;
29107
+ }
29081
29108
  return tokenIsIdentifierOrKeyword(token());
29082
29109
  case 13 /* JsxAttributes */:
29083
29110
  return tokenIsIdentifierOrKeyword(token()) || token() === 19 /* OpenBraceToken */;
@@ -33526,6 +33553,12 @@ var Parser;
33526
33553
  const name = parseIdentifier();
33527
33554
  return finishNode(factory2.createNamespaceImport(name), pos);
33528
33555
  }
33556
+ function canParseModuleExportName() {
33557
+ return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */;
33558
+ }
33559
+ function parseModuleExportName(parseName) {
33560
+ return token() === 11 /* StringLiteral */ ? parseLiteralNode() : parseName();
33561
+ }
33529
33562
  function parseNamedImportsOrExports(kind) {
33530
33563
  const pos = getNodePos();
33531
33564
  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 */));
@@ -33546,42 +33579,51 @@ var Parser;
33546
33579
  let isTypeOnly = false;
33547
33580
  let propertyName;
33548
33581
  let canParseAsKeyword = true;
33549
- let name = parseIdentifierName();
33550
- if (name.escapedText === "type") {
33582
+ let name = parseModuleExportName(parseIdentifierName);
33583
+ if (name.kind === 80 /* Identifier */ && name.escapedText === "type") {
33551
33584
  if (token() === 130 /* AsKeyword */) {
33552
33585
  const firstAs = parseIdentifierName();
33553
33586
  if (token() === 130 /* AsKeyword */) {
33554
33587
  const secondAs = parseIdentifierName();
33555
- if (tokenIsIdentifierOrKeyword(token())) {
33588
+ if (canParseModuleExportName()) {
33556
33589
  isTypeOnly = true;
33557
33590
  propertyName = firstAs;
33558
- name = parseNameWithKeywordCheck();
33591
+ name = parseModuleExportName(parseNameWithKeywordCheck);
33559
33592
  canParseAsKeyword = false;
33560
33593
  } else {
33561
33594
  propertyName = name;
33562
33595
  name = secondAs;
33563
33596
  canParseAsKeyword = false;
33564
33597
  }
33565
- } else if (tokenIsIdentifierOrKeyword(token())) {
33598
+ } else if (canParseModuleExportName()) {
33566
33599
  propertyName = name;
33567
33600
  canParseAsKeyword = false;
33568
- name = parseNameWithKeywordCheck();
33601
+ name = parseModuleExportName(parseNameWithKeywordCheck);
33569
33602
  } else {
33570
33603
  isTypeOnly = true;
33571
33604
  name = firstAs;
33572
33605
  }
33573
- } else if (tokenIsIdentifierOrKeyword(token())) {
33606
+ } else if (canParseModuleExportName()) {
33574
33607
  isTypeOnly = true;
33575
- name = parseNameWithKeywordCheck();
33608
+ name = parseModuleExportName(parseNameWithKeywordCheck);
33576
33609
  }
33577
33610
  }
33578
33611
  if (canParseAsKeyword && token() === 130 /* AsKeyword */) {
33579
33612
  propertyName = name;
33580
33613
  parseExpected(130 /* AsKeyword */);
33581
- name = parseNameWithKeywordCheck();
33614
+ name = parseModuleExportName(parseNameWithKeywordCheck);
33582
33615
  }
33583
- if (kind === 276 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
33584
- parseErrorAt(checkIdentifierStart, checkIdentifierEnd, Diagnostics.Identifier_expected);
33616
+ if (kind === 276 /* ImportSpecifier */) {
33617
+ if (name.kind !== 80 /* Identifier */) {
33618
+ parseErrorAt(skipTrivia(sourceText, name.pos), name.end, Diagnostics.Identifier_expected);
33619
+ name = setTextRangePosEnd(createMissingNode(
33620
+ 80 /* Identifier */,
33621
+ /*reportAtCurrentPosition*/
33622
+ false
33623
+ ), name.pos, name.pos);
33624
+ } else if (checkIdentifierIsKeyword) {
33625
+ parseErrorAt(checkIdentifierStart, checkIdentifierEnd, Diagnostics.Identifier_expected);
33626
+ }
33585
33627
  }
33586
33628
  const node = kind === 276 /* ImportSpecifier */ ? factory2.createImportSpecifier(isTypeOnly, propertyName, name) : factory2.createExportSpecifier(isTypeOnly, propertyName, name);
33587
33629
  return finishNode(node, pos);
@@ -33593,7 +33635,7 @@ var Parser;
33593
33635
  }
33594
33636
  }
33595
33637
  function parseNamespaceExport(pos) {
33596
- return finishNode(factory2.createNamespaceExport(parseIdentifierName()), pos);
33638
+ return finishNode(factory2.createNamespaceExport(parseModuleExportName(parseIdentifierName)), pos);
33597
33639
  }
33598
33640
  function parseExportDeclaration(pos, hasJSDoc, modifiers) {
33599
33641
  const savedAwaitContext = inAwaitContext();
@@ -41117,6 +41159,9 @@ function getModuleInstanceStateWorker(node, visited) {
41117
41159
  }
41118
41160
  function getModuleInstanceStateForAliasTarget(specifier, visited) {
41119
41161
  const name = specifier.propertyName || specifier.name;
41162
+ if (name.kind !== 80 /* Identifier */) {
41163
+ return 1 /* Instantiated */;
41164
+ }
41120
41165
  let p = specifier.parent;
41121
41166
  while (p) {
41122
41167
  if (isBlock(p) || isModuleBlock(p) || isSourceFile(p)) {
@@ -41361,7 +41406,7 @@ function createBinder() {
41361
41406
  }
41362
41407
  function declareSymbol(symbolTable, parent2, node, includes, excludes, isReplaceableByMethod, isComputedName) {
41363
41408
  Debug.assert(isComputedName || !hasDynamicName(node));
41364
- const isDefaultExport = hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) && node.name.escapedText === "default";
41409
+ const isDefaultExport = hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) && moduleExportNameIsDefault(node.name);
41365
41410
  const name = isComputedName ? "__computed" /* Computed */ : isDefaultExport && parent2 ? "default" /* Default */ : getDeclarationName(node);
41366
41411
  let symbol;
41367
41412
  if (name === void 0) {
@@ -45149,7 +45194,8 @@ function createTypeChecker(host) {
45149
45194
  isUndefinedIdentifierExpression(node) {
45150
45195
  Debug.assert(isExpressionNode(node));
45151
45196
  return getSymbolAtLocation(node) === undefinedSymbol;
45152
- }
45197
+ },
45198
+ isDefinitelyReferenceToGlobalSymbolObject
45153
45199
  });
45154
45200
  var evaluate = createEvaluator({
45155
45201
  evaluateElementAccessExpression,
@@ -46106,6 +46152,21 @@ function createTypeChecker(host) {
46106
46152
  ];
46107
46153
  initializeTypeChecker();
46108
46154
  return checker;
46155
+ function isDefinitelyReferenceToGlobalSymbolObject(node) {
46156
+ if (!isPropertyAccessExpression(node)) return false;
46157
+ if (!isIdentifier(node.name)) return false;
46158
+ if (!isPropertyAccessExpression(node.expression) && !isIdentifier(node.expression)) return false;
46159
+ if (isIdentifier(node.expression)) {
46160
+ return idText(node.expression) === "Symbol" && getResolvedSymbol(node.expression) === (getGlobalSymbol(
46161
+ "Symbol",
46162
+ 111551 /* Value */ | 1048576 /* ExportValue */,
46163
+ /*diagnostic*/
46164
+ void 0
46165
+ ) || unknownSymbol);
46166
+ }
46167
+ if (!isIdentifier(node.expression.expression)) return false;
46168
+ return idText(node.expression.name) === "Symbol" && idText(node.expression.expression) === "globalThis" && getResolvedSymbol(node.expression.expression) === globalThisSymbol;
46169
+ }
46109
46170
  function getCachedType(key) {
46110
46171
  return key ? cachedTypes.get(key) : void 0;
46111
46172
  }
@@ -47134,7 +47195,7 @@ function createTypeChecker(host) {
47134
47195
  const isExport = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */;
47135
47196
  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;
47136
47197
  const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
47137
- const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
47198
+ const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" : moduleExportNameTextUnescaped(typeOnlyDeclaration.name);
47138
47199
  addRelatedInfo(error(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
47139
47200
  }
47140
47201
  }
@@ -47378,12 +47439,12 @@ function createTypeChecker(host) {
47378
47439
  if (valueSymbol.exports) result.exports = new Map(valueSymbol.exports);
47379
47440
  return result;
47380
47441
  }
47381
- function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
47442
+ function getExportOfModule(symbol, nameText, specifier, dontResolveAlias) {
47382
47443
  var _a;
47383
47444
  if (symbol.flags & 1536 /* Module */) {
47384
- const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
47445
+ const exportSymbol = getExportsOfSymbol(symbol).get(nameText);
47385
47446
  const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
47386
- const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(name.escapedText);
47447
+ const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(nameText);
47387
47448
  markSymbolOfAliasDeclarationIfTypeOnly(
47388
47449
  specifier,
47389
47450
  exportSymbol,
@@ -47391,7 +47452,7 @@ function createTypeChecker(host) {
47391
47452
  /*overwriteEmpty*/
47392
47453
  false,
47393
47454
  exportStarDeclaration,
47394
- name.escapedText
47455
+ nameText
47395
47456
  );
47396
47457
  return resolved;
47397
47458
  }
@@ -47409,10 +47470,11 @@ function createTypeChecker(host) {
47409
47470
  const moduleSpecifier = getExternalModuleRequireArgument(node) || node.moduleSpecifier;
47410
47471
  const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier);
47411
47472
  const name = !isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name;
47412
- if (!isIdentifier(name)) {
47473
+ if (!isIdentifier(name) && name.kind !== 11 /* StringLiteral */) {
47413
47474
  return void 0;
47414
47475
  }
47415
- const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
47476
+ const nameText = moduleExportNameTextEscaped(name);
47477
+ const suppressInteropError = nameText === "default" /* Default */ && allowSyntheticDefaultImports;
47416
47478
  const targetSymbol = resolveESModuleSymbol(
47417
47479
  moduleSymbol,
47418
47480
  moduleSpecifier,
@@ -47421,7 +47483,7 @@ function createTypeChecker(host) {
47421
47483
  suppressInteropError
47422
47484
  );
47423
47485
  if (targetSymbol) {
47424
- if (name.escapedText) {
47486
+ if (nameText || name.kind === 11 /* StringLiteral */) {
47425
47487
  if (isShorthandAmbientModuleSymbol(moduleSymbol)) {
47426
47488
  return moduleSymbol;
47427
47489
  }
@@ -47429,16 +47491,16 @@ function createTypeChecker(host) {
47429
47491
  if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=" /* ExportEquals */)) {
47430
47492
  symbolFromVariable = getPropertyOfType(
47431
47493
  getTypeOfSymbol(targetSymbol),
47432
- name.escapedText,
47494
+ nameText,
47433
47495
  /*skipObjectFunctionPropertyAugment*/
47434
47496
  true
47435
47497
  );
47436
47498
  } else {
47437
- symbolFromVariable = getPropertyOfVariable(targetSymbol, name.escapedText);
47499
+ symbolFromVariable = getPropertyOfVariable(targetSymbol, nameText);
47438
47500
  }
47439
47501
  symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias);
47440
- let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
47441
- if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) {
47502
+ let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
47503
+ if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
47442
47504
  const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
47443
47505
  if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
47444
47506
  symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
@@ -47456,7 +47518,7 @@ function createTypeChecker(host) {
47456
47518
  var _a;
47457
47519
  const moduleName = getFullyQualifiedName(moduleSymbol, node);
47458
47520
  const declarationName = declarationNameToString(name);
47459
- const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
47521
+ const suggestion = isIdentifier(name) ? getSuggestedSymbolForNonexistentModule(name, targetSymbol) : void 0;
47460
47522
  if (suggestion !== void 0) {
47461
47523
  const suggestionName = symbolToString(suggestion);
47462
47524
  const diagnostic = error(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
@@ -47478,7 +47540,7 @@ function createTypeChecker(host) {
47478
47540
  }
47479
47541
  function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
47480
47542
  var _a, _b;
47481
- const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(name.escapedText);
47543
+ const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(moduleExportNameTextEscaped(name));
47482
47544
  const exports2 = moduleSymbol.exports;
47483
47545
  if (localSymbol) {
47484
47546
  const exportedEqualsSymbol = exports2 == null ? void 0 : exports2.get("export=" /* ExportEquals */);
@@ -47510,7 +47572,7 @@ function createTypeChecker(host) {
47510
47572
  }
47511
47573
  }
47512
47574
  function getTargetOfImportSpecifier(node, dontResolveAlias) {
47513
- if (isImportSpecifier(node) && idText(node.propertyName || node.name) === "default" /* Default */) {
47575
+ if (isImportSpecifier(node) && moduleExportNameIsDefault(node.propertyName || node.name)) {
47514
47576
  const specifier = getModuleSpecifierForImportOrExport(node);
47515
47577
  const moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
47516
47578
  if (moduleSymbol) {
@@ -47554,19 +47616,23 @@ function createTypeChecker(host) {
47554
47616
  }
47555
47617
  }
47556
47618
  function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
47557
- if (idText(node.propertyName || node.name) === "default" /* Default */) {
47619
+ const name = node.propertyName || node.name;
47620
+ if (moduleExportNameIsDefault(name)) {
47558
47621
  const specifier = getModuleSpecifierForImportOrExport(node);
47559
47622
  const moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
47560
47623
  if (moduleSymbol) {
47561
47624
  return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);
47562
47625
  }
47563
47626
  }
47564
- const resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : resolveEntityName(
47565
- node.propertyName || node.name,
47566
- meaning,
47567
- /*ignoreErrors*/
47568
- false,
47569
- dontResolveAlias
47627
+ const resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : name.kind === 11 /* StringLiteral */ ? void 0 : (
47628
+ // Skip for invalid syntax like this: export { "x" }
47629
+ resolveEntityName(
47630
+ name,
47631
+ meaning,
47632
+ /*ignoreErrors*/
47633
+ false,
47634
+ dontResolveAlias
47635
+ )
47570
47636
  );
47571
47637
  markSymbolOfAliasDeclarationIfTypeOnly(
47572
47638
  node,
@@ -51544,10 +51610,11 @@ function createTypeChecker(host) {
51544
51610
  return result ? setTextRange2(context, result, node) : void 0;
51545
51611
  }
51546
51612
  function createRecoveryBoundary() {
51613
+ let trackedSymbols;
51547
51614
  let unreportedErrors;
51548
51615
  const oldTracker = context.tracker;
51549
51616
  const oldTrackedSymbols = context.trackedSymbols;
51550
- context.trackedSymbols = [];
51617
+ context.trackedSymbols = void 0;
51551
51618
  const oldEncounteredError = context.encounteredError;
51552
51619
  context.tracker = new SymbolTrackerImpl(context, {
51553
51620
  ...oldTracker.inner,
@@ -51567,17 +51634,7 @@ function createTypeChecker(host) {
51567
51634
  markError(() => oldTracker.reportNonSerializableProperty(name));
51568
51635
  },
51569
51636
  trackSymbol(sym, decl, meaning) {
51570
- const accessibility = isSymbolAccessible(
51571
- sym,
51572
- decl,
51573
- meaning,
51574
- /*shouldComputeAliasesToMakeVisible*/
51575
- false
51576
- );
51577
- if (accessibility.accessibility !== 0 /* Accessible */) {
51578
- (context.trackedSymbols ?? (context.trackedSymbols = [])).push([sym, decl, meaning]);
51579
- return true;
51580
- }
51637
+ (trackedSymbols ?? (trackedSymbols = [])).push([sym, decl, meaning]);
51581
51638
  return false;
51582
51639
  },
51583
51640
  moduleResolverHost: context.tracker.moduleResolverHost
@@ -51591,13 +51648,12 @@ function createTypeChecker(host) {
51591
51648
  (unreportedErrors ?? (unreportedErrors = [])).push(unreportedError);
51592
51649
  }
51593
51650
  function startRecoveryScope2() {
51594
- var _a;
51595
- const initialTrackedSymbolsTop = ((_a = context.trackedSymbols) == null ? void 0 : _a.length) ?? 0;
51651
+ const trackedSymbolsTop = (trackedSymbols == null ? void 0 : trackedSymbols.length) ?? 0;
51596
51652
  const unreportedErrorsTop = (unreportedErrors == null ? void 0 : unreportedErrors.length) ?? 0;
51597
51653
  return () => {
51598
51654
  hadError = false;
51599
- if (context.trackedSymbols) {
51600
- context.trackedSymbols.length = initialTrackedSymbolsTop;
51655
+ if (trackedSymbols) {
51656
+ trackedSymbols.length = trackedSymbolsTop;
51601
51657
  }
51602
51658
  if (unreportedErrors) {
51603
51659
  unreportedErrors.length = unreportedErrorsTop;
@@ -51606,14 +51662,13 @@ function createTypeChecker(host) {
51606
51662
  }
51607
51663
  function finalizeBoundary2() {
51608
51664
  context.tracker = oldTracker;
51609
- const newTrackedSymbols = context.trackedSymbols;
51610
51665
  context.trackedSymbols = oldTrackedSymbols;
51611
51666
  context.encounteredError = oldEncounteredError;
51612
51667
  unreportedErrors == null ? void 0 : unreportedErrors.forEach((fn) => fn());
51613
51668
  if (hadError) {
51614
51669
  return false;
51615
51670
  }
51616
- newTrackedSymbols == null ? void 0 : newTrackedSymbols.forEach(
51671
+ trackedSymbols == null ? void 0 : trackedSymbols.forEach(
51617
51672
  ([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
51618
51673
  symbol,
51619
51674
  enclosingDeclaration,
@@ -51626,6 +51681,57 @@ function createTypeChecker(host) {
51626
51681
  function onEnterNewScope(node) {
51627
51682
  return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
51628
51683
  }
51684
+ function tryVisitSimpleTypeNode(node) {
51685
+ const innerNode = skipTypeParentheses(node);
51686
+ switch (innerNode.kind) {
51687
+ case 183 /* TypeReference */:
51688
+ return tryVisitTypeReference(innerNode);
51689
+ case 186 /* TypeQuery */:
51690
+ return tryVisitTypeQuery(innerNode);
51691
+ case 199 /* IndexedAccessType */:
51692
+ return tryVisitIndexedAccess(innerNode);
51693
+ case 198 /* TypeOperator */:
51694
+ const typeOperatorNode = innerNode;
51695
+ if (typeOperatorNode.operator === 143 /* KeyOfKeyword */) {
51696
+ return tryVisitKeyOf(typeOperatorNode);
51697
+ }
51698
+ }
51699
+ return visitNode(node, visitExistingNodeTreeSymbols, isTypeNode);
51700
+ }
51701
+ function tryVisitIndexedAccess(node) {
51702
+ const resultObjectType = tryVisitSimpleTypeNode(node.objectType);
51703
+ if (resultObjectType === void 0) {
51704
+ return void 0;
51705
+ }
51706
+ return factory.updateIndexedAccessTypeNode(node, resultObjectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
51707
+ }
51708
+ function tryVisitKeyOf(node) {
51709
+ Debug.assertEqual(node.operator, 143 /* KeyOfKeyword */);
51710
+ const type = tryVisitSimpleTypeNode(node.type);
51711
+ if (type === void 0) {
51712
+ return void 0;
51713
+ }
51714
+ return factory.updateTypeOperatorNode(node, type);
51715
+ }
51716
+ function tryVisitTypeQuery(node) {
51717
+ const { introducesError, node: exprName } = trackExistingEntityName(node.exprName, context);
51718
+ if (!introducesError) {
51719
+ return factory.updateTypeQueryNode(
51720
+ node,
51721
+ exprName,
51722
+ visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode)
51723
+ );
51724
+ }
51725
+ const serializedName = serializeTypeName(
51726
+ context,
51727
+ node.exprName,
51728
+ /*isTypeOf*/
51729
+ true
51730
+ );
51731
+ if (serializedName) {
51732
+ return setTextRange2(context, serializedName, node.exprName);
51733
+ }
51734
+ }
51629
51735
  function tryVisitTypeReference(node) {
51630
51736
  if (canReuseTypeNode(context, node)) {
51631
51737
  const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
@@ -51759,13 +51865,13 @@ function createTypeChecker(host) {
51759
51865
  visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
51760
51866
  );
51761
51867
  }
51762
- if (isIndexedAccessTypeNode(node) && isTypeReferenceNode(node.objectType)) {
51763
- const objectType = tryVisitTypeReference(node.objectType);
51764
- if (!objectType) {
51868
+ if (isIndexedAccessTypeNode(node)) {
51869
+ const result = tryVisitIndexedAccess(node);
51870
+ if (!result) {
51765
51871
  hadError = true;
51766
51872
  return node;
51767
51873
  }
51768
- return factory.updateIndexedAccessTypeNode(node, objectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
51874
+ return result;
51769
51875
  }
51770
51876
  if (isTypeReferenceNode(node)) {
51771
51877
  const result = tryVisitTypeReference(node);
@@ -51808,25 +51914,12 @@ function createTypeChecker(host) {
51808
51914
  return visited;
51809
51915
  }
51810
51916
  if (isTypeQueryNode(node)) {
51811
- const { introducesError, node: exprName } = trackExistingEntityName(node.exprName, context);
51812
- if (introducesError) {
51813
- const serializedName = serializeTypeName(
51814
- context,
51815
- node.exprName,
51816
- /*isTypeOf*/
51817
- true
51818
- );
51819
- if (serializedName) {
51820
- return setTextRange2(context, serializedName, node.exprName);
51821
- }
51917
+ const result = tryVisitTypeQuery(node);
51918
+ if (!result) {
51822
51919
  hadError = true;
51823
51920
  return node;
51824
51921
  }
51825
- return factory.updateTypeQueryNode(
51826
- node,
51827
- exprName,
51828
- visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode)
51829
- );
51922
+ return result;
51830
51923
  }
51831
51924
  if (isComputedPropertyName(node) && isEntityNameExpression(node.expression)) {
51832
51925
  const { node: result, introducesError } = trackExistingEntityName(node.expression, context);
@@ -51891,14 +51984,12 @@ function createTypeChecker(host) {
51891
51984
  return node;
51892
51985
  }
51893
51986
  } else if (node.operator === 143 /* KeyOfKeyword */) {
51894
- if (isTypeReferenceNode(node.type)) {
51895
- const type = tryVisitTypeReference(node.type);
51896
- if (!type) {
51897
- hadError = true;
51898
- return node;
51899
- }
51900
- return factory.updateTypeOperatorNode(node, type);
51987
+ const result = tryVisitKeyOf(node);
51988
+ if (!result) {
51989
+ hadError = true;
51990
+ return node;
51901
51991
  }
51992
+ return result;
51902
51993
  }
51903
51994
  }
51904
51995
  return visitEachChild2(node, visitExistingNodeTreeSymbols);
@@ -52138,9 +52229,10 @@ function createTypeChecker(host) {
52138
52229
  if (index >= 0) {
52139
52230
  const exportDecl = statements[index];
52140
52231
  const replacements = mapDefined(exportDecl.exportClause.elements, (e) => {
52141
- if (!e.propertyName) {
52232
+ if (!e.propertyName && e.name.kind !== 11 /* StringLiteral */) {
52233
+ const name = e.name;
52142
52234
  const indices = indicesOf(statements);
52143
- const associatedIndices = filter(indices, (i) => nodeHasName(statements[i], e.name));
52235
+ const associatedIndices = filter(indices, (i) => nodeHasName(statements[i], name));
52144
52236
  if (length(associatedIndices) && every(associatedIndices, (i) => canHaveExportModifier(statements[i]))) {
52145
52237
  for (const index2 of associatedIndices) {
52146
52238
  statements[index2] = addExportModifier(statements[index2]);
@@ -52774,7 +52866,7 @@ function createTypeChecker(host) {
52774
52866
  function getSomeTargetNameFromDeclarations(declarations) {
52775
52867
  return firstDefined(declarations, (d) => {
52776
52868
  if (isImportSpecifier(d) || isExportSpecifier(d)) {
52777
- return idText(d.propertyName || d.name);
52869
+ return moduleExportNameTextUnescaped(d.propertyName || d.name);
52778
52870
  }
52779
52871
  if (isBinaryExpression(d) || isExportAssignment(d)) {
52780
52872
  const expression = isExportAssignment(d) ? d.expression : d.right;
@@ -52792,7 +52884,7 @@ function createTypeChecker(host) {
52792
52884
  });
52793
52885
  }
52794
52886
  function serializeAsAlias(symbol, localName, modifierFlags) {
52795
- var _a2, _b, _c, _d, _e, _f;
52887
+ var _a2, _b, _c, _d, _e;
52796
52888
  const node = getDeclarationOfAliasSymbol(symbol);
52797
52889
  if (!node) return Debug.fail();
52798
52890
  const target = getMergedSymbol(getTargetOfAliasDeclaration(
@@ -52990,8 +53082,11 @@ function createTypeChecker(host) {
52990
53082
  }
52991
53083
  case 281 /* ExportSpecifier */:
52992
53084
  const specifier = node.parent.parent.moduleSpecifier;
52993
- if (specifier && ((_f = node.propertyName) == null ? void 0 : _f.escapedText) === "default" /* Default */) {
52994
- verbatimTargetName = "default" /* Default */;
53085
+ if (specifier) {
53086
+ const propertyName = node.propertyName;
53087
+ if (propertyName && moduleExportNameIsDefault(propertyName)) {
53088
+ verbatimTargetName = "default" /* Default */;
53089
+ }
52995
53090
  }
52996
53091
  serializeExportSpecifier(
52997
53092
  unescapeLeadingUnderscores(symbol.escapedName),
@@ -53704,7 +53799,7 @@ function createTypeChecker(host) {
53704
53799
  }
53705
53800
  function collectLinkedAliases(node, setVisibility) {
53706
53801
  let exportSymbol;
53707
- if (node.parent && node.parent.kind === 277 /* ExportAssignment */) {
53802
+ if (node.kind !== 11 /* StringLiteral */ && node.parent && node.parent.kind === 277 /* ExportAssignment */) {
53708
53803
  exportSymbol = resolveName(
53709
53804
  node,
53710
53805
  node,
@@ -69277,9 +69372,10 @@ function createTypeChecker(host) {
69277
69372
  return;
69278
69373
  case 281 /* ExportSpecifier */:
69279
69374
  const exportDeclaration = node.parent.parent;
69280
- if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) {
69375
+ const name = node.propertyName || node.name;
69376
+ if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier && name.kind !== 11 /* StringLiteral */) {
69281
69377
  const symbol = resolveEntityName(
69282
- node.propertyName || node.name,
69378
+ name,
69283
69379
  111551 /* Value */,
69284
69380
  /*ignoreErrors*/
69285
69381
  true,
@@ -69573,6 +69669,9 @@ function createTypeChecker(host) {
69573
69669
  function markExportSpecifierAliasReferenced(location) {
69574
69670
  if (!location.parent.parent.moduleSpecifier && !location.isTypeOnly && !location.parent.parent.isTypeOnly) {
69575
69671
  const exportedName = location.propertyName || location.name;
69672
+ if (exportedName.kind === 11 /* StringLiteral */) {
69673
+ return;
69674
+ }
69576
69675
  const symbol = resolveName(
69577
69676
  exportedName,
69578
69677
  exportedName.escapedText,
@@ -69587,7 +69686,7 @@ function createTypeChecker(host) {
69587
69686
  const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
69588
69687
  if (!target || getSymbolFlags(target) & 111551 /* Value */) {
69589
69688
  markExportAsReferenced(location);
69590
- markIdentifierAliasReferenced(location.propertyName || location.name);
69689
+ markIdentifierAliasReferenced(exportedName);
69591
69690
  }
69592
69691
  }
69593
69692
  return;
@@ -83183,6 +83282,16 @@ function createTypeChecker(host) {
83183
83282
  }
83184
83283
  return true;
83185
83284
  }
83285
+ function checkModuleExportName(name, allowStringLiteral = true) {
83286
+ if (name === void 0 || name.kind !== 11 /* StringLiteral */) {
83287
+ return;
83288
+ }
83289
+ if (!allowStringLiteral) {
83290
+ grammarErrorOnNode(name, Diagnostics.Identifier_expected);
83291
+ } else if (moduleKind === 5 /* ES2015 */ || moduleKind === 6 /* ES2020 */) {
83292
+ grammarErrorOnNode(name, Diagnostics.String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es2020);
83293
+ }
83294
+ }
83186
83295
  function checkAliasSymbol(node) {
83187
83296
  var _a, _b, _c, _d;
83188
83297
  let symbol = getSymbolOfDeclaration(node);
@@ -83194,7 +83303,7 @@ function createTypeChecker(host) {
83194
83303
  Debug.assert(node.kind !== 280 /* NamespaceExport */);
83195
83304
  if (node.kind === 281 /* ExportSpecifier */) {
83196
83305
  const diag2 = error(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
83197
- const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText);
83306
+ const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get(moduleExportNameTextEscaped(node.propertyName || node.name));
83198
83307
  if (alreadyExportedSymbol === target) {
83199
83308
  const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
83200
83309
  if (exportingDeclaration) {
@@ -83249,7 +83358,7 @@ function createTypeChecker(host) {
83249
83358
  if (compilerOptions.verbatimModuleSyntax) {
83250
83359
  Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name");
83251
83360
  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;
83252
- const name = idText(node.kind === 276 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
83361
+ const name = moduleExportNameTextUnescaped(node.kind === 276 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
83253
83362
  addTypeOnlyDeclarationRelatedInfo(
83254
83363
  error(node, message, name),
83255
83364
  isType ? void 0 : typeOnlyAlias,
@@ -83263,7 +83372,7 @@ function createTypeChecker(host) {
83263
83372
  }
83264
83373
  case 281 /* ExportSpecifier */: {
83265
83374
  if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) {
83266
- const name = idText(node.propertyName || node.name);
83375
+ const name = moduleExportNameTextUnescaped(node.propertyName || node.name);
83267
83376
  const diagnostic = isType ? error(node, Diagnostics.Re_exporting_a_type_when_0_is_enabled_requires_using_export_type, isolatedModulesLikeFlagName) : error(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);
83268
83377
  addTypeOnlyDeclarationRelatedInfo(diagnostic, isType ? void 0 : typeOnlyAlias, name);
83269
83378
  break;
@@ -83313,8 +83422,11 @@ function createTypeChecker(host) {
83313
83422
  function checkImportBinding(node) {
83314
83423
  checkCollisionsForDeclarationName(node, node.name);
83315
83424
  checkAliasSymbol(node);
83316
- if (node.kind === 276 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
83317
- checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
83425
+ if (node.kind === 276 /* ImportSpecifier */) {
83426
+ checkModuleExportName(node.propertyName);
83427
+ if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
83428
+ checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
83429
+ }
83318
83430
  }
83319
83431
  }
83320
83432
  function checkImportAttributes(declaration) {
@@ -83435,6 +83547,7 @@ function createTypeChecker(host) {
83435
83547
  error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
83436
83548
  } else if (node.exportClause) {
83437
83549
  checkAliasSymbol(node.exportClause);
83550
+ checkModuleExportName(node.exportClause.name);
83438
83551
  }
83439
83552
  if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
83440
83553
  if (node.exportClause) {
@@ -83465,6 +83578,9 @@ function createTypeChecker(host) {
83465
83578
  }
83466
83579
  function checkExportSpecifier(node) {
83467
83580
  checkAliasSymbol(node);
83581
+ const hasModuleSpecifier = node.parent.parent.moduleSpecifier !== void 0;
83582
+ checkModuleExportName(node.propertyName, hasModuleSpecifier);
83583
+ checkModuleExportName(node.name);
83468
83584
  if (getEmitDeclarations(compilerOptions)) {
83469
83585
  collectLinkedAliases(
83470
83586
  node.propertyName || node.name,
@@ -83472,8 +83588,11 @@ function createTypeChecker(host) {
83472
83588
  true
83473
83589
  );
83474
83590
  }
83475
- if (!node.parent.parent.moduleSpecifier) {
83591
+ if (!hasModuleSpecifier) {
83476
83592
  const exportedName = node.propertyName || node.name;
83593
+ if (exportedName.kind === 11 /* StringLiteral */) {
83594
+ return;
83595
+ }
83477
83596
  const symbol = resolveName(
83478
83597
  exportedName,
83479
83598
  exportedName.escapedText,
@@ -83489,7 +83608,7 @@ function createTypeChecker(host) {
83489
83608
  markLinkedReferences(node, 7 /* ExportSpecifier */);
83490
83609
  }
83491
83610
  } else {
83492
- if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && idText(node.propertyName || node.name) === "default") {
83611
+ if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && moduleExportNameIsDefault(node.propertyName || node.name)) {
83493
83612
  checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
83494
83613
  }
83495
83614
  }
@@ -84644,7 +84763,11 @@ function createTypeChecker(host) {
84644
84763
  }
84645
84764
  function getExportSpecifierLocalTargetSymbol(node) {
84646
84765
  if (isExportSpecifier(node)) {
84647
- return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
84766
+ const name = node.propertyName || node.name;
84767
+ return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : name.kind === 11 /* StringLiteral */ ? void 0 : (
84768
+ // Skip for invalid syntax like this: export { "x" }
84769
+ resolveEntityName(name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)
84770
+ );
84648
84771
  } else {
84649
84772
  return resolveEntityName(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
84650
84773
  }
@@ -85615,7 +85738,8 @@ function createTypeChecker(host) {
85615
85738
  resolveExternalModuleSymbol(sym);
85616
85739
  return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
85617
85740
  },
85618
- isImportRequiredByAugmentation
85741
+ isImportRequiredByAugmentation,
85742
+ isDefinitelyReferenceToGlobalSymbolObject
85619
85743
  };
85620
85744
  function isImportRequiredByAugmentation(node) {
85621
85745
  const file = getSourceFileOfNode(node);
@@ -87454,7 +87578,7 @@ function isDeclarationNameOrImportPropertyName(name) {
87454
87578
  switch (name.parent.kind) {
87455
87579
  case 276 /* ImportSpecifier */:
87456
87580
  case 281 /* ExportSpecifier */:
87457
- return isIdentifier(name);
87581
+ return isIdentifier(name) || name.kind === 11 /* StringLiteral */;
87458
87582
  default:
87459
87583
  return isDeclarationName(name);
87460
87584
  }
@@ -88699,7 +88823,7 @@ var visitEachChildTable = {
88699
88823
  return context.factory.updateImportSpecifier(
88700
88824
  node,
88701
88825
  node.isTypeOnly,
88702
- nodeVisitor(node.propertyName, visitor, isIdentifier),
88826
+ nodeVisitor(node.propertyName, visitor, isModuleExportName),
88703
88827
  Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
88704
88828
  );
88705
88829
  },
@@ -88730,8 +88854,8 @@ var visitEachChildTable = {
88730
88854
  return context.factory.updateExportSpecifier(
88731
88855
  node,
88732
88856
  node.isTypeOnly,
88733
- nodeVisitor(node.propertyName, visitor, isIdentifier),
88734
- Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
88857
+ nodeVisitor(node.propertyName, visitor, isModuleExportName),
88858
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isModuleExportName))
88735
88859
  );
88736
88860
  },
88737
88861
  // Module references
@@ -89275,7 +89399,7 @@ function containsDefaultReference(node) {
89275
89399
  return some(node.elements, isNamedDefaultReference);
89276
89400
  }
89277
89401
  function isNamedDefaultReference(e) {
89278
- return e.propertyName !== void 0 ? e.propertyName.escapedText === "default" /* Default */ : e.name.escapedText === "default" /* Default */;
89402
+ return moduleExportNameIsDefault(e.propertyName || e.name);
89279
89403
  }
89280
89404
  function chainBundle(context, transformSourceFile) {
89281
89405
  return transformSourceFileOrBundle;
@@ -89351,9 +89475,10 @@ function collectExternalModuleInfo(context, sourceFile) {
89351
89475
  hasImportDefault || (hasImportDefault = containsDefaultReference(node.exportClause));
89352
89476
  } else {
89353
89477
  const name = node.exportClause.name;
89354
- if (!uniqueExports.get(idText(name))) {
89478
+ const nameText = moduleExportNameTextUnescaped(name);
89479
+ if (!uniqueExports.get(nameText)) {
89355
89480
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
89356
- uniqueExports.set(idText(name), true);
89481
+ uniqueExports.set(nameText, true);
89357
89482
  exportedNames = append(exportedNames, name);
89358
89483
  }
89359
89484
  hasImportStar = true;
@@ -89411,20 +89536,23 @@ function collectExternalModuleInfo(context, sourceFile) {
89411
89536
  return { externalImports, exportSpecifiers, exportEquals, hasExportStarsToExportValues, exportedBindings, exportedNames, exportedFunctions, externalHelpersImportDeclaration };
89412
89537
  function addExportedNamesForExportDeclaration(node) {
89413
89538
  for (const specifier of cast(node.exportClause, isNamedExports).elements) {
89414
- if (!uniqueExports.get(idText(specifier.name))) {
89539
+ const specifierNameText = moduleExportNameTextUnescaped(specifier.name);
89540
+ if (!uniqueExports.get(specifierNameText)) {
89415
89541
  const name = specifier.propertyName || specifier.name;
89416
- if (!node.moduleSpecifier) {
89417
- exportSpecifiers.add(name, specifier);
89418
- }
89419
- const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
89420
- if (decl) {
89421
- if (decl.kind === 262 /* FunctionDeclaration */) {
89422
- addExportedFunctionDeclaration(decl, specifier.name, specifier.name.escapedText === "default" /* Default */);
89423
- continue;
89542
+ if (name.kind !== 11 /* StringLiteral */) {
89543
+ if (!node.moduleSpecifier) {
89544
+ exportSpecifiers.add(name, specifier);
89545
+ }
89546
+ const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
89547
+ if (decl) {
89548
+ if (decl.kind === 262 /* FunctionDeclaration */) {
89549
+ addExportedFunctionDeclaration(decl, specifier.name, moduleExportNameIsDefault(specifier.name));
89550
+ continue;
89551
+ }
89552
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
89424
89553
  }
89425
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
89426
89554
  }
89427
- uniqueExports.set(idText(specifier.name), true);
89555
+ uniqueExports.set(specifierNameText, true);
89428
89556
  exportedNames = append(exportedNames, specifier.name);
89429
89557
  }
89430
89558
  }
@@ -89438,9 +89566,10 @@ function collectExternalModuleInfo(context, sourceFile) {
89438
89566
  }
89439
89567
  } else {
89440
89568
  name ?? (name = node.name);
89441
- if (!uniqueExports.get(idText(name))) {
89569
+ const nameText = moduleExportNameTextUnescaped(name);
89570
+ if (!uniqueExports.get(nameText)) {
89442
89571
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
89443
- uniqueExports.set(idText(name), true);
89572
+ uniqueExports.set(nameText, true);
89444
89573
  }
89445
89574
  }
89446
89575
  }
@@ -106717,7 +106846,7 @@ function transformModule(context) {
106717
106846
  factory2.createExpressionStatement(
106718
106847
  reduceLeft(
106719
106848
  currentModuleInfo.exportedNames.slice(i, i + chunkSize),
106720
- (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev),
106849
+ (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),
106721
106850
  factory2.createVoidZero()
106722
106851
  )
106723
106852
  )
@@ -107040,7 +107169,10 @@ function transformModule(context) {
107040
107169
  append(statements, createUnderscoreUnderscoreESModule());
107041
107170
  }
107042
107171
  if (some(currentModuleInfo.exportedNames)) {
107043
- append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
107172
+ append(
107173
+ statements,
107174
+ 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()))
107175
+ );
107044
107176
  }
107045
107177
  for (const f of currentModuleInfo.exportedFunctions) {
107046
107178
  appendExportsOfHoistedDeclaration(statements, f);
@@ -107911,17 +108043,16 @@ function transformModule(context) {
107911
108043
  );
107912
108044
  }
107913
108045
  for (const specifier of node.exportClause.elements) {
107914
- const exportNeedsImportDefault = !!getESModuleInterop(compilerOptions) && !(getInternalEmitFlags(node) & 2 /* NeverApplyImportHelper */) && idText(specifier.propertyName || specifier.name) === "default";
107915
- const exportedValue = factory2.createPropertyAccessExpression(
107916
- exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName,
107917
- specifier.propertyName || specifier.name
107918
- );
108046
+ const specifierName = specifier.propertyName || specifier.name;
108047
+ const exportNeedsImportDefault = !!getESModuleInterop(compilerOptions) && !(getInternalEmitFlags(node) & 2 /* NeverApplyImportHelper */) && moduleExportNameIsDefault(specifierName);
108048
+ const target = exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName;
108049
+ const exportedValue = specifierName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, specifierName) : factory2.createPropertyAccessExpression(target, specifierName);
107919
108050
  statements.push(
107920
108051
  setOriginalNode(
107921
108052
  setTextRange(
107922
108053
  factory2.createExpressionStatement(
107923
108054
  createExportExpression(
107924
- factory2.getExportName(specifier),
108055
+ specifier.name.kind === 11 /* StringLiteral */ ? factory2.cloneNode(specifier.name) : factory2.getExportName(specifier),
107925
108056
  exportedValue,
107926
108057
  /*location*/
107927
108058
  void 0,
@@ -107946,7 +108077,7 @@ function transformModule(context) {
107946
108077
  factory2.cloneNode(node.exportClause.name),
107947
108078
  getHelperExpressionForExport(
107948
108079
  node,
107949
- moduleKind !== 2 /* AMD */ ? createRequireCall(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
108080
+ moduleKind !== 2 /* AMD */ ? createRequireCall(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : node.exportClause.name.kind === 11 /* StringLiteral */ ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
107950
108081
  )
107951
108082
  )
107952
108083
  ),
@@ -108276,10 +108407,13 @@ function transformModule(context) {
108276
108407
  return statements;
108277
108408
  }
108278
108409
  function appendExportStatement(statements, seen, exportName, expression, location, allowComments, liveBinding) {
108279
- if (!seen.has(exportName)) {
108410
+ if (exportName.kind !== 11 /* StringLiteral */) {
108411
+ if (seen.has(exportName)) {
108412
+ return statements;
108413
+ }
108280
108414
  seen.set(exportName, true);
108281
- statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
108282
108415
  }
108416
+ statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
108283
108417
  return statements;
108284
108418
  }
108285
108419
  function createUnderscoreUnderscoreESModule() {
@@ -108349,7 +108483,10 @@ function transformModule(context) {
108349
108483
  ])
108350
108484
  ]
108351
108485
  ) : factory2.createAssignment(
108352
- factory2.createPropertyAccessExpression(
108486
+ name.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(
108487
+ factory2.createIdentifier("exports"),
108488
+ factory2.cloneNode(name)
108489
+ ) : factory2.createPropertyAccessExpression(
108353
108490
  factory2.createIdentifier("exports"),
108354
108491
  factory2.cloneNode(name)
108355
108492
  ),
@@ -108485,11 +108622,9 @@ function transformModule(context) {
108485
108622
  );
108486
108623
  } else if (isImportSpecifier(importDeclaration)) {
108487
108624
  const name = importDeclaration.propertyName || importDeclaration.name;
108625
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
108488
108626
  return setTextRange(
108489
- factory2.createPropertyAccessExpression(
108490
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
108491
- factory2.cloneNode(name)
108492
- ),
108627
+ name.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(name)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(name)),
108493
108628
  /*location*/
108494
108629
  node
108495
108630
  );
@@ -108777,7 +108912,7 @@ function transformSystemModule(context) {
108777
108912
  const exportedNames = [];
108778
108913
  if (moduleInfo.exportedNames) {
108779
108914
  for (const exportedLocalName of moduleInfo.exportedNames) {
108780
- if (exportedLocalName.escapedText === "default") {
108915
+ if (moduleExportNameIsDefault(exportedLocalName)) {
108781
108916
  continue;
108782
108917
  }
108783
108918
  exportedNames.push(
@@ -108955,10 +109090,10 @@ function transformSystemModule(context) {
108955
109090
  for (const e of entry.exportClause.elements) {
108956
109091
  properties.push(
108957
109092
  factory2.createPropertyAssignment(
108958
- factory2.createStringLiteral(idText(e.name)),
109093
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(e.name)),
108959
109094
  factory2.createElementAccessExpression(
108960
109095
  parameterName,
108961
- factory2.createStringLiteral(idText(e.propertyName || e.name))
109096
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(e.propertyName || e.name))
108962
109097
  )
108963
109098
  )
108964
109099
  );
@@ -108985,7 +109120,7 @@ function transformSystemModule(context) {
108985
109120
  /*typeArguments*/
108986
109121
  void 0,
108987
109122
  [
108988
- factory2.createStringLiteral(idText(entry.exportClause.name)),
109123
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(entry.exportClause.name)),
108989
109124
  parameterName
108990
109125
  ]
108991
109126
  )
@@ -109325,7 +109460,7 @@ function transformSystemModule(context) {
109325
109460
  const exportSpecifiers = moduleInfo.exportSpecifiers.get(name);
109326
109461
  if (exportSpecifiers) {
109327
109462
  for (const exportSpecifier of exportSpecifiers) {
109328
- if (exportSpecifier.name.escapedText !== excludeName) {
109463
+ if (moduleExportNameTextUnescaped(exportSpecifier.name) !== excludeName) {
109329
109464
  statements = appendExportStatement(statements, exportSpecifier.name, name);
109330
109465
  }
109331
109466
  }
@@ -109746,13 +109881,12 @@ function transformSystemModule(context) {
109746
109881
  node
109747
109882
  );
109748
109883
  } else if (isImportSpecifier(importDeclaration)) {
109884
+ const importedName = importDeclaration.propertyName || importDeclaration.name;
109885
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
109749
109886
  return setTextRange(
109750
109887
  factory2.createPropertyAssignment(
109751
109888
  factory2.cloneNode(name),
109752
- factory2.createPropertyAccessExpression(
109753
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
109754
- factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name)
109755
- )
109889
+ importedName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(importedName)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(importedName))
109756
109890
  ),
109757
109891
  /*location*/
109758
109892
  node
@@ -109795,11 +109929,10 @@ function transformSystemModule(context) {
109795
109929
  node
109796
109930
  );
109797
109931
  } else if (isImportSpecifier(importDeclaration)) {
109932
+ const importedName = importDeclaration.propertyName || importDeclaration.name;
109933
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
109798
109934
  return setTextRange(
109799
- factory2.createPropertyAccessExpression(
109800
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
109801
- factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name)
109802
- ),
109935
+ importedName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(importedName)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(importedName)),
109803
109936
  /*location*/
109804
109937
  node
109805
109938
  );
@@ -111390,15 +111523,17 @@ function transformDeclarations(context) {
111390
111523
  if (isDeclarationAndNotVisible(input)) return;
111391
111524
  if (hasDynamicName(input)) {
111392
111525
  if (isolatedDeclarations) {
111393
- if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
111394
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
111395
- return;
111396
- } else if (
111397
- // Type declarations just need to double-check that the input computed name is an entity name expression
111398
- (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
111399
- ) {
111400
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
111401
- return;
111526
+ if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
111527
+ if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
111528
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
111529
+ return;
111530
+ } else if (
111531
+ // Type declarations just need to double-check that the input computed name is an entity name expression
111532
+ (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
111533
+ ) {
111534
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
111535
+ return;
111536
+ }
111402
111537
  }
111403
111538
  } else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
111404
111539
  return;
@@ -112766,16 +112901,16 @@ function isBuildInfoFile(file) {
112766
112901
  function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit = false, onlyBuildInfo, includeBuildInfo) {
112767
112902
  const sourceFiles = isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile, forceDtsEmit);
112768
112903
  const options = host.getCompilerOptions();
112769
- if (options.outFile) {
112770
- if (sourceFiles.length) {
112771
- const bundle = factory.createBundle(sourceFiles);
112772
- const result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle);
112773
- if (result) {
112774
- return result;
112904
+ if (!onlyBuildInfo) {
112905
+ if (options.outFile) {
112906
+ if (sourceFiles.length) {
112907
+ const bundle = factory.createBundle(sourceFiles);
112908
+ const result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle);
112909
+ if (result) {
112910
+ return result;
112911
+ }
112775
112912
  }
112776
- }
112777
- } else {
112778
- if (!onlyBuildInfo) {
112913
+ } else {
112779
112914
  for (const sourceFile of sourceFiles) {
112780
112915
  const result = action(getOutputPathsFor(sourceFile, host, forceDtsEmit), sourceFile);
112781
112916
  if (result) {
@@ -112783,14 +112918,14 @@ function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDt
112783
112918
  }
112784
112919
  }
112785
112920
  }
112786
- if (includeBuildInfo) {
112787
- const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
112788
- if (buildInfoPath) return action(
112789
- { buildInfoPath },
112790
- /*sourceFileOrBundle*/
112791
- void 0
112792
- );
112793
- }
112921
+ }
112922
+ if (includeBuildInfo) {
112923
+ const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
112924
+ if (buildInfoPath) return action(
112925
+ { buildInfoPath },
112926
+ /*sourceFileOrBundle*/
112927
+ void 0
112928
+ );
112794
112929
  }
112795
112930
  }
112796
112931
  function getTsBuildInfoEmitOutputFilePath(options) {
@@ -112819,8 +112954,7 @@ function getOutputPathsForBundle(options, forceDtsPaths) {
112819
112954
  const sourceMapFilePath = jsFilePath && getSourceMapFilePath(jsFilePath, options);
112820
112955
  const declarationFilePath = forceDtsPaths || getEmitDeclarations(options) ? removeFileExtension(outPath) + ".d.ts" /* Dts */ : void 0;
112821
112956
  const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0;
112822
- const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
112823
- return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath };
112957
+ return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
112824
112958
  }
112825
112959
  function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
112826
112960
  const options = host.getCompilerOptions();
@@ -112834,7 +112968,7 @@ function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
112834
112968
  const sourceMapFilePath = !jsFilePath || isJsonSourceFile(sourceFile) ? void 0 : getSourceMapFilePath(jsFilePath, options);
112835
112969
  const declarationFilePath = forceDtsPaths || getEmitDeclarations(options) && !isJsonFile ? getDeclarationEmitOutputFilePath(sourceFile.fileName, host) : void 0;
112836
112970
  const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0;
112837
- return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath: void 0 };
112971
+ return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
112838
112972
  }
112839
112973
  }
112840
112974
  function getSourceMapFilePath(jsFilePath, options) {
@@ -112883,7 +113017,7 @@ function createAddOutput() {
112883
113017
  }
112884
113018
  }
112885
113019
  function getSingleOutputFileNames(configFile, addOutput) {
112886
- const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } = getOutputPathsForBundle(
113020
+ const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath } = getOutputPathsForBundle(
112887
113021
  configFile.options,
112888
113022
  /*forceDtsPaths*/
112889
113023
  false
@@ -112892,7 +113026,6 @@ function getSingleOutputFileNames(configFile, addOutput) {
112892
113026
  addOutput(sourceMapFilePath);
112893
113027
  addOutput(declarationFilePath);
112894
113028
  addOutput(declarationMapPath);
112895
- addOutput(buildInfoPath);
112896
113029
  }
112897
113030
  function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2) {
112898
113031
  if (isDeclarationFileName(inputFileName)) return;
@@ -112943,8 +113076,8 @@ function getAllProjectOutputs(configFile, ignoreCase) {
112943
113076
  for (const inputFileName of configFile.fileNames) {
112944
113077
  getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2);
112945
113078
  }
112946
- addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
112947
113079
  }
113080
+ addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
112948
113081
  return getOutputs();
112949
113082
  }
112950
113083
  function getFirstProjectOutput(configFile, ignoreCase) {
@@ -112973,7 +113106,7 @@ function getFirstProjectOutput(configFile, ignoreCase) {
112973
113106
  function emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) {
112974
113107
  return !!forceDtsEmit && !!emitOnly;
112975
113108
  }
112976
- function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
113109
+ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit, skipBuildInfo) {
112977
113110
  var compilerOptions = host.getCompilerOptions();
112978
113111
  var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
112979
113112
  var emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
@@ -112989,7 +113122,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
112989
113122
  getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit),
112990
113123
  forceDtsEmit,
112991
113124
  onlyBuildInfo,
112992
- !targetSourceFile
113125
+ !targetSourceFile && !skipBuildInfo
112993
113126
  );
112994
113127
  exit();
112995
113128
  return {
@@ -113011,7 +113144,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
113011
113144
  (_f = tracing) == null ? void 0 : _f.pop();
113012
113145
  }
113013
113146
  function emitBuildInfo(buildInfoPath) {
113014
- if (!buildInfoPath || targetSourceFile || emitSkipped) return;
113147
+ if (!buildInfoPath || targetSourceFile) return;
113015
113148
  if (host.isEmitBlocked(buildInfoPath)) {
113016
113149
  emitSkipped = true;
113017
113150
  return;
@@ -113349,7 +113482,8 @@ var notImplementedResolver = {
113349
113482
  getJsxFragmentFactoryEntity: notImplemented,
113350
113483
  isBindingCapturedByNode: notImplemented,
113351
113484
  getDeclarationStatementsForSourceFile: notImplemented,
113352
- isImportRequiredByAugmentation: notImplemented
113485
+ isImportRequiredByAugmentation: notImplemented,
113486
+ isDefinitelyReferenceToGlobalSymbolObject: notImplemented
113353
113487
  };
113354
113488
  var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
113355
113489
  var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -119964,7 +120098,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119964
120098
  }
119965
120099
  function emitBuildInfo(writeFileCallback) {
119966
120100
  var _a2, _b2;
119967
- Debug.assert(!options.outFile);
119968
120101
  (_a2 = tracing) == null ? void 0 : _a2.push(
119969
120102
  tracing.Phase.Emit,
119970
120103
  "emitBuildInfo",
@@ -120019,7 +120152,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120019
120152
  function getTypeChecker() {
120020
120153
  return typeChecker || (typeChecker = createTypeChecker(program));
120021
120154
  }
120022
- function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit) {
120155
+ function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit, skipBuildInfo) {
120023
120156
  var _a2, _b2;
120024
120157
  (_a2 = tracing) == null ? void 0 : _a2.push(
120025
120158
  tracing.Phase.Emit,
@@ -120028,14 +120161,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120028
120161
  /*separateBeginAndEnd*/
120029
120162
  true
120030
120163
  );
120031
- const result = runWithCancellationToken(() => emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit));
120164
+ const result = runWithCancellationToken(
120165
+ () => emitWorker(
120166
+ program,
120167
+ sourceFile,
120168
+ writeFileCallback,
120169
+ cancellationToken,
120170
+ emitOnly,
120171
+ transformers,
120172
+ forceDtsEmit,
120173
+ skipBuildInfo
120174
+ )
120175
+ );
120032
120176
  (_b2 = tracing) == null ? void 0 : _b2.pop();
120033
120177
  return result;
120034
120178
  }
120035
120179
  function isEmitBlocked(emitFileName) {
120036
120180
  return hasEmitBlockingDiagnostics.has(toPath3(emitFileName));
120037
120181
  }
120038
- function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnly, customTransformers, forceDtsEmit) {
120182
+ function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnly, customTransformers, forceDtsEmit, skipBuildInfo) {
120039
120183
  if (!forceDtsEmit) {
120040
120184
  const result = handleNoEmitOptions(program2, sourceFile, writeFileCallback, cancellationToken);
120041
120185
  if (result) return result;
@@ -120057,7 +120201,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120057
120201
  emitOnly,
120058
120202
  /*onlyBuildInfo*/
120059
120203
  false,
120060
- forceDtsEmit
120204
+ forceDtsEmit,
120205
+ skipBuildInfo
120061
120206
  )
120062
120207
  );
120063
120208
  mark("afterEmit");
@@ -122189,7 +122334,7 @@ function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken)
122189
122334
  const options = program.getCompilerOptions();
122190
122335
  if (options.noEmit) {
122191
122336
  program.getSemanticDiagnostics(sourceFile, cancellationToken);
122192
- return sourceFile || options.outFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
122337
+ return sourceFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
122193
122338
  }
122194
122339
  if (!options.noEmitOnError) return void 0;
122195
122340
  let diagnostics = [
@@ -122207,7 +122352,7 @@ function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken)
122207
122352
  }
122208
122353
  if (!diagnostics.length) return void 0;
122209
122354
  let emittedFiles;
122210
- if (!sourceFile && !options.outFile) {
122355
+ if (!sourceFile) {
122211
122356
  const emitResult = program.emitBuildInfo(writeFile2, cancellationToken);
122212
122357
  if (emitResult.diagnostics) diagnostics = [...diagnostics, ...emitResult.diagnostics];
122213
122358
  emittedFiles = emitResult.emittedFiles;
@@ -122689,17 +122834,17 @@ function createBuilderProgramState(newProgram, oldState) {
122689
122834
  const compilerOptions = newProgram.getCompilerOptions();
122690
122835
  state.compilerOptions = compilerOptions;
122691
122836
  const outFilePath = compilerOptions.outFile;
122692
- if (!outFilePath) {
122693
- state.semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
122694
- } else if (compilerOptions.composite && (oldState == null ? void 0 : oldState.outSignature) && outFilePath === oldState.compilerOptions.outFile) {
122837
+ state.semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
122838
+ if (outFilePath && compilerOptions.composite && (oldState == null ? void 0 : oldState.outSignature) && outFilePath === oldState.compilerOptions.outFile) {
122695
122839
  state.outSignature = oldState.outSignature && getEmitSignatureFromOldSignature(compilerOptions, oldState.compilerOptions, oldState.outSignature);
122696
122840
  }
122697
122841
  state.changedFilesSet = /* @__PURE__ */ new Set();
122698
122842
  state.latestChangedDtsFile = compilerOptions.composite ? oldState == null ? void 0 : oldState.latestChangedDtsFile : void 0;
122699
122843
  const useOldState = BuilderState.canReuseOldState(state.referencedMap, oldState);
122700
122844
  const oldCompilerOptions = useOldState ? oldState.compilerOptions : void 0;
122701
- const canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
122845
+ let canCopySemanticDiagnostics = useOldState && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
122702
122846
  const canCopyEmitSignatures = compilerOptions.composite && (oldState == null ? void 0 : oldState.emitSignatures) && !outFilePath && !compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions);
122847
+ let canCopyEmitDiagnostics = true;
122703
122848
  if (useOldState) {
122704
122849
  (_a = oldState.changedFilesSet) == null ? void 0 : _a.forEach((value) => state.changedFilesSet.add(value));
122705
122850
  if (!outFilePath && ((_b = oldState.affectedFilesPendingEmit) == null ? void 0 : _b.size)) {
@@ -122707,6 +122852,10 @@ function createBuilderProgramState(newProgram, oldState) {
122707
122852
  state.seenAffectedFiles = /* @__PURE__ */ new Set();
122708
122853
  }
122709
122854
  state.programEmitPending = oldState.programEmitPending;
122855
+ if (outFilePath && state.changedFilesSet.size) {
122856
+ canCopySemanticDiagnostics = false;
122857
+ canCopyEmitDiagnostics = false;
122858
+ }
122710
122859
  } else {
122711
122860
  state.buildInfoEmitPending = true;
122712
122861
  }
@@ -122724,10 +122873,10 @@ function createBuilderProgramState(newProgram, oldState) {
122724
122873
  oldInfo.impliedFormat !== info.impliedFormat || // Referenced files changed
122725
122874
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
122726
122875
  newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
122727
- addFileToChangeSet(state, sourceFilePath);
122876
+ addFileToChangeSet(sourceFilePath);
122728
122877
  } else {
122729
122878
  const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
122730
- const emitDiagnostics = (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath);
122879
+ const emitDiagnostics = canCopyEmitDiagnostics ? (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath) : void 0;
122731
122880
  if (emitDiagnostics) {
122732
122881
  (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
122733
122882
  sourceFilePath,
@@ -122756,16 +122905,16 @@ function createBuilderProgramState(newProgram, oldState) {
122756
122905
  });
122757
122906
  if (useOldState && forEachEntry(oldState.fileInfos, (info, sourceFilePath) => {
122758
122907
  if (state.fileInfos.has(sourceFilePath)) return false;
122759
- if (outFilePath || info.affectsGlobalScope) return true;
122908
+ if (info.affectsGlobalScope) return true;
122760
122909
  state.buildInfoEmitPending = true;
122761
- return false;
122910
+ return !!outFilePath;
122762
122911
  })) {
122763
122912
  BuilderState.getAllFilesExcludingDefaultLibraryFile(
122764
122913
  state,
122765
122914
  newProgram,
122766
122915
  /*firstSourceFile*/
122767
122916
  void 0
122768
- ).forEach((file) => addFileToChangeSet(state, file.resolvedPath));
122917
+ ).forEach((file) => addFileToChangeSet(file.resolvedPath));
122769
122918
  } else if (oldCompilerOptions) {
122770
122919
  const pendingEmitKind = compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions) ? getBuilderFileEmit(compilerOptions) : getPendingEmitKind(compilerOptions, oldCompilerOptions);
122771
122920
  if (pendingEmitKind !== 0 /* None */) {
@@ -122781,18 +122930,25 @@ function createBuilderProgramState(newProgram, oldState) {
122781
122930
  });
122782
122931
  Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
122783
122932
  state.seenAffectedFiles = state.seenAffectedFiles || /* @__PURE__ */ new Set();
122784
- state.buildInfoEmitPending = true;
122785
- } else {
122933
+ } else if (!state.changedFilesSet.size) {
122786
122934
  state.programEmitPending = state.programEmitPending ? state.programEmitPending | pendingEmitKind : pendingEmitKind;
122787
122935
  }
122936
+ state.buildInfoEmitPending = true;
122788
122937
  }
122789
122938
  }
122790
122939
  return state;
122791
- }
122792
- function addFileToChangeSet(state, path) {
122793
- state.changedFilesSet.add(path);
122794
- state.buildInfoEmitPending = true;
122795
- state.programEmitPending = void 0;
122940
+ function addFileToChangeSet(path) {
122941
+ state.changedFilesSet.add(path);
122942
+ if (outFilePath) {
122943
+ canCopySemanticDiagnostics = false;
122944
+ canCopyEmitDiagnostics = false;
122945
+ state.semanticDiagnosticsFromOldState = void 0;
122946
+ state.semanticDiagnosticsPerFile.clear();
122947
+ state.emitDiagnosticsPerFile = void 0;
122948
+ }
122949
+ state.buildInfoEmitPending = true;
122950
+ state.programEmitPending = void 0;
122951
+ }
122796
122952
  }
122797
122953
  function getEmitSignatureFromOldSignature(options, oldOptions, oldEmitSignature) {
122798
122954
  return !!options.declarationMap === !!oldOptions.declarationMap ? (
@@ -122865,6 +123021,7 @@ function backupBuilderProgramEmitState(state) {
122865
123021
  return {
122866
123022
  affectedFilesPendingEmit: state.affectedFilesPendingEmit && new Map(state.affectedFilesPendingEmit),
122867
123023
  seenEmittedFiles: state.seenEmittedFiles && new Map(state.seenEmittedFiles),
123024
+ seenProgramEmit: state.seenProgramEmit,
122868
123025
  programEmitPending: state.programEmitPending,
122869
123026
  emitSignatures: state.emitSignatures && new Map(state.emitSignatures),
122870
123027
  outSignature: state.outSignature,
@@ -122878,6 +123035,7 @@ function backupBuilderProgramEmitState(state) {
122878
123035
  function restoreBuilderProgramEmitState(state, savedEmitState) {
122879
123036
  state.affectedFilesPendingEmit = savedEmitState.affectedFilesPendingEmit;
122880
123037
  state.seenEmittedFiles = savedEmitState.seenEmittedFiles;
123038
+ state.seenProgramEmit = savedEmitState.seenProgramEmit;
122881
123039
  state.programEmitPending = savedEmitState.programEmitPending;
122882
123040
  state.emitSignatures = savedEmitState.emitSignatures;
122883
123041
  state.outSignature = savedEmitState.outSignature;
@@ -122886,6 +123044,10 @@ function restoreBuilderProgramEmitState(state, savedEmitState) {
122886
123044
  state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
122887
123045
  state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
122888
123046
  if (savedEmitState.changedFilesSet) state.changedFilesSet = savedEmitState.changedFilesSet;
123047
+ if (state.compilerOptions.outFile && state.changedFilesSet.size) {
123048
+ state.semanticDiagnosticsPerFile.clear();
123049
+ state.emitDiagnosticsPerFile = void 0;
123050
+ }
122889
123051
  }
122890
123052
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
122891
123053
  Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
@@ -122923,10 +123085,7 @@ function getNextAffectedFile(state, cancellationToken, host) {
122923
123085
  }
122924
123086
  const program = Debug.checkDefined(state.program);
122925
123087
  const compilerOptions = program.getCompilerOptions();
122926
- if (compilerOptions.outFile) {
122927
- Debug.assert(!state.semanticDiagnosticsPerFile);
122928
- return program;
122929
- }
123088
+ if (compilerOptions.outFile) return program;
122930
123089
  state.affectedFiles = BuilderState.getFilesAffectedByWithOldState(
122931
123090
  state,
122932
123091
  program,
@@ -122940,14 +123099,22 @@ function getNextAffectedFile(state, cancellationToken, host) {
122940
123099
  }
122941
123100
  }
122942
123101
  function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles) {
122943
- var _a;
122944
- if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size)) return;
122945
- if (!emitOnlyDtsFiles) return state.affectedFilesPendingEmit = void 0;
122946
- state.affectedFilesPendingEmit.forEach((emitKind, path) => {
123102
+ var _a, _b;
123103
+ if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) && !state.programEmitPending) return;
123104
+ if (!emitOnlyDtsFiles) {
123105
+ state.affectedFilesPendingEmit = void 0;
123106
+ state.programEmitPending = void 0;
123107
+ }
123108
+ (_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.forEach((emitKind, path) => {
122947
123109
  const pending = emitKind & 7 /* AllJs */;
122948
123110
  if (!pending) state.affectedFilesPendingEmit.delete(path);
122949
123111
  else state.affectedFilesPendingEmit.set(path, pending);
122950
123112
  });
123113
+ if (state.programEmitPending) {
123114
+ const pending = state.programEmitPending & 7 /* AllJs */;
123115
+ if (!pending) state.programEmitPending = void 0;
123116
+ else state.programEmitPending = pending;
123117
+ }
122951
123118
  }
122952
123119
  function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
122953
123120
  var _a;
@@ -123139,24 +123306,21 @@ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, invalidateJsF
123139
123306
  );
123140
123307
  return void 0;
123141
123308
  }
123142
- function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken) {
123309
+ function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
123143
123310
  return concatenate(
123144
- getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken),
123311
+ getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile),
123145
123312
  Debug.checkDefined(state.program).getProgramDiagnostics(sourceFile)
123146
123313
  );
123147
123314
  }
123148
- function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken) {
123315
+ function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
123316
+ semanticDiagnosticsPerFile ?? (semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile);
123149
123317
  const path = sourceFile.resolvedPath;
123150
- if (state.semanticDiagnosticsPerFile) {
123151
- const cachedDiagnostics = state.semanticDiagnosticsPerFile.get(path);
123152
- if (cachedDiagnostics) {
123153
- return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
123154
- }
123318
+ const cachedDiagnostics = semanticDiagnosticsPerFile.get(path);
123319
+ if (cachedDiagnostics) {
123320
+ return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
123155
123321
  }
123156
123322
  const diagnostics = Debug.checkDefined(state.program).getBindAndCheckDiagnostics(sourceFile, cancellationToken);
123157
- if (state.semanticDiagnosticsPerFile) {
123158
- state.semanticDiagnosticsPerFile.set(path, diagnostics);
123159
- }
123323
+ semanticDiagnosticsPerFile.set(path, diagnostics);
123160
123324
  return filterSemanticDiagnostics(diagnostics, state.compilerOptions);
123161
123325
  }
123162
123326
  function isProgramBundleEmitBuildInfo(info) {
@@ -123184,6 +123348,9 @@ function getBuildInfo2(state) {
123184
123348
  root,
123185
123349
  resolvedRoot: toResolvedRoot(),
123186
123350
  options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
123351
+ semanticDiagnosticsPerFile: convertToProgramBuildInfoDiagnostics(),
123352
+ emitDiagnosticsPerFile: convertToProgramBuildInfoEmitDiagnostics(),
123353
+ changeFileSet: toChangeFileSet(),
123187
123354
  outSignature: state.outSignature,
123188
123355
  latestChangedDtsFile,
123189
123356
  pendingEmit: !state.programEmitPending ? void 0 : (
@@ -123274,13 +123441,6 @@ function getBuildInfo2(state) {
123274
123441
  }
123275
123442
  }
123276
123443
  }
123277
- let changeFileSet;
123278
- if (state.changedFilesSet.size) {
123279
- for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
123280
- changeFileSet = append(changeFileSet, toFileId(path));
123281
- }
123282
- }
123283
- const emitDiagnosticsPerFile = convertToProgramBuildInfoEmitDiagnostics();
123284
123444
  const program = {
123285
123445
  fileNames,
123286
123446
  fileInfos,
@@ -123290,9 +123450,9 @@ function getBuildInfo2(state) {
123290
123450
  fileIdsList,
123291
123451
  referencedMap,
123292
123452
  semanticDiagnosticsPerFile,
123293
- emitDiagnosticsPerFile,
123453
+ emitDiagnosticsPerFile: convertToProgramBuildInfoEmitDiagnostics(),
123294
123454
  affectedFilesPendingEmit,
123295
- changeFileSet,
123455
+ changeFileSet: toChangeFileSet(),
123296
123456
  emitSignatures,
123297
123457
  latestChangedDtsFile
123298
123458
  };
@@ -123375,8 +123535,7 @@ function getBuildInfo2(state) {
123375
123535
  function convertToProgramBuildInfoDiagnostics() {
123376
123536
  let result;
123377
123537
  state.fileInfos.forEach((_value, key) => {
123378
- var _a2;
123379
- const value = (_a2 = state.semanticDiagnosticsPerFile) == null ? void 0 : _a2.get(key);
123538
+ const value = state.semanticDiagnosticsPerFile.get(key);
123380
123539
  if (!value) {
123381
123540
  if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
123382
123541
  } else if (value.length) {
@@ -123445,6 +123604,15 @@ function getBuildInfo2(state) {
123445
123604
  return result;
123446
123605
  }) || array;
123447
123606
  }
123607
+ function toChangeFileSet() {
123608
+ let changeFileSet;
123609
+ if (state.changedFilesSet.size) {
123610
+ for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
123611
+ changeFileSet = append(changeFileSet, toFileId(path));
123612
+ }
123613
+ }
123614
+ return changeFileSet;
123615
+ }
123448
123616
  }
123449
123617
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
123450
123618
  let host;
@@ -123543,14 +123711,16 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123543
123711
  return emitSkippedWithNoDiagnostics;
123544
123712
  }
123545
123713
  function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
123546
- var _a, _b, _c;
123714
+ var _a, _b, _c, _d;
123547
123715
  let affected = getNextAffectedFile(state, cancellationToken, host);
123548
123716
  const programEmitKind = getBuilderFileEmit(state.compilerOptions);
123549
123717
  let emitKind = emitOnlyDtsFiles ? programEmitKind & 24 /* AllDts */ : programEmitKind;
123550
123718
  if (!affected) {
123551
123719
  if (!state.compilerOptions.outFile) {
123552
123720
  const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
123553
- if (!pendingAffectedFile) {
123721
+ if (pendingAffectedFile) {
123722
+ ({ affectedFile: affected, emitKind } = pendingAffectedFile);
123723
+ } else {
123554
123724
  const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
123555
123725
  if (pendingForDiagnostics) {
123556
123726
  (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
@@ -123559,48 +123729,73 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123559
123729
  affected: pendingForDiagnostics.affectedFile
123560
123730
  };
123561
123731
  }
123562
- if (!state.buildInfoEmitPending) return void 0;
123563
- const affected2 = state.program;
123564
- const result2 = affected2.emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
123565
- state.buildInfoEmitPending = false;
123566
- return { result: result2, affected: affected2 };
123567
123732
  }
123568
- ({ affectedFile: affected, emitKind } = pendingAffectedFile);
123569
123733
  } else {
123570
- if (!state.programEmitPending) return void 0;
123571
- emitKind = state.programEmitPending;
123572
- if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
123573
- if (!emitKind) return void 0;
123574
- affected = state.program;
123734
+ if (state.programEmitPending) {
123735
+ emitKind = state.programEmitPending;
123736
+ if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
123737
+ if (emitKind) affected = state.program;
123738
+ }
123739
+ if (!affected && ((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) {
123740
+ const seenKind = state.seenProgramEmit || 0 /* None */;
123741
+ if (!(seenKind & 24 /* AllDts */)) {
123742
+ state.seenProgramEmit = 24 /* AllDts */ | seenKind;
123743
+ const diagnostics = [];
123744
+ state.emitDiagnosticsPerFile.forEach((d) => addRange(diagnostics, d));
123745
+ return {
123746
+ result: { emitSkipped: true, diagnostics },
123747
+ affected: state.program
123748
+ };
123749
+ }
123750
+ }
123751
+ }
123752
+ if (!affected) {
123753
+ if (!state.buildInfoEmitPending) return void 0;
123754
+ const affected2 = state.program;
123755
+ const result2 = affected2.emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
123756
+ state.buildInfoEmitPending = false;
123757
+ return { result: result2, affected: affected2 };
123575
123758
  }
123576
123759
  }
123577
123760
  let emitOnly;
123578
123761
  if (emitKind & 7 /* AllJs */) emitOnly = 0 /* Js */;
123579
123762
  if (emitKind & 24 /* AllDts */) emitOnly = emitOnly === void 0 ? 1 /* Dts */ : void 0;
123580
- if (affected === state.program) {
123581
- state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
123582
- }
123583
123763
  const result = state.program.emit(
123584
123764
  affected === state.program ? void 0 : affected,
123585
123765
  getWriteFileCallback(writeFile2, customTransformers),
123586
123766
  cancellationToken,
123587
123767
  emitOnly,
123588
- customTransformers
123768
+ customTransformers,
123769
+ /*forceDtsEmit*/
123770
+ void 0,
123771
+ /*skipBuildInfo*/
123772
+ true
123589
123773
  );
123590
123774
  if (affected !== state.program) {
123591
123775
  const affectedSourceFile = affected;
123592
123776
  state.seenAffectedFiles.add(affectedSourceFile.resolvedPath);
123593
123777
  if (state.affectedFilesIndex !== void 0) state.affectedFilesIndex++;
123594
123778
  state.buildInfoEmitPending = true;
123595
- const existing = ((_a = state.seenEmittedFiles) == null ? void 0 : _a.get(affectedSourceFile.resolvedPath)) || 0 /* None */;
123779
+ const existing = ((_b = state.seenEmittedFiles) == null ? void 0 : _b.get(affectedSourceFile.resolvedPath)) || 0 /* None */;
123596
123780
  (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, emitKind | existing);
123597
- const existingPending = ((_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.get(affectedSourceFile.resolvedPath)) || programEmitKind;
123781
+ const existingPending = ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.get(affectedSourceFile.resolvedPath)) || programEmitKind;
123598
123782
  const pendingKind = getPendingEmitKind(existingPending, emitKind | existing);
123599
123783
  if (pendingKind) (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
123600
- else (_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.delete(affectedSourceFile.resolvedPath);
123784
+ else (_d = state.affectedFilesPendingEmit) == null ? void 0 : _d.delete(affectedSourceFile.resolvedPath);
123601
123785
  if (result.diagnostics.length) (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, result.diagnostics);
123602
123786
  } else {
123603
123787
  state.changedFilesSet.clear();
123788
+ state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
123789
+ state.seenProgramEmit = emitKind | (state.seenProgramEmit || 0 /* None */);
123790
+ let emitDiagnosticsPerFile;
123791
+ result.diagnostics.forEach((d) => {
123792
+ if (!d.file) return;
123793
+ let diagnostics = emitDiagnosticsPerFile == null ? void 0 : emitDiagnosticsPerFile.get(d.file.resolvedPath);
123794
+ if (!diagnostics) (emitDiagnosticsPerFile ?? (emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(d.file.resolvedPath, diagnostics = []);
123795
+ diagnostics.push(d);
123796
+ });
123797
+ if (emitDiagnosticsPerFile) state.emitDiagnosticsPerFile = emitDiagnosticsPerFile;
123798
+ state.buildInfoEmitPending = true;
123604
123799
  }
123605
123800
  return { result, affected };
123606
123801
  }
@@ -123722,28 +123917,37 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123722
123917
  state.buildInfoEmitPending = true;
123723
123918
  if (!result) continue;
123724
123919
  } else {
123725
- result = state.program.getSemanticDiagnostics(
123726
- /*sourceFile*/
123727
- void 0,
123728
- cancellationToken
123920
+ let diagnostics;
123921
+ const semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
123922
+ state.program.getSourceFiles().forEach(
123923
+ (sourceFile) => diagnostics = addRange(
123924
+ diagnostics,
123925
+ getSemanticDiagnosticsOfFile(
123926
+ state,
123927
+ sourceFile,
123928
+ cancellationToken,
123929
+ semanticDiagnosticsPerFile
123930
+ )
123931
+ )
123729
123932
  );
123933
+ state.semanticDiagnosticsPerFile = semanticDiagnosticsPerFile;
123934
+ result = diagnostics || emptyArray;
123730
123935
  state.changedFilesSet.clear();
123731
123936
  state.programEmitPending = getBuilderFileEmit(state.compilerOptions);
123937
+ state.buildInfoEmitPending = true;
123732
123938
  }
123733
123939
  return { result, affected };
123734
123940
  }
123735
123941
  }
123736
123942
  function getSemanticDiagnostics(sourceFile, cancellationToken) {
123737
123943
  assertSourceFileOkWithoutNextAffectedCall(state, sourceFile);
123738
- const compilerOptions = Debug.checkDefined(state.program).getCompilerOptions();
123739
- if (compilerOptions.outFile) {
123740
- Debug.assert(!state.semanticDiagnosticsPerFile);
123741
- return Debug.checkDefined(state.program).getSemanticDiagnostics(sourceFile, cancellationToken);
123742
- }
123743
123944
  if (sourceFile) {
123744
123945
  return getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken);
123745
123946
  }
123746
- while (getSemanticDiagnosticsOfNextAffectedFile(cancellationToken)) {
123947
+ while (true) {
123948
+ const affectedResult = getSemanticDiagnosticsOfNextAffectedFile(cancellationToken);
123949
+ if (!affectedResult) break;
123950
+ if (affectedResult.affected === state.program) return affectedResult.result;
123747
123951
  }
123748
123952
  let diagnostics;
123749
123953
  for (const sourceFile2 of Debug.checkDefined(state.program).getSourceFiles()) {
@@ -123776,8 +123980,9 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
123776
123980
  const filePaths = (_a = program.fileNames) == null ? void 0 : _a.map(toPathInBuildInfoDirectory);
123777
123981
  let filePathsSetList;
123778
123982
  const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
123983
+ const fileInfos = /* @__PURE__ */ new Map();
123984
+ const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
123779
123985
  if (isProgramBundleEmitBuildInfo(program)) {
123780
- const fileInfos = /* @__PURE__ */ new Map();
123781
123986
  program.fileInfos.forEach((fileInfo, index) => {
123782
123987
  const path = toFilePath(index + 1);
123783
123988
  fileInfos.set(path, isString(fileInfo) ? { version: fileInfo, signature: void 0, affectsGlobalScope: void 0, impliedFormat: void 0 } : fileInfo);
@@ -123785,13 +123990,16 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
123785
123990
  state = {
123786
123991
  fileInfos,
123787
123992
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
123993
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile),
123994
+ emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
123995
+ hasReusableDiagnostic: true,
123996
+ changedFilesSet,
123788
123997
  latestChangedDtsFile,
123789
123998
  outSignature: program.outSignature,
123790
123999
  programEmitPending: program.pendingEmit === void 0 ? void 0 : toProgramEmitPending(program.pendingEmit, program.options)
123791
124000
  };
123792
124001
  } else {
123793
124002
  filePathsSetList = (_b = program.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
123794
- const fileInfos = /* @__PURE__ */ new Map();
123795
124003
  const emitSignatures = ((_c = program.options) == null ? void 0 : _c.composite) && !program.options.outFile ? /* @__PURE__ */ new Map() : void 0;
123796
124004
  program.fileInfos.forEach((fileInfo, index) => {
123797
124005
  const path = toFilePath(index + 1);
@@ -123812,13 +124020,12 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
123812
124020
  );
123813
124021
  }
123814
124022
  });
123815
- const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
123816
124023
  const fullEmitForOptions = program.affectedFilesPendingEmit ? getBuilderFileEmit(program.options || {}) : void 0;
123817
124024
  state = {
123818
124025
  fileInfos,
123819
124026
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
123820
124027
  referencedMap: toManyToManyPathMap(program.referencedMap, program.options ?? {}),
123821
- semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile, fileInfos, changedFilesSet),
124028
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile),
123822
124029
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
123823
124030
  hasReusableDiagnostic: true,
123824
124031
  affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
@@ -123870,7 +124077,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
123870
124077
  referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
123871
124078
  return map2;
123872
124079
  }
123873
- function toPerFileSemanticDiagnostics(diagnostics, fileInfos, changedFilesSet) {
124080
+ function toPerFileSemanticDiagnostics(diagnostics) {
123874
124081
  const semanticDiagnostics = new Map(
123875
124082
  mapDefinedIterator(
123876
124083
  fileInfos.keys(),
@@ -123881,7 +124088,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
123881
124088
  if (isNumber(value)) semanticDiagnostics.delete(toFilePath(value));
123882
124089
  else semanticDiagnostics.set(toFilePath(value[0]), value[1]);
123883
124090
  });
123884
- return semanticDiagnostics.size ? semanticDiagnostics : void 0;
124091
+ return semanticDiagnostics;
123885
124092
  }
123886
124093
  function toPerFileEmitDiagnostics(diagnostics) {
123887
124094
  return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(value[0]), (value) => value[1]);
@@ -126997,8 +127204,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
126997
127204
  ({ buildResult, step } = buildErrors(
126998
127205
  state,
126999
127206
  projectPath,
127000
- program,
127001
- config,
127002
127207
  diagnostics,
127003
127208
  errorFlags,
127004
127209
  errorType
@@ -127061,8 +127266,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
127061
127266
  ({ buildResult, step } = buildErrors(
127062
127267
  state,
127063
127268
  projectPath,
127064
- program,
127065
- config,
127066
127269
  declDiagnostics,
127067
127270
  32 /* DeclarationEmitErrors */,
127068
127271
  "Declaration file"
@@ -127125,8 +127328,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
127125
127328
  ({ buildResult, step } = buildErrors(
127126
127329
  state,
127127
127330
  projectPath,
127128
- program,
127129
- config,
127130
127331
  emitDiagnostics,
127131
127332
  64 /* EmitErrors */,
127132
127333
  "Emit"
@@ -127306,13 +127507,10 @@ function afterProgramDone(state, program) {
127306
127507
  }
127307
127508
  state.projectCompilerOptions = state.baseCompilerOptions;
127308
127509
  }
127309
- function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
127310
- const canEmitBuildInfo = program && !program.getCompilerOptions().outFile;
127510
+ function buildErrors(state, resolvedPath, diagnostics, buildResult, errorType) {
127311
127511
  reportAndStoreErrors(state, resolvedPath, diagnostics);
127312
127512
  state.projectStatus.set(resolvedPath, { type: 0 /* Unbuildable */, reason: `${errorType} errors` });
127313
- if (canEmitBuildInfo) return { buildResult, step: 4 /* EmitBuildInfo */ };
127314
- afterProgramDone(state, program);
127315
- return { buildResult, step: 5 /* QueueReferencingProjects */ };
127513
+ return { buildResult, step: 4 /* EmitBuildInfo */ };
127316
127514
  }
127317
127515
  function isFileWatcherWithModifiedTime(value) {
127318
127516
  return !!value.watcher;
@@ -127487,7 +127685,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
127487
127685
  };
127488
127686
  }
127489
127687
  if (buildInfo.program) {
127490
- if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.program.emitDiagnosticsPerFile) == null ? void 0 : _c.length) : (_d = buildInfo.program.semanticDiagnosticsPerFile) == null ? void 0 : _d.length)) {
127688
+ if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.program.emitDiagnosticsPerFile) == null ? void 0 : _c.length) || buildInfo.program.pendingEmit !== void 0 : (_d = buildInfo.program.semanticDiagnosticsPerFile) == null ? void 0 : _d.length)) {
127491
127689
  return {
127492
127690
  type: 7 /* OutOfDateBuildInfo */,
127493
127691
  buildInfoFile: buildInfoPath
@@ -129654,7 +129852,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
129654
129852
  expression,
129655
129853
  /*includeBigInt*/
129656
129854
  false
129657
- )) {
129855
+ ) && !resolver.isDefinitelyReferenceToGlobalSymbolObject(expression)) {
129658
129856
  context.tracker.reportInferenceFallback(prop.name);
129659
129857
  result = false;
129660
129858
  }