typescript 5.5.2 → 5.5.4

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.
@@ -203,7 +203,7 @@ interface Int8Array {
203
203
  /**
204
204
  * Copies the array and returns the copy with the elements in reverse order.
205
205
  */
206
- toReversed(): Uint8Array;
206
+ toReversed(): Int8Array;
207
207
 
208
208
  /**
209
209
  * Copies and sorts the array.
@@ -211,11 +211,11 @@ interface Int8Array {
211
211
  * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
212
212
  * value otherwise. If omitted, the elements are sorted in ascending order.
213
213
  * ```ts
214
- * const myNums = Uint8Array.from([11, 2, 22, 1]);
215
- * myNums.toSorted((a, b) => a - b) // Uint8Array(4) [1, 2, 11, 22]
214
+ * const myNums = Int8Array.from([11, 2, 22, 1]);
215
+ * myNums.toSorted((a, b) => a - b) // Int8Array(4) [1, 2, 11, 22]
216
216
  * ```
217
217
  */
218
- toSorted(compareFn?: (a: number, b: number) => number): Uint8Array;
218
+ toSorted(compareFn?: (a: number, b: number) => number): Int8Array;
219
219
 
220
220
  /**
221
221
  * Copies the array and inserts the given number at the provided index.
@@ -224,7 +224,7 @@ interface Int8Array {
224
224
  * @param value The value to insert into the copied array.
225
225
  * @returns A copy of the original array with the inserted value.
226
226
  */
227
- with(index: number, value: number): Uint8Array;
227
+ with(index: number, value: number): Int8Array;
228
228
  }
229
229
 
230
230
  interface Uint8Array {
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = "5.5.2";
21
+ var version = "5.5.4";
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -2509,10 +2509,12 @@ function tryGetPerformance() {
2509
2509
  if (isNodeLikeSystem()) {
2510
2510
  try {
2511
2511
  const { performance: performance2 } = require("perf_hooks");
2512
- return {
2513
- shouldWriteNativeEvents: false,
2514
- performance: performance2
2515
- };
2512
+ if (performance2) {
2513
+ return {
2514
+ shouldWriteNativeEvents: false,
2515
+ performance: performance2
2516
+ };
2517
+ }
2516
2518
  } catch {
2517
2519
  }
2518
2520
  }
@@ -8547,6 +8549,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8547
8549
  var tokenFlags;
8548
8550
  var commentDirectives;
8549
8551
  var skipJsDocLeadingAsterisks = 0;
8552
+ var asteriskSeen = false;
8550
8553
  var scriptKind = 0 /* Unknown */;
8551
8554
  var jsDocParsingMode = 0 /* ParseAll */;
8552
8555
  setText(text, start, length2);
@@ -8598,6 +8601,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8598
8601
  resetTokenState,
8599
8602
  setTextPos: resetTokenState,
8600
8603
  setSkipJsDocLeadingAsterisks,
8604
+ hasLeadingAsterisks,
8601
8605
  tryScan,
8602
8606
  lookAhead,
8603
8607
  scanRange
@@ -9204,7 +9208,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9204
9208
  function scan() {
9205
9209
  fullStartPos = pos;
9206
9210
  tokenFlags = 0 /* None */;
9207
- let asteriskSeen = false;
9211
+ asteriskSeen = false;
9208
9212
  while (true) {
9209
9213
  tokenStart = pos;
9210
9214
  if (pos >= end) {
@@ -11007,6 +11011,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
11007
11011
  function setSkipJsDocLeadingAsterisks(skip) {
11008
11012
  skipJsDocLeadingAsterisks += skip ? 1 : -1;
11009
11013
  }
11014
+ function hasLeadingAsterisks() {
11015
+ return asteriskSeen;
11016
+ }
11010
11017
  }
11011
11018
  function codePointAt(s, i) {
11012
11019
  return s.codePointAt(i);
@@ -12745,7 +12752,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
12745
12752
  }
12746
12753
  if (isJSDocNode(node) || node.kind === 12 /* JsxText */) {
12747
12754
  return skipTrivia(
12748
- (sourceFile || getSourceFileOfNode(node)).text,
12755
+ (sourceFile ?? getSourceFileOfNode(node)).text,
12749
12756
  node.pos,
12750
12757
  /*stopAfterLineBreak*/
12751
12758
  false,
@@ -12757,13 +12764,14 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
12757
12764
  return getTokenPosOfNode(node.jsDoc[0], sourceFile);
12758
12765
  }
12759
12766
  if (node.kind === 352 /* SyntaxList */) {
12760
- const first2 = firstOrUndefined(getNodeChildren(node));
12767
+ sourceFile ?? (sourceFile = getSourceFileOfNode(node));
12768
+ const first2 = firstOrUndefined(getNodeChildren(node, sourceFile));
12761
12769
  if (first2) {
12762
12770
  return getTokenPosOfNode(first2, sourceFile, includeJsDoc);
12763
12771
  }
12764
12772
  }
12765
12773
  return skipTrivia(
12766
- (sourceFile || getSourceFileOfNode(node)).text,
12774
+ (sourceFile ?? getSourceFileOfNode(node)).text,
12767
12775
  node.pos,
12768
12776
  /*stopAfterLineBreak*/
12769
12777
  false,
@@ -16086,11 +16094,11 @@ function getOwnEmitOutputFilePath(fileName, host, extension) {
16086
16094
  return emitOutputFilePathWithoutExtension + extension;
16087
16095
  }
16088
16096
  function getDeclarationEmitOutputFilePath(fileName, host) {
16089
- return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f));
16097
+ return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host);
16090
16098
  }
16091
- function getDeclarationEmitOutputFilePathWorker(fileName, options, currentDirectory, commonSourceDirectory, getCanonicalFileName) {
16099
+ function getDeclarationEmitOutputFilePathWorker(fileName, options, host) {
16092
16100
  const outputDir = options.declarationDir || options.outDir;
16093
- const path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName) : fileName;
16101
+ const path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f)) : fileName;
16094
16102
  const declarationExtension = getDeclarationEmitExtensionForPath(path);
16095
16103
  return removeFileExtension(path) + declarationExtension;
16096
16104
  }
@@ -23436,7 +23444,7 @@ function createNodeFactory(flags, baseFactory2) {
23436
23444
  }
23437
23445
  function createSyntaxList(children) {
23438
23446
  const node = createBaseNode(352 /* SyntaxList */);
23439
- setNodeChildren(node, children);
23447
+ node._children = children;
23440
23448
  return node;
23441
23449
  }
23442
23450
  function createNotEmittedStatement(original) {
@@ -26204,17 +26212,31 @@ function isJSDocImportTag(node) {
26204
26212
  }
26205
26213
 
26206
26214
  // src/compiler/factory/nodeChildren.ts
26207
- var nodeChildren = /* @__PURE__ */ new WeakMap();
26208
- function getNodeChildren(node) {
26209
- if (!isNodeKind(node.kind)) return emptyArray;
26210
- return nodeChildren.get(node);
26215
+ var sourceFileToNodeChildren = /* @__PURE__ */ new WeakMap();
26216
+ function getNodeChildren(node, sourceFile) {
26217
+ var _a;
26218
+ const kind = node.kind;
26219
+ if (!isNodeKind(kind)) {
26220
+ return emptyArray;
26221
+ }
26222
+ if (kind === 352 /* SyntaxList */) {
26223
+ return node._children;
26224
+ }
26225
+ return (_a = sourceFileToNodeChildren.get(sourceFile)) == null ? void 0 : _a.get(node);
26211
26226
  }
26212
- function setNodeChildren(node, children) {
26213
- nodeChildren.set(node, children);
26214
- return children;
26227
+ function unsetNodeChildren(node, origSourceFile) {
26228
+ var _a;
26229
+ if (node.kind === 352 /* SyntaxList */) {
26230
+ Debug.fail("Did not expect to unset the children of a SyntaxList.");
26231
+ }
26232
+ (_a = sourceFileToNodeChildren.get(origSourceFile)) == null ? void 0 : _a.delete(node);
26215
26233
  }
26216
- function unsetNodeChildren(node) {
26217
- nodeChildren.delete(node);
26234
+ function transferSourceFileChildren(sourceFile, targetSourceFile) {
26235
+ const map2 = sourceFileToNodeChildren.get(sourceFile);
26236
+ if (map2 !== void 0) {
26237
+ sourceFileToNodeChildren.delete(sourceFile);
26238
+ sourceFileToNodeChildren.set(targetSourceFile, map2);
26239
+ }
26218
26240
  }
26219
26241
 
26220
26242
  // src/compiler/factory/utilities.ts
@@ -28849,7 +28871,7 @@ var Parser;
28849
28871
  function createIdentifier(isIdentifier3, diagnosticMessage, privateIdentifierDiagnosticMessage) {
28850
28872
  if (isIdentifier3) {
28851
28873
  identifierCount++;
28852
- const pos = getNodePos();
28874
+ const pos = scanner.hasLeadingAsterisks() ? scanner.getTokenStart() : getNodePos();
28853
28875
  const originalKeywordKind = token();
28854
28876
  const text = internIdentifier(scanner.getTokenValue());
28855
28877
  const hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape();
@@ -34785,6 +34807,7 @@ var IncrementalParser;
34785
34807
  aggressiveChecks
34786
34808
  );
34787
34809
  result.impliedNodeFormat = sourceFile.impliedNodeFormat;
34810
+ transferSourceFileChildren(sourceFile, result);
34788
34811
  return result;
34789
34812
  }
34790
34813
  IncrementalParser2.updateSourceFile = updateSourceFile;
@@ -34820,7 +34843,7 @@ var IncrementalParser;
34820
34843
  }
34821
34844
  }
34822
34845
  }
34823
- function moveElementEntirelyPastChangeRange(element, isArray2, delta, oldText, newText, aggressiveChecks) {
34846
+ function moveElementEntirelyPastChangeRange(element, origSourceFile, isArray2, delta, oldText, newText, aggressiveChecks) {
34824
34847
  if (isArray2) {
34825
34848
  visitArray2(element);
34826
34849
  } else {
@@ -34832,7 +34855,7 @@ var IncrementalParser;
34832
34855
  if (aggressiveChecks && shouldCheckNode(node)) {
34833
34856
  text = oldText.substring(node.pos, node.end);
34834
34857
  }
34835
- unsetNodeChildren(node);
34858
+ unsetNodeChildren(node, origSourceFile);
34836
34859
  setTextRangePosEnd(node, node.pos + delta, node.end + delta);
34837
34860
  if (aggressiveChecks && shouldCheckNode(node)) {
34838
34861
  Debug.assert(text === newText.substring(node.pos, node.end));
@@ -34906,6 +34929,7 @@ var IncrementalParser;
34906
34929
  if (child.pos > changeRangeOldEnd) {
34907
34930
  moveElementEntirelyPastChangeRange(
34908
34931
  child,
34932
+ sourceFile,
34909
34933
  /*isArray*/
34910
34934
  false,
34911
34935
  delta,
@@ -34918,7 +34942,7 @@ var IncrementalParser;
34918
34942
  const fullEnd = child.end;
34919
34943
  if (fullEnd >= changeStart) {
34920
34944
  markAsIntersectingIncrementalChange(child);
34921
- unsetNodeChildren(child);
34945
+ unsetNodeChildren(child, sourceFile);
34922
34946
  adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
34923
34947
  forEachChild(child, visitNode3, visitArray2);
34924
34948
  if (hasJSDocNodes(child)) {
@@ -34936,6 +34960,7 @@ var IncrementalParser;
34936
34960
  if (array.pos > changeRangeOldEnd) {
34937
34961
  moveElementEntirelyPastChangeRange(
34938
34962
  array,
34963
+ sourceFile,
34939
34964
  /*isArray*/
34940
34965
  true,
34941
34966
  delta,
@@ -35636,7 +35661,6 @@ var commonOptionsWithBuild = [
35636
35661
  affectsBuildInfo: true,
35637
35662
  showInSimplifiedHelpView: true,
35638
35663
  category: Diagnostics.Emit,
35639
- transpileOptionValue: void 0,
35640
35664
  defaultValueDescription: false,
35641
35665
  description: Diagnostics.Create_sourcemaps_for_d_ts_files
35642
35666
  },
@@ -35962,6 +35986,7 @@ var commandOptionsWithoutBuild = [
35962
35986
  type: "boolean",
35963
35987
  affectsEmit: true,
35964
35988
  affectsBuildInfo: true,
35989
+ affectsSourceFile: true,
35965
35990
  category: Diagnostics.Emit,
35966
35991
  description: Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
35967
35992
  defaultValueDescription: false
@@ -36426,6 +36451,7 @@ var commandOptionsWithoutBuild = [
36426
36451
  affectsEmit: true,
36427
36452
  affectsBuildInfo: true,
36428
36453
  affectsModuleResolution: true,
36454
+ affectsSourceFile: true,
36429
36455
  category: Diagnostics.Language_and_Environment,
36430
36456
  description: Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
36431
36457
  defaultValueDescription: "react"
@@ -45124,7 +45150,8 @@ function createTypeChecker(host) {
45124
45150
  isUndefinedIdentifierExpression(node) {
45125
45151
  Debug.assert(isExpressionNode(node));
45126
45152
  return getSymbolAtLocation(node) === undefinedSymbol;
45127
- }
45153
+ },
45154
+ isDefinitelyReferenceToGlobalSymbolObject
45128
45155
  });
45129
45156
  var evaluate = createEvaluator({
45130
45157
  evaluateElementAccessExpression,
@@ -45954,6 +45981,7 @@ function createTypeChecker(host) {
45954
45981
  };
45955
45982
  var amalgamatedDuplicates;
45956
45983
  var reverseMappedCache = /* @__PURE__ */ new Map();
45984
+ var reverseHomomorphicMappedCache = /* @__PURE__ */ new Map();
45957
45985
  var ambientModulesCache;
45958
45986
  var patternAmbientModules;
45959
45987
  var patternAmbientModuleAugmentations;
@@ -46081,6 +46109,21 @@ function createTypeChecker(host) {
46081
46109
  ];
46082
46110
  initializeTypeChecker();
46083
46111
  return checker;
46112
+ function isDefinitelyReferenceToGlobalSymbolObject(node) {
46113
+ if (!isPropertyAccessExpression(node)) return false;
46114
+ if (!isIdentifier(node.name)) return false;
46115
+ if (!isPropertyAccessExpression(node.expression) && !isIdentifier(node.expression)) return false;
46116
+ if (isIdentifier(node.expression)) {
46117
+ return idText(node.expression) === "Symbol" && getResolvedSymbol(node.expression) === (getGlobalSymbol(
46118
+ "Symbol",
46119
+ 111551 /* Value */ | 1048576 /* ExportValue */,
46120
+ /*diagnostic*/
46121
+ void 0
46122
+ ) || unknownSymbol);
46123
+ }
46124
+ if (!isIdentifier(node.expression.expression)) return false;
46125
+ return idText(node.expression.name) === "Symbol" && idText(node.expression.expression) === "globalThis" && getResolvedSymbol(node.expression.expression) === globalThisSymbol;
46126
+ }
46084
46127
  function getCachedType(key) {
46085
46128
  return key ? cachedTypes.get(key) : void 0;
46086
46129
  }
@@ -48048,7 +48091,7 @@ function createTypeChecker(host) {
48048
48091
  }
48049
48092
  if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
48050
48093
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
48051
- const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
48094
+ const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l) || isJSDocImportTag(l));
48052
48095
  if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
48053
48096
  if (findAncestor(location, isImportEqualsDeclaration)) {
48054
48097
  error(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
@@ -49293,11 +49336,11 @@ function createTypeChecker(host) {
49293
49336
  function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined) {
49294
49337
  const originalType = type;
49295
49338
  if (addUndefined) {
49296
- type = getOptionalType(type);
49339
+ type = getOptionalType(type, !isParameter(host2));
49297
49340
  }
49298
49341
  const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
49299
49342
  if (clone) {
49300
- if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
49343
+ if (addUndefined && containsNonMissingUndefinedType(type) && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
49301
49344
  return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
49302
49345
  }
49303
49346
  return clone;
@@ -50157,7 +50200,21 @@ function createTypeChecker(host) {
50157
50200
  }
50158
50201
  function shouldUsePlaceholderForProperty(propertySymbol, context) {
50159
50202
  var _a;
50160
- return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
50203
+ const depth = 3;
50204
+ return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */) || isDeeplyNestedReverseMappedTypeProperty());
50205
+ function isDeeplyNestedReverseMappedTypeProperty() {
50206
+ var _a2;
50207
+ if ((((_a2 = context.reverseMappedStack) == null ? void 0 : _a2.length) ?? 0) < depth) {
50208
+ return false;
50209
+ }
50210
+ for (let i = 0; i < depth; i++) {
50211
+ const prop = context.reverseMappedStack[context.reverseMappedStack.length - 1 - i];
50212
+ if (prop.links.mappedType.symbol !== propertySymbol.links.mappedType.symbol) {
50213
+ return false;
50214
+ }
50215
+ }
50216
+ return true;
50217
+ }
50161
50218
  }
50162
50219
  function addPropertyToElementList(propertySymbol, context, typeElements) {
50163
50220
  var _a;
@@ -51244,8 +51301,8 @@ function createTypeChecker(host) {
51244
51301
  return enclosingDeclaration;
51245
51302
  }
51246
51303
  function serializeTypeForDeclaration(context, declaration, type, symbol) {
51247
- var _a;
51248
- const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
51304
+ var _a, _b;
51305
+ const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
51249
51306
  const enclosingDeclaration = context.enclosingDeclaration;
51250
51307
  const oldFlags = context.flags;
51251
51308
  if (declaration && hasInferredType(declaration) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
@@ -51256,6 +51313,7 @@ function createTypeChecker(host) {
51256
51313
  const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
51257
51314
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
51258
51315
  const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
51316
+ const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
51259
51317
  const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
51260
51318
  if (result2) {
51261
51319
  context.flags = oldFlags;
@@ -51266,9 +51324,9 @@ function createTypeChecker(host) {
51266
51324
  if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
51267
51325
  context.flags |= 1048576 /* AllowUniqueESSymbolType */;
51268
51326
  }
51269
- const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
51327
+ const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
51270
51328
  const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
51271
- const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
51329
+ const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
51272
51330
  context.flags = oldFlags;
51273
51331
  return result;
51274
51332
  }
@@ -51303,9 +51361,9 @@ function createTypeChecker(host) {
51303
51361
  const typePredicate = getTypePredicateOfSignature(signature);
51304
51362
  const type = getReturnTypeOfSignature(signature);
51305
51363
  if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
51306
- const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
51307
- if (annotation && getTypeFromTypeNode2(context, annotation) === type) {
51308
- const result = tryReuseExistingTypeNodeHelper(context, annotation);
51364
+ const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
51365
+ if (annotation) {
51366
+ const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
51309
51367
  if (result) {
51310
51368
  return result;
51311
51369
  }
@@ -51799,7 +51857,10 @@ function createTypeChecker(host) {
51799
51857
  );
51800
51858
  }
51801
51859
  if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
51802
- if (!(context.flags & 1 /* AllowUnresolvedNames */ && hasDynamicName(node) && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
51860
+ if (!hasDynamicName(node)) {
51861
+ return visitEachChild2(node, visitExistingNodeTreeSymbols);
51862
+ }
51863
+ if (!(context.flags & 1 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
51803
51864
  return void 0;
51804
51865
  }
51805
51866
  }
@@ -51929,7 +51990,7 @@ function createTypeChecker(host) {
51929
51990
  if (result) {
51930
51991
  if (result.pos !== -1 || result.end !== -1) {
51931
51992
  if (result === nodes) {
51932
- result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
51993
+ result = factory.createNodeArray(nodes.slice(), nodes.hasTrailingComma);
51933
51994
  }
51934
51995
  setTextRangePosEnd(result, -1, -1);
51935
51996
  }
@@ -57886,7 +57947,7 @@ function createTypeChecker(host) {
57886
57947
  );
57887
57948
  }
57888
57949
  function createSignatureTypeMapper(signature, typeArguments) {
57889
- return createTypeMapper(signature.typeParameters, typeArguments);
57950
+ return createTypeMapper(sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp), typeArguments);
57890
57951
  }
57891
57952
  function getErasedSignature(signature) {
57892
57953
  return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
@@ -62529,6 +62590,10 @@ function createTypeChecker(host) {
62529
62590
  function containsUndefinedType(type) {
62530
62591
  return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
62531
62592
  }
62593
+ function containsNonMissingUndefinedType(type) {
62594
+ const candidate = type.flags & 1048576 /* Union */ ? type.types[0] : type;
62595
+ return !!(candidate.flags & 32768 /* Undefined */) && candidate !== missingType;
62596
+ }
62532
62597
  function isStringIndexSignatureOnlyType(type) {
62533
62598
  return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false;
62534
62599
  }
@@ -66177,11 +66242,11 @@ function createTypeChecker(host) {
66177
66242
  }
66178
66243
  function inferTypeForHomomorphicMappedType(source, target, constraint) {
66179
66244
  const cacheKey = source.id + "," + target.id + "," + constraint.id;
66180
- if (reverseMappedCache.has(cacheKey)) {
66181
- return reverseMappedCache.get(cacheKey);
66245
+ if (reverseHomomorphicMappedCache.has(cacheKey)) {
66246
+ return reverseHomomorphicMappedCache.get(cacheKey);
66182
66247
  }
66183
66248
  const type = createReverseMappedType(source, target, constraint);
66184
- reverseMappedCache.set(cacheKey, type);
66249
+ reverseHomomorphicMappedCache.set(cacheKey, type);
66185
66250
  return type;
66186
66251
  }
66187
66252
  function isPartiallyInferableType(type) {
@@ -69409,7 +69474,7 @@ function createTypeChecker(host) {
69409
69474
  if (!canCollectSymbolAliasAccessabilityData) {
69410
69475
  return;
69411
69476
  }
69412
- if (location.flags & 33554432 /* Ambient */) {
69477
+ if (location.flags & 33554432 /* Ambient */ && !isPropertySignature(location) && !isPropertyDeclaration(location)) {
69413
69478
  return;
69414
69479
  }
69415
69480
  switch (hint) {
@@ -72413,7 +72478,7 @@ function createTypeChecker(host) {
72413
72478
  checkGrammarJsxElement(node);
72414
72479
  }
72415
72480
  checkJsxPreconditions(node);
72416
- markLinkedReferences(node, 4 /* Jsx */);
72481
+ markJsxAliasReferenced(node);
72417
72482
  if (isNodeOpeningLikeElement) {
72418
72483
  const jsxOpeningLikeNode = node;
72419
72484
  const sig = getResolvedSignature(jsxOpeningLikeNode);
@@ -85149,15 +85214,14 @@ function createTypeChecker(host) {
85149
85214
  function checkChildIdentifiers(node2) {
85150
85215
  forEachNodeRecursively(node2, checkIdentifiers);
85151
85216
  }
85217
+ function isExpressionNodeOrShorthandPropertyAssignmentName(node2) {
85218
+ return isExpressionNode(node2) || isShorthandPropertyAssignment(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2;
85219
+ }
85152
85220
  function checkSingleIdentifier(node2) {
85153
85221
  const nodeLinks2 = getNodeLinks(node2);
85154
85222
  nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
85155
- if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
85156
- const s = getSymbolAtLocation(
85157
- node2,
85158
- /*ignoreErrors*/
85159
- true
85160
- );
85223
+ if (isIdentifier(node2) && isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
85224
+ const s = getResolvedSymbol(node2);
85161
85225
  if (s && s !== unknownSymbol) {
85162
85226
  checkIdentifierCalculateNodeCheckFlags(node2, s);
85163
85227
  }
@@ -85625,7 +85689,8 @@ function createTypeChecker(host) {
85625
85689
  resolveExternalModuleSymbol(sym);
85626
85690
  return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
85627
85691
  },
85628
- isImportRequiredByAugmentation
85692
+ isImportRequiredByAugmentation,
85693
+ isDefinitelyReferenceToGlobalSymbolObject
85629
85694
  };
85630
85695
  function isImportRequiredByAugmentation(node) {
85631
85696
  const file = getSourceFileOfNode(node);
@@ -110759,6 +110824,7 @@ function transformDeclarations(context) {
110759
110824
  }
110760
110825
  function reportInferenceFallback(node) {
110761
110826
  if (!isolatedDeclarations || isSourceFileJS(currentSourceFile)) return;
110827
+ if (getSourceFileOfNode(node) !== currentSourceFile) return;
110762
110828
  if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
110763
110829
  reportExpandoFunctionErrors(node);
110764
110830
  } else {
@@ -111397,15 +111463,17 @@ function transformDeclarations(context) {
111397
111463
  if (isDeclarationAndNotVisible(input)) return;
111398
111464
  if (hasDynamicName(input)) {
111399
111465
  if (isolatedDeclarations) {
111400
- if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
111401
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
111402
- return;
111403
- } else if (
111404
- // Type declarations just need to double-check that the input computed name is an entity name expression
111405
- (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
111406
- ) {
111407
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
111408
- return;
111466
+ if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
111467
+ if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
111468
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
111469
+ return;
111470
+ } else if (
111471
+ // Type declarations just need to double-check that the input computed name is an entity name expression
111472
+ (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
111473
+ ) {
111474
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
111475
+ return;
111476
+ }
111409
111477
  }
111410
111478
  } else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
111411
111479
  return;
@@ -113130,7 +113198,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
113130
113198
  noEmitHelpers: true,
113131
113199
  module: compilerOptions.module,
113132
113200
  target: compilerOptions.target,
113133
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
113201
+ sourceMap: emitOnly !== 2 /* BuilderSignature */ && compilerOptions.declarationMap,
113134
113202
  inlineSourceMap: compilerOptions.inlineSourceMap,
113135
113203
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
113136
113204
  onlyPrintJsDocStyle: true,
@@ -113353,7 +113421,8 @@ var notImplementedResolver = {
113353
113421
  getJsxFragmentFactoryEntity: notImplemented,
113354
113422
  isBindingCapturedByNode: notImplemented,
113355
113423
  getDeclarationStatementsForSourceFile: notImplemented,
113356
- isImportRequiredByAugmentation: notImplemented
113424
+ isImportRequiredByAugmentation: notImplemented,
113425
+ isDefinitelyReferenceToGlobalSymbolObject: notImplemented
113357
113426
  };
113358
113427
  var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
113359
113428
  var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -118604,7 +118673,7 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
118604
118673
  }
118605
118674
  function getModeForUsageLocationWorker(file, usage, compilerOptions) {
118606
118675
  var _a;
118607
- if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
118676
+ if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent) || isJSDocImportTag(usage.parent)) {
118608
118677
  const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
118609
118678
  if (isTypeOnly) {
118610
118679
  const override = getResolutionModeOverride(usage.parent.attributes);
@@ -121383,7 +121452,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121383
121452
  if (options.outDir || // there is --outDir specified
121384
121453
  options.rootDir || // there is --rootDir specified
121385
121454
  options.sourceRoot || // there is --sourceRoot specified
121386
- options.mapRoot) {
121455
+ options.mapRoot || // there is --mapRoot specified
121456
+ getEmitDeclarations(options) && options.declarationDir) {
121387
121457
  const dir = getCommonSourceDirectory2();
121388
121458
  if (options.outDir && dir === "" && files.some((file) => getRootLength(file.fileName) > 1)) {
121389
121459
  createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
@@ -122468,8 +122538,7 @@ var BuilderState;
122468
122538
  );
122469
122539
  },
122470
122540
  cancellationToken,
122471
- /*emitOnly*/
122472
- true,
122541
+ 2 /* BuilderSignature */,
122473
122542
  /*customTransformers*/
122474
122543
  void 0,
122475
122544
  /*forceDtsEmit*/
@@ -129606,7 +129675,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
129606
129675
  expression,
129607
129676
  /*includeBigInt*/
129608
129677
  false
129609
- )) {
129678
+ ) && !resolver.isDefinitelyReferenceToGlobalSymbolObject(expression)) {
129610
129679
  context.tracker.reportInferenceFallback(prop.name);
129611
129680
  result = false;
129612
129681
  }
package/lib/typescript.js CHANGED
@@ -2254,6 +2254,7 @@ __export(typescript_exports, {
2254
2254
  trace: () => trace,
2255
2255
  tracing: () => tracing,
2256
2256
  tracingEnabled: () => tracingEnabled,
2257
+ transferSourceFileChildren: () => transferSourceFileChildren,
2257
2258
  transform: () => transform,
2258
2259
  transformClassFields: () => transformClassFields,
2259
2260
  transformDeclarations: () => transformDeclarations,
@@ -2366,7 +2367,7 @@ module.exports = __toCommonJS(typescript_exports);
2366
2367
 
2367
2368
  // src/compiler/corePublic.ts
2368
2369
  var versionMajorMinor = "5.5";
2369
- var version = "5.5.2";
2370
+ var version = "5.5.4";
2370
2371
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2371
2372
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2372
2373
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -5239,10 +5240,12 @@ function tryGetPerformance() {
5239
5240
  if (isNodeLikeSystem()) {
5240
5241
  try {
5241
5242
  const { performance: performance2 } = require("perf_hooks");
5242
- return {
5243
- shouldWriteNativeEvents: false,
5244
- performance: performance2
5245
- };
5243
+ if (performance2) {
5244
+ return {
5245
+ shouldWriteNativeEvents: false,
5246
+ performance: performance2
5247
+ };
5248
+ }
5246
5249
  } catch {
5247
5250
  }
5248
5251
  }
@@ -6280,6 +6283,7 @@ var FilePreprocessingDiagnosticsKind = /* @__PURE__ */ ((FilePreprocessingDiagno
6280
6283
  var EmitOnly = /* @__PURE__ */ ((EmitOnly4) => {
6281
6284
  EmitOnly4[EmitOnly4["Js"] = 0] = "Js";
6282
6285
  EmitOnly4[EmitOnly4["Dts"] = 1] = "Dts";
6286
+ EmitOnly4[EmitOnly4["BuilderSignature"] = 2] = "BuilderSignature";
6283
6287
  return EmitOnly4;
6284
6288
  })(EmitOnly || {});
6285
6289
  var StructureIsReused = /* @__PURE__ */ ((StructureIsReused2) => {
@@ -12149,6 +12153,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12149
12153
  var tokenFlags;
12150
12154
  var commentDirectives;
12151
12155
  var skipJsDocLeadingAsterisks = 0;
12156
+ var asteriskSeen = false;
12152
12157
  var scriptKind = 0 /* Unknown */;
12153
12158
  var jsDocParsingMode = 0 /* ParseAll */;
12154
12159
  setText(text, start, length2);
@@ -12200,6 +12205,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12200
12205
  resetTokenState,
12201
12206
  setTextPos: resetTokenState,
12202
12207
  setSkipJsDocLeadingAsterisks,
12208
+ hasLeadingAsterisks,
12203
12209
  tryScan,
12204
12210
  lookAhead,
12205
12211
  scanRange
@@ -12806,7 +12812,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12806
12812
  function scan() {
12807
12813
  fullStartPos = pos;
12808
12814
  tokenFlags = 0 /* None */;
12809
- let asteriskSeen = false;
12815
+ asteriskSeen = false;
12810
12816
  while (true) {
12811
12817
  tokenStart = pos;
12812
12818
  if (pos >= end) {
@@ -14609,6 +14615,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14609
14615
  function setSkipJsDocLeadingAsterisks(skip) {
14610
14616
  skipJsDocLeadingAsterisks += skip ? 1 : -1;
14611
14617
  }
14618
+ function hasLeadingAsterisks() {
14619
+ return asteriskSeen;
14620
+ }
14612
14621
  }
14613
14622
  function codePointAt(s, i) {
14614
14623
  return s.codePointAt(i);
@@ -16552,7 +16561,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
16552
16561
  }
16553
16562
  if (isJSDocNode(node) || node.kind === 12 /* JsxText */) {
16554
16563
  return skipTrivia(
16555
- (sourceFile || getSourceFileOfNode(node)).text,
16564
+ (sourceFile ?? getSourceFileOfNode(node)).text,
16556
16565
  node.pos,
16557
16566
  /*stopAfterLineBreak*/
16558
16567
  false,
@@ -16564,13 +16573,14 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
16564
16573
  return getTokenPosOfNode(node.jsDoc[0], sourceFile);
16565
16574
  }
16566
16575
  if (node.kind === 352 /* SyntaxList */) {
16567
- const first2 = firstOrUndefined(getNodeChildren(node));
16576
+ sourceFile ?? (sourceFile = getSourceFileOfNode(node));
16577
+ const first2 = firstOrUndefined(getNodeChildren(node, sourceFile));
16568
16578
  if (first2) {
16569
16579
  return getTokenPosOfNode(first2, sourceFile, includeJsDoc);
16570
16580
  }
16571
16581
  }
16572
16582
  return skipTrivia(
16573
- (sourceFile || getSourceFileOfNode(node)).text,
16583
+ (sourceFile ?? getSourceFileOfNode(node)).text,
16574
16584
  node.pos,
16575
16585
  /*stopAfterLineBreak*/
16576
16586
  false,
@@ -20113,11 +20123,11 @@ function getOwnEmitOutputFilePath(fileName, host, extension) {
20113
20123
  return emitOutputFilePathWithoutExtension + extension;
20114
20124
  }
20115
20125
  function getDeclarationEmitOutputFilePath(fileName, host) {
20116
- return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f));
20126
+ return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host);
20117
20127
  }
20118
- function getDeclarationEmitOutputFilePathWorker(fileName, options, currentDirectory, commonSourceDirectory, getCanonicalFileName) {
20128
+ function getDeclarationEmitOutputFilePathWorker(fileName, options, host) {
20119
20129
  const outputDir = options.declarationDir || options.outDir;
20120
- const path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName) : fileName;
20130
+ const path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f)) : fileName;
20121
20131
  const declarationExtension = getDeclarationEmitExtensionForPath(path);
20122
20132
  return removeFileExtension(path) + declarationExtension;
20123
20133
  }
@@ -27685,7 +27695,7 @@ function createNodeFactory(flags, baseFactory2) {
27685
27695
  }
27686
27696
  function createSyntaxList3(children) {
27687
27697
  const node = createBaseNode(352 /* SyntaxList */);
27688
- setNodeChildren(node, children);
27698
+ node._children = children;
27689
27699
  return node;
27690
27700
  }
27691
27701
  function createNotEmittedStatement(original) {
@@ -30578,17 +30588,43 @@ function isSyntaxList(n) {
30578
30588
  }
30579
30589
 
30580
30590
  // src/compiler/factory/nodeChildren.ts
30581
- var nodeChildren = /* @__PURE__ */ new WeakMap();
30582
- function getNodeChildren(node) {
30583
- if (!isNodeKind(node.kind)) return emptyArray;
30584
- return nodeChildren.get(node);
30591
+ var sourceFileToNodeChildren = /* @__PURE__ */ new WeakMap();
30592
+ function getNodeChildren(node, sourceFile) {
30593
+ var _a;
30594
+ const kind = node.kind;
30595
+ if (!isNodeKind(kind)) {
30596
+ return emptyArray;
30597
+ }
30598
+ if (kind === 352 /* SyntaxList */) {
30599
+ return node._children;
30600
+ }
30601
+ return (_a = sourceFileToNodeChildren.get(sourceFile)) == null ? void 0 : _a.get(node);
30585
30602
  }
30586
- function setNodeChildren(node, children) {
30587
- nodeChildren.set(node, children);
30603
+ function setNodeChildren(node, sourceFile, children) {
30604
+ if (node.kind === 352 /* SyntaxList */) {
30605
+ Debug.fail("Should not need to re-set the children of a SyntaxList.");
30606
+ }
30607
+ let map2 = sourceFileToNodeChildren.get(sourceFile);
30608
+ if (map2 === void 0) {
30609
+ map2 = /* @__PURE__ */ new WeakMap();
30610
+ sourceFileToNodeChildren.set(sourceFile, map2);
30611
+ }
30612
+ map2.set(node, children);
30588
30613
  return children;
30589
30614
  }
30590
- function unsetNodeChildren(node) {
30591
- nodeChildren.delete(node);
30615
+ function unsetNodeChildren(node, origSourceFile) {
30616
+ var _a;
30617
+ if (node.kind === 352 /* SyntaxList */) {
30618
+ Debug.fail("Did not expect to unset the children of a SyntaxList.");
30619
+ }
30620
+ (_a = sourceFileToNodeChildren.get(origSourceFile)) == null ? void 0 : _a.delete(node);
30621
+ }
30622
+ function transferSourceFileChildren(sourceFile, targetSourceFile) {
30623
+ const map2 = sourceFileToNodeChildren.get(sourceFile);
30624
+ if (map2 !== void 0) {
30625
+ sourceFileToNodeChildren.delete(sourceFile);
30626
+ sourceFileToNodeChildren.set(targetSourceFile, map2);
30627
+ }
30592
30628
  }
30593
30629
 
30594
30630
  // src/compiler/factory/utilities.ts
@@ -33264,7 +33300,7 @@ var Parser;
33264
33300
  function createIdentifier(isIdentifier3, diagnosticMessage, privateIdentifierDiagnosticMessage) {
33265
33301
  if (isIdentifier3) {
33266
33302
  identifierCount++;
33267
- const pos = getNodePos();
33303
+ const pos = scanner2.hasLeadingAsterisks() ? scanner2.getTokenStart() : getNodePos();
33268
33304
  const originalKeywordKind = token();
33269
33305
  const text = internIdentifier(scanner2.getTokenValue());
33270
33306
  const hasExtendedUnicodeEscape = scanner2.hasExtendedUnicodeEscape();
@@ -39200,6 +39236,7 @@ var IncrementalParser;
39200
39236
  aggressiveChecks
39201
39237
  );
39202
39238
  result.impliedNodeFormat = sourceFile.impliedNodeFormat;
39239
+ transferSourceFileChildren(sourceFile, result);
39203
39240
  return result;
39204
39241
  }
39205
39242
  IncrementalParser2.updateSourceFile = updateSourceFile2;
@@ -39235,7 +39272,7 @@ var IncrementalParser;
39235
39272
  }
39236
39273
  }
39237
39274
  }
39238
- function moveElementEntirelyPastChangeRange(element, isArray2, delta, oldText, newText, aggressiveChecks) {
39275
+ function moveElementEntirelyPastChangeRange(element, origSourceFile, isArray2, delta, oldText, newText, aggressiveChecks) {
39239
39276
  if (isArray2) {
39240
39277
  visitArray2(element);
39241
39278
  } else {
@@ -39247,7 +39284,7 @@ var IncrementalParser;
39247
39284
  if (aggressiveChecks && shouldCheckNode(node)) {
39248
39285
  text = oldText.substring(node.pos, node.end);
39249
39286
  }
39250
- unsetNodeChildren(node);
39287
+ unsetNodeChildren(node, origSourceFile);
39251
39288
  setTextRangePosEnd(node, node.pos + delta, node.end + delta);
39252
39289
  if (aggressiveChecks && shouldCheckNode(node)) {
39253
39290
  Debug.assert(text === newText.substring(node.pos, node.end));
@@ -39321,6 +39358,7 @@ var IncrementalParser;
39321
39358
  if (child.pos > changeRangeOldEnd) {
39322
39359
  moveElementEntirelyPastChangeRange(
39323
39360
  child,
39361
+ sourceFile,
39324
39362
  /*isArray*/
39325
39363
  false,
39326
39364
  delta,
@@ -39333,7 +39371,7 @@ var IncrementalParser;
39333
39371
  const fullEnd = child.end;
39334
39372
  if (fullEnd >= changeStart) {
39335
39373
  markAsIntersectingIncrementalChange(child);
39336
- unsetNodeChildren(child);
39374
+ unsetNodeChildren(child, sourceFile);
39337
39375
  adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
39338
39376
  forEachChild(child, visitNode3, visitArray2);
39339
39377
  if (hasJSDocNodes(child)) {
@@ -39351,6 +39389,7 @@ var IncrementalParser;
39351
39389
  if (array.pos > changeRangeOldEnd) {
39352
39390
  moveElementEntirelyPastChangeRange(
39353
39391
  array,
39392
+ sourceFile,
39354
39393
  /*isArray*/
39355
39394
  true,
39356
39395
  delta,
@@ -40051,7 +40090,6 @@ var commonOptionsWithBuild = [
40051
40090
  affectsBuildInfo: true,
40052
40091
  showInSimplifiedHelpView: true,
40053
40092
  category: Diagnostics.Emit,
40054
- transpileOptionValue: void 0,
40055
40093
  defaultValueDescription: false,
40056
40094
  description: Diagnostics.Create_sourcemaps_for_d_ts_files
40057
40095
  },
@@ -40377,6 +40415,7 @@ var commandOptionsWithoutBuild = [
40377
40415
  type: "boolean",
40378
40416
  affectsEmit: true,
40379
40417
  affectsBuildInfo: true,
40418
+ affectsSourceFile: true,
40380
40419
  category: Diagnostics.Emit,
40381
40420
  description: Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
40382
40421
  defaultValueDescription: false
@@ -40841,6 +40880,7 @@ var commandOptionsWithoutBuild = [
40841
40880
  affectsEmit: true,
40842
40881
  affectsBuildInfo: true,
40843
40882
  affectsModuleResolution: true,
40883
+ affectsSourceFile: true,
40844
40884
  category: Diagnostics.Language_and_Environment,
40845
40885
  description: Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
40846
40886
  defaultValueDescription: "react"
@@ -49888,7 +49928,8 @@ function createTypeChecker(host) {
49888
49928
  isUndefinedIdentifierExpression(node) {
49889
49929
  Debug.assert(isExpressionNode(node));
49890
49930
  return getSymbolAtLocation(node) === undefinedSymbol;
49891
- }
49931
+ },
49932
+ isDefinitelyReferenceToGlobalSymbolObject
49892
49933
  });
49893
49934
  var evaluate = createEvaluator({
49894
49935
  evaluateElementAccessExpression,
@@ -50718,6 +50759,7 @@ function createTypeChecker(host) {
50718
50759
  };
50719
50760
  var amalgamatedDuplicates;
50720
50761
  var reverseMappedCache = /* @__PURE__ */ new Map();
50762
+ var reverseHomomorphicMappedCache = /* @__PURE__ */ new Map();
50721
50763
  var ambientModulesCache;
50722
50764
  var patternAmbientModules;
50723
50765
  var patternAmbientModuleAugmentations;
@@ -50845,6 +50887,21 @@ function createTypeChecker(host) {
50845
50887
  ];
50846
50888
  initializeTypeChecker();
50847
50889
  return checker;
50890
+ function isDefinitelyReferenceToGlobalSymbolObject(node) {
50891
+ if (!isPropertyAccessExpression(node)) return false;
50892
+ if (!isIdentifier(node.name)) return false;
50893
+ if (!isPropertyAccessExpression(node.expression) && !isIdentifier(node.expression)) return false;
50894
+ if (isIdentifier(node.expression)) {
50895
+ return idText(node.expression) === "Symbol" && getResolvedSymbol(node.expression) === (getGlobalSymbol(
50896
+ "Symbol",
50897
+ 111551 /* Value */ | 1048576 /* ExportValue */,
50898
+ /*diagnostic*/
50899
+ void 0
50900
+ ) || unknownSymbol);
50901
+ }
50902
+ if (!isIdentifier(node.expression.expression)) return false;
50903
+ return idText(node.expression.name) === "Symbol" && idText(node.expression.expression) === "globalThis" && getResolvedSymbol(node.expression.expression) === globalThisSymbol;
50904
+ }
50848
50905
  function getCachedType(key) {
50849
50906
  return key ? cachedTypes.get(key) : void 0;
50850
50907
  }
@@ -52812,7 +52869,7 @@ function createTypeChecker(host) {
52812
52869
  }
52813
52870
  if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
52814
52871
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
52815
- const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
52872
+ const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l) || isJSDocImportTag(l));
52816
52873
  if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
52817
52874
  if (findAncestor(location, isImportEqualsDeclaration)) {
52818
52875
  error2(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
@@ -54057,11 +54114,11 @@ function createTypeChecker(host) {
54057
54114
  function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined) {
54058
54115
  const originalType = type;
54059
54116
  if (addUndefined) {
54060
- type = getOptionalType(type);
54117
+ type = getOptionalType(type, !isParameter(host2));
54061
54118
  }
54062
54119
  const clone2 = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
54063
54120
  if (clone2) {
54064
- if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
54121
+ if (addUndefined && containsNonMissingUndefinedType(type) && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
54065
54122
  return factory.createUnionTypeNode([clone2, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
54066
54123
  }
54067
54124
  return clone2;
@@ -54921,7 +54978,21 @@ function createTypeChecker(host) {
54921
54978
  }
54922
54979
  function shouldUsePlaceholderForProperty(propertySymbol, context) {
54923
54980
  var _a;
54924
- return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
54981
+ const depth = 3;
54982
+ return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */) || isDeeplyNestedReverseMappedTypeProperty());
54983
+ function isDeeplyNestedReverseMappedTypeProperty() {
54984
+ var _a2;
54985
+ if ((((_a2 = context.reverseMappedStack) == null ? void 0 : _a2.length) ?? 0) < depth) {
54986
+ return false;
54987
+ }
54988
+ for (let i = 0; i < depth; i++) {
54989
+ const prop = context.reverseMappedStack[context.reverseMappedStack.length - 1 - i];
54990
+ if (prop.links.mappedType.symbol !== propertySymbol.links.mappedType.symbol) {
54991
+ return false;
54992
+ }
54993
+ }
54994
+ return true;
54995
+ }
54925
54996
  }
54926
54997
  function addPropertyToElementList(propertySymbol, context, typeElements) {
54927
54998
  var _a;
@@ -56008,8 +56079,8 @@ function createTypeChecker(host) {
56008
56079
  return enclosingDeclaration;
56009
56080
  }
56010
56081
  function serializeTypeForDeclaration(context, declaration, type, symbol) {
56011
- var _a;
56012
- const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
56082
+ var _a, _b;
56083
+ const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
56013
56084
  const enclosingDeclaration = context.enclosingDeclaration;
56014
56085
  const oldFlags = context.flags;
56015
56086
  if (declaration && hasInferredType(declaration) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
@@ -56020,6 +56091,7 @@ function createTypeChecker(host) {
56020
56091
  const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
56021
56092
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
56022
56093
  const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
56094
+ const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
56023
56095
  const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
56024
56096
  if (result2) {
56025
56097
  context.flags = oldFlags;
@@ -56030,9 +56102,9 @@ function createTypeChecker(host) {
56030
56102
  if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
56031
56103
  context.flags |= 1048576 /* AllowUniqueESSymbolType */;
56032
56104
  }
56033
- const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
56105
+ const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
56034
56106
  const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
56035
- const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
56107
+ const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
56036
56108
  context.flags = oldFlags;
56037
56109
  return result;
56038
56110
  }
@@ -56067,9 +56139,9 @@ function createTypeChecker(host) {
56067
56139
  const typePredicate = getTypePredicateOfSignature(signature);
56068
56140
  const type = getReturnTypeOfSignature(signature);
56069
56141
  if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
56070
- const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
56071
- if (annotation && getTypeFromTypeNode2(context, annotation) === type) {
56072
- const result = tryReuseExistingTypeNodeHelper(context, annotation);
56142
+ const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
56143
+ if (annotation) {
56144
+ const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
56073
56145
  if (result) {
56074
56146
  return result;
56075
56147
  }
@@ -56563,7 +56635,10 @@ function createTypeChecker(host) {
56563
56635
  );
56564
56636
  }
56565
56637
  if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
56566
- if (!(context.flags & 1 /* AllowUnresolvedNames */ && hasDynamicName(node) && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
56638
+ if (!hasDynamicName(node)) {
56639
+ return visitEachChild2(node, visitExistingNodeTreeSymbols);
56640
+ }
56641
+ if (!(context.flags & 1 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
56567
56642
  return void 0;
56568
56643
  }
56569
56644
  }
@@ -56693,7 +56768,7 @@ function createTypeChecker(host) {
56693
56768
  if (result) {
56694
56769
  if (result.pos !== -1 || result.end !== -1) {
56695
56770
  if (result === nodes) {
56696
- result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
56771
+ result = factory.createNodeArray(nodes.slice(), nodes.hasTrailingComma);
56697
56772
  }
56698
56773
  setTextRangePosEnd(result, -1, -1);
56699
56774
  }
@@ -62650,7 +62725,7 @@ function createTypeChecker(host) {
62650
62725
  );
62651
62726
  }
62652
62727
  function createSignatureTypeMapper(signature, typeArguments) {
62653
- return createTypeMapper(signature.typeParameters, typeArguments);
62728
+ return createTypeMapper(sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp), typeArguments);
62654
62729
  }
62655
62730
  function getErasedSignature(signature) {
62656
62731
  return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
@@ -67293,6 +67368,10 @@ function createTypeChecker(host) {
67293
67368
  function containsUndefinedType(type) {
67294
67369
  return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
67295
67370
  }
67371
+ function containsNonMissingUndefinedType(type) {
67372
+ const candidate = type.flags & 1048576 /* Union */ ? type.types[0] : type;
67373
+ return !!(candidate.flags & 32768 /* Undefined */) && candidate !== missingType;
67374
+ }
67296
67375
  function isStringIndexSignatureOnlyType(type) {
67297
67376
  return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false;
67298
67377
  }
@@ -70941,11 +71020,11 @@ function createTypeChecker(host) {
70941
71020
  }
70942
71021
  function inferTypeForHomomorphicMappedType(source, target, constraint) {
70943
71022
  const cacheKey = source.id + "," + target.id + "," + constraint.id;
70944
- if (reverseMappedCache.has(cacheKey)) {
70945
- return reverseMappedCache.get(cacheKey);
71023
+ if (reverseHomomorphicMappedCache.has(cacheKey)) {
71024
+ return reverseHomomorphicMappedCache.get(cacheKey);
70946
71025
  }
70947
71026
  const type = createReverseMappedType(source, target, constraint);
70948
- reverseMappedCache.set(cacheKey, type);
71027
+ reverseHomomorphicMappedCache.set(cacheKey, type);
70949
71028
  return type;
70950
71029
  }
70951
71030
  function isPartiallyInferableType(type) {
@@ -74173,7 +74252,7 @@ function createTypeChecker(host) {
74173
74252
  if (!canCollectSymbolAliasAccessabilityData) {
74174
74253
  return;
74175
74254
  }
74176
- if (location.flags & 33554432 /* Ambient */) {
74255
+ if (location.flags & 33554432 /* Ambient */ && !isPropertySignature(location) && !isPropertyDeclaration(location)) {
74177
74256
  return;
74178
74257
  }
74179
74258
  switch (hint) {
@@ -77177,7 +77256,7 @@ function createTypeChecker(host) {
77177
77256
  checkGrammarJsxElement(node);
77178
77257
  }
77179
77258
  checkJsxPreconditions(node);
77180
- markLinkedReferences(node, 4 /* Jsx */);
77259
+ markJsxAliasReferenced(node);
77181
77260
  if (isNodeOpeningLikeElement) {
77182
77261
  const jsxOpeningLikeNode = node;
77183
77262
  const sig = getResolvedSignature(jsxOpeningLikeNode);
@@ -89913,15 +89992,14 @@ function createTypeChecker(host) {
89913
89992
  function checkChildIdentifiers(node2) {
89914
89993
  forEachNodeRecursively(node2, checkIdentifiers);
89915
89994
  }
89995
+ function isExpressionNodeOrShorthandPropertyAssignmentName(node2) {
89996
+ return isExpressionNode(node2) || isShorthandPropertyAssignment(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2;
89997
+ }
89916
89998
  function checkSingleIdentifier(node2) {
89917
89999
  const nodeLinks2 = getNodeLinks(node2);
89918
90000
  nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
89919
- if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
89920
- const s = getSymbolAtLocation(
89921
- node2,
89922
- /*ignoreErrors*/
89923
- true
89924
- );
90001
+ if (isIdentifier(node2) && isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
90002
+ const s = getResolvedSymbol(node2);
89925
90003
  if (s && s !== unknownSymbol) {
89926
90004
  checkIdentifierCalculateNodeCheckFlags(node2, s);
89927
90005
  }
@@ -90389,7 +90467,8 @@ function createTypeChecker(host) {
90389
90467
  resolveExternalModuleSymbol(sym);
90390
90468
  return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
90391
90469
  },
90392
- isImportRequiredByAugmentation
90470
+ isImportRequiredByAugmentation,
90471
+ isDefinitelyReferenceToGlobalSymbolObject
90393
90472
  };
90394
90473
  function isImportRequiredByAugmentation(node) {
90395
90474
  const file = getSourceFileOfNode(node);
@@ -115705,6 +115784,7 @@ function transformDeclarations(context) {
115705
115784
  }
115706
115785
  function reportInferenceFallback(node) {
115707
115786
  if (!isolatedDeclarations || isSourceFileJS(currentSourceFile)) return;
115787
+ if (getSourceFileOfNode(node) !== currentSourceFile) return;
115708
115788
  if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
115709
115789
  reportExpandoFunctionErrors(node);
115710
115790
  } else {
@@ -116343,15 +116423,17 @@ function transformDeclarations(context) {
116343
116423
  if (isDeclarationAndNotVisible(input)) return;
116344
116424
  if (hasDynamicName(input)) {
116345
116425
  if (isolatedDeclarations) {
116346
- if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
116347
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
116348
- return;
116349
- } else if (
116350
- // Type declarations just need to double-check that the input computed name is an entity name expression
116351
- (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
116352
- ) {
116353
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
116354
- return;
116426
+ if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
116427
+ if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
116428
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
116429
+ return;
116430
+ } else if (
116431
+ // Type declarations just need to double-check that the input computed name is an entity name expression
116432
+ (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
116433
+ ) {
116434
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
116435
+ return;
116436
+ }
116355
116437
  }
116356
116438
  } else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
116357
116439
  return;
@@ -118087,7 +118169,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118087
118169
  noEmitHelpers: true,
118088
118170
  module: compilerOptions.module,
118089
118171
  target: compilerOptions.target,
118090
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
118172
+ sourceMap: emitOnly !== 2 /* BuilderSignature */ && compilerOptions.declarationMap,
118091
118173
  inlineSourceMap: compilerOptions.inlineSourceMap,
118092
118174
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
118093
118175
  onlyPrintJsDocStyle: true,
@@ -118310,7 +118392,8 @@ var notImplementedResolver = {
118310
118392
  getJsxFragmentFactoryEntity: notImplemented,
118311
118393
  isBindingCapturedByNode: notImplemented,
118312
118394
  getDeclarationStatementsForSourceFile: notImplemented,
118313
- isImportRequiredByAugmentation: notImplemented
118395
+ isImportRequiredByAugmentation: notImplemented,
118396
+ isDefinitelyReferenceToGlobalSymbolObject: notImplemented
118314
118397
  };
118315
118398
  var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
118316
118399
  var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -123600,7 +123683,7 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
123600
123683
  }
123601
123684
  function getModeForUsageLocationWorker(file, usage, compilerOptions) {
123602
123685
  var _a;
123603
- if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
123686
+ if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent) || isJSDocImportTag(usage.parent)) {
123604
123687
  const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
123605
123688
  if (isTypeOnly) {
123606
123689
  const override = getResolutionModeOverride(usage.parent.attributes);
@@ -126383,7 +126466,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126383
126466
  if (options.outDir || // there is --outDir specified
126384
126467
  options.rootDir || // there is --rootDir specified
126385
126468
  options.sourceRoot || // there is --sourceRoot specified
126386
- options.mapRoot) {
126469
+ options.mapRoot || // there is --mapRoot specified
126470
+ getEmitDeclarations(options) && options.declarationDir) {
126387
126471
  const dir = getCommonSourceDirectory2();
126388
126472
  if (options.outDir && dir === "" && files.some((file) => getRootLength(file.fileName) > 1)) {
126389
126473
  createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
@@ -127482,8 +127566,7 @@ var BuilderState;
127482
127566
  );
127483
127567
  },
127484
127568
  cancellationToken,
127485
- /*emitOnly*/
127486
- true,
127569
+ 2 /* BuilderSignature */,
127487
127570
  /*customTransformers*/
127488
127571
  void 0,
127489
127572
  /*forceDtsEmit*/
@@ -134703,7 +134786,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
134703
134786
  expression,
134704
134787
  /*includeBigInt*/
134705
134788
  false
134706
- )) {
134789
+ ) && !resolver.isDefinitelyReferenceToGlobalSymbolObject(expression)) {
134707
134790
  context.tracker.reportInferenceFallback(prop.name);
134708
134791
  result = false;
134709
134792
  }
@@ -138675,6 +138758,7 @@ function isImportableSymbol(symbol, checker) {
138675
138758
  function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, preferCapitalizedNames, cb) {
138676
138759
  let chain;
138677
138760
  let current = defaultExport;
138761
+ const seen = /* @__PURE__ */ new Map();
138678
138762
  while (current) {
138679
138763
  const fromDeclaration = getDefaultLikeExportNameFromDeclaration(current);
138680
138764
  if (fromDeclaration) {
@@ -138686,6 +138770,7 @@ function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, pre
138686
138770
  if (final) return final;
138687
138771
  }
138688
138772
  chain = append(chain, current);
138773
+ if (!addToSeen(seen, current)) break;
138689
138774
  current = current.flags & 2097152 /* Alias */ ? checker.getImmediateAliasedSymbol(current) : void 0;
138690
138775
  }
138691
138776
  for (const symbol of chain ?? emptyArray) {
@@ -141124,7 +141209,7 @@ function getSourceMapper(host) {
141124
141209
  }
141125
141210
  const options = program.getCompilerOptions();
141126
141211
  const outPath = options.outFile;
141127
- const declarationPath = outPath ? removeFileExtension(outPath) + ".d.ts" /* Dts */ : getDeclarationEmitOutputFilePathWorker(info.fileName, program.getCompilerOptions(), currentDirectory, program.getCommonSourceDirectory(), getCanonicalFileName);
141212
+ const declarationPath = outPath ? removeFileExtension(outPath) + ".d.ts" /* Dts */ : getDeclarationEmitOutputFilePathWorker(info.fileName, program.getCompilerOptions(), program);
141128
141213
  if (declarationPath === void 0) return void 0;
141129
141214
  const newLoc = getDocumentPositionMapper2(declarationPath, info.fileName).getGeneratedPosition(info);
141130
141215
  return newLoc === info ? void 0 : newLoc;
@@ -147943,9 +148028,9 @@ var NodeObject = class {
147943
148028
  getChildAt(index, sourceFile) {
147944
148029
  return this.getChildren(sourceFile)[index];
147945
148030
  }
147946
- getChildren(sourceFile) {
148031
+ getChildren(sourceFile = getSourceFileOfNode(this)) {
147947
148032
  this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine");
147948
- return getNodeChildren(this) ?? setNodeChildren(this, createChildren(this, sourceFile));
148033
+ return getNodeChildren(this, sourceFile) ?? setNodeChildren(this, sourceFile, createChildren(this, sourceFile));
147949
148034
  }
147950
148035
  getFirstToken(sourceFile) {
147951
148036
  this.assertHasRealPosition();
@@ -148026,7 +148111,7 @@ function createSyntaxList(nodes, parent2) {
148026
148111
  pos = node.end;
148027
148112
  }
148028
148113
  addSyntheticNodes(children, pos, nodes.end, parent2);
148029
- setNodeChildren(list, children);
148114
+ list._children = children;
148030
148115
  return list;
148031
148116
  }
148032
148117
  var TokenOrIdentifierObject = class {
@@ -161234,6 +161319,14 @@ function tryGetAutoImportableReferenceFromTypeNode(importTypeNode, scriptTarget)
161234
161319
  function visit(node) {
161235
161320
  if (isLiteralImportTypeNode(node) && node.qualifier) {
161236
161321
  const firstIdentifier = getFirstIdentifier(node.qualifier);
161322
+ if (!firstIdentifier.symbol) {
161323
+ return visitEachChild(
161324
+ node,
161325
+ visit,
161326
+ /*context*/
161327
+ void 0
161328
+ );
161329
+ }
161237
161330
  const name = getNameForExportedSymbol(firstIdentifier.symbol, scriptTarget);
161238
161331
  const qualifier = name !== firstIdentifier.text ? replaceFirstIdentifierOfEntityName(node.qualifier, factory.createIdentifier(name)) : node.qualifier;
161239
161332
  symbols = append(symbols, firstIdentifier.symbol);
@@ -167625,7 +167718,7 @@ function getContainingModuleSymbol(importer, checker) {
167625
167718
  return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol);
167626
167719
  }
167627
167720
  function getSourceFileLikeForImportDeclaration(node) {
167628
- if (node.kind === 213 /* CallExpression */) {
167721
+ if (node.kind === 213 /* CallExpression */ || node.kind === 351 /* JSDocImportTag */) {
167629
167722
  return node.getSourceFile();
167630
167723
  }
167631
167724
  const { parent: parent2 } = node;
@@ -180368,6 +180461,7 @@ __export(ts_exports2, {
180368
180461
  trace: () => trace,
180369
180462
  tracing: () => tracing,
180370
180463
  tracingEnabled: () => tracingEnabled,
180464
+ transferSourceFileChildren: () => transferSourceFileChildren,
180371
180465
  transform: () => transform,
180372
180466
  transformClassFields: () => transformClassFields,
180373
180467
  transformDeclarations: () => transformDeclarations,
@@ -183190,7 +183284,7 @@ var Project3 = class _Project {
183190
183284
  this.generatedFilesMap.forEach((watcher, source) => {
183191
183285
  const sourceFile = this.program.getSourceFileByPath(source);
183192
183286
  if (!sourceFile || sourceFile.resolvedPath !== source || !this.isValidGeneratedFileWatcher(
183193
- getDeclarationEmitOutputFilePathWorker(sourceFile.fileName, this.compilerOptions, this.currentDirectory, this.program.getCommonSourceDirectory(), this.getCanonicalFileName),
183287
+ getDeclarationEmitOutputFilePathWorker(sourceFile.fileName, this.compilerOptions, this.program),
183194
183288
  watcher
183195
183289
  )) {
183196
183290
  closeFileWatcherOf(watcher);
@@ -194798,6 +194892,7 @@ if (typeof console !== "undefined") {
194798
194892
  trace,
194799
194893
  tracing,
194800
194894
  tracingEnabled,
194895
+ transferSourceFileChildren,
194801
194896
  transform,
194802
194897
  transformClassFields,
194803
194898
  transformDeclarations,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.5.2",
5
+ "version": "5.5.4",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -112,5 +112,5 @@
112
112
  "node": "20.1.0",
113
113
  "npm": "8.19.4"
114
114
  },
115
- "gitHead": "ce2e60e4ea15a65992e54a9e8877d16be9d42abb"
115
+ "gitHead": "c8a7d589e647e19c94150d9892909f3aa93e48eb"
116
116
  }