@typescript-deploys/pr-build 5.3.0-pr-56271-4 → 5.4.0-pr-56300-6

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/tsserver.js CHANGED
@@ -2327,8 +2327,8 @@ __export(server_exports, {
2327
2327
  module.exports = __toCommonJS(server_exports);
2328
2328
 
2329
2329
  // src/compiler/corePublic.ts
2330
- var versionMajorMinor = "5.3";
2331
- var version = `${versionMajorMinor}.0-insiders.20231101`;
2330
+ var versionMajorMinor = "5.4";
2331
+ var version = `${versionMajorMinor}.0-insiders.20231103`;
2332
2332
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2333
2333
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2334
2334
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -44693,6 +44693,9 @@ function createBinder() {
44693
44693
  case 213 /* CallExpression */:
44694
44694
  return hasNarrowableArgument(expr);
44695
44695
  case 217 /* ParenthesizedExpression */:
44696
+ if (isJSDocTypeAssertion(expr)) {
44697
+ return false;
44698
+ }
44696
44699
  case 235 /* NonNullExpression */:
44697
44700
  return isNarrowingExpression(expr.expression);
44698
44701
  case 226 /* BinaryExpression */:
@@ -62797,9 +62800,7 @@ function createTypeChecker(host) {
62797
62800
  if (checkType === wildcardType || extendsType === wildcardType) {
62798
62801
  return wildcardType;
62799
62802
  }
62800
- const checkTypeNode = skipTypeParentheses(root.node.checkType);
62801
- const extendsTypeNode = skipTypeParentheses(root.node.extendsType);
62802
- const checkTuples = isSimpleTupleType(checkTypeNode) && isSimpleTupleType(extendsTypeNode) && length(checkTypeNode.elements) === length(extendsTypeNode.elements);
62803
+ const checkTuples = isSimpleTupleType(root.node.checkType) && isSimpleTupleType(root.node.extendsType) && length(root.node.checkType.elements) === length(root.node.extendsType.elements);
62803
62804
  const checkTypeDeferred = isDeferredType(checkType, checkTuples);
62804
62805
  let combinedMapper;
62805
62806
  if (root.inferTypeParameters) {
@@ -68443,7 +68444,7 @@ function createTypeChecker(host) {
68443
68444
  const templateType = getTemplateTypeFromMappedType(target);
68444
68445
  const inference = createInferenceInfo(typeParameter);
68445
68446
  inferTypes([inference], sourceType, templateType);
68446
- return getTypeFromInference(inference) || unknownType;
68447
+ return getTypeFromInference(inference) || getBaseConstraintOfType(typeParameter) || unknownType;
68447
68448
  }
68448
68449
  function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
68449
68450
  const properties = getPropertiesOfType(target);
@@ -114636,27 +114637,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
114636
114637
  (_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Emit, "emitBuildInfo", { buildInfoPath });
114637
114638
  emitBuildInfo(bundleBuildInfo, buildInfoPath);
114638
114639
  (_f = tracing) == null ? void 0 : _f.pop();
114639
- if (!emitSkipped && emittedFilesList) {
114640
- if (!emitOnly) {
114641
- if (jsFilePath) {
114642
- emittedFilesList.push(jsFilePath);
114643
- }
114644
- if (sourceMapFilePath) {
114645
- emittedFilesList.push(sourceMapFilePath);
114646
- }
114647
- if (buildInfoPath) {
114648
- emittedFilesList.push(buildInfoPath);
114649
- }
114650
- }
114651
- if (emitOnly !== 0 /* Js */) {
114652
- if (declarationFilePath) {
114653
- emittedFilesList.push(declarationFilePath);
114654
- }
114655
- if (declarationMapPath) {
114656
- emittedFilesList.push(declarationMapPath);
114657
- }
114658
- }
114659
- }
114660
114640
  function relativeToBuildInfo(path) {
114661
114641
  return ensurePathIsNonModuleName(getRelativePathFromDirectory(buildInfoDirectory, path, host.getCanonicalFileName));
114662
114642
  }
@@ -114684,6 +114664,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
114684
114664
  void 0,
114685
114665
  { buildInfo }
114686
114666
  );
114667
+ emittedFilesList == null ? void 0 : emittedFilesList.push(buildInfoPath);
114687
114668
  }
114688
114669
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
114689
114670
  if (!sourceFileOrBundle || emitOnly || !jsFilePath) {
@@ -114729,6 +114710,12 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
114729
114710
  transform2.dispose();
114730
114711
  if (bundleBuildInfo)
114731
114712
  bundleBuildInfo.js = printer.bundleFileInfo;
114713
+ if (emittedFilesList) {
114714
+ emittedFilesList.push(jsFilePath);
114715
+ if (sourceMapFilePath) {
114716
+ emittedFilesList.push(sourceMapFilePath);
114717
+ }
114718
+ }
114732
114719
  }
114733
114720
  function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) {
114734
114721
  if (!sourceFileOrBundle || emitOnly === 0 /* Js */)
@@ -114759,33 +114746,33 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
114759
114746
  emitterDiagnostics.add(diagnostic);
114760
114747
  }
114761
114748
  }
114762
- const printerOptions = {
114763
- removeComments: compilerOptions.removeComments,
114764
- newLine: compilerOptions.newLine,
114765
- noEmitHelpers: true,
114766
- module: compilerOptions.module,
114767
- target: compilerOptions.target,
114768
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
114769
- inlineSourceMap: compilerOptions.inlineSourceMap,
114770
- extendedDiagnostics: compilerOptions.extendedDiagnostics,
114771
- onlyPrintJsDocStyle: true,
114772
- omitBraceSourceMapPositions: true,
114773
- writeBundleFileInfo: !!bundleBuildInfo,
114774
- recordInternalSection: !!bundleBuildInfo,
114775
- relativeToBuildInfo
114776
- };
114777
- const declarationPrinter = createPrinter(printerOptions, {
114778
- // resolver hooks
114779
- hasGlobalName: resolver.hasGlobalName,
114780
- // transform hooks
114781
- onEmitNode: declarationTransform.emitNodeWithNotification,
114782
- isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
114783
- substituteNode: declarationTransform.substituteNode
114784
- });
114785
114749
  const declBlocked = !!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
114786
114750
  emitSkipped = emitSkipped || declBlocked;
114787
114751
  if (!declBlocked || forceDtsEmit) {
114788
114752
  Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
114753
+ const printerOptions = {
114754
+ removeComments: compilerOptions.removeComments,
114755
+ newLine: compilerOptions.newLine,
114756
+ noEmitHelpers: true,
114757
+ module: compilerOptions.module,
114758
+ target: compilerOptions.target,
114759
+ sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
114760
+ inlineSourceMap: compilerOptions.inlineSourceMap,
114761
+ extendedDiagnostics: compilerOptions.extendedDiagnostics,
114762
+ onlyPrintJsDocStyle: true,
114763
+ omitBraceSourceMapPositions: true,
114764
+ writeBundleFileInfo: !!bundleBuildInfo,
114765
+ recordInternalSection: !!bundleBuildInfo,
114766
+ relativeToBuildInfo
114767
+ };
114768
+ const declarationPrinter = createPrinter(printerOptions, {
114769
+ // resolver hooks
114770
+ hasGlobalName: resolver.hasGlobalName,
114771
+ // transform hooks
114772
+ onEmitNode: declarationTransform.emitNodeWithNotification,
114773
+ isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
114774
+ substituteNode: declarationTransform.substituteNode
114775
+ });
114789
114776
  printSourceFileOrBundle(
114790
114777
  declarationFilePath,
114791
114778
  declarationMapPath,
@@ -114799,10 +114786,16 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
114799
114786
  // Explicitly do not passthru either `inline` option
114800
114787
  }
114801
114788
  );
114789
+ if (emittedFilesList) {
114790
+ emittedFilesList.push(declarationFilePath);
114791
+ if (declarationMapPath) {
114792
+ emittedFilesList.push(declarationMapPath);
114793
+ }
114794
+ }
114795
+ if (bundleBuildInfo)
114796
+ bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
114802
114797
  }
114803
114798
  declarationTransform.dispose();
114804
- if (bundleBuildInfo)
114805
- bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
114806
114799
  }
114807
114800
  function collectLinkedAliases(node) {
114808
114801
  if (isExportAssignment(node)) {
@@ -124926,6 +124919,7 @@ function createBuilderProgramState(newProgram, oldState) {
124926
124919
  const copyDeclarationFileDiagnostics = canCopySemanticDiagnostics && !compilerOptions.skipLibCheck === !oldCompilerOptions.skipLibCheck;
124927
124920
  const copyLibFileDiagnostics = copyDeclarationFileDiagnostics && !compilerOptions.skipDefaultLibCheck === !oldCompilerOptions.skipDefaultLibCheck;
124928
124921
  state.fileInfos.forEach((info, sourceFilePath) => {
124922
+ var _a2;
124929
124923
  let oldInfo;
124930
124924
  let newReferences;
124931
124925
  if (!useOldState || // File wasn't present in old state
@@ -124935,22 +124929,28 @@ function createBuilderProgramState(newProgram, oldState) {
124935
124929
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
124936
124930
  newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
124937
124931
  addFileToChangeSet(state, sourceFilePath);
124938
- } else if (canCopySemanticDiagnostics) {
124932
+ } else {
124939
124933
  const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
124940
- if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
124941
- return;
124942
- if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
124943
- return;
124944
- const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
124945
- if (diagnostics) {
124946
- state.semanticDiagnosticsPerFile.set(
124934
+ const emitDiagnostics = (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath);
124935
+ if (emitDiagnostics) {
124936
+ (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
124947
124937
  sourceFilePath,
124948
- oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
124938
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
124949
124939
  );
124950
- if (!state.semanticDiagnosticsFromOldState) {
124951
- state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set();
124940
+ }
124941
+ if (canCopySemanticDiagnostics) {
124942
+ if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
124943
+ return;
124944
+ if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
124945
+ return;
124946
+ const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
124947
+ if (diagnostics) {
124948
+ state.semanticDiagnosticsPerFile.set(
124949
+ sourceFilePath,
124950
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
124951
+ );
124952
+ (state.semanticDiagnosticsFromOldState ?? (state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set())).add(sourceFilePath);
124952
124953
  }
124953
- state.semanticDiagnosticsFromOldState.add(sourceFilePath);
124954
124954
  }
124955
124955
  }
124956
124956
  if (canCopyEmitSignatures) {
@@ -125087,7 +125087,9 @@ function backupBuilderProgramEmitState(state) {
125087
125087
  outSignature: state.outSignature,
125088
125088
  latestChangedDtsFile: state.latestChangedDtsFile,
125089
125089
  hasChangedEmitSignature: state.hasChangedEmitSignature,
125090
- changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0
125090
+ changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0,
125091
+ buildInfoEmitPending: state.buildInfoEmitPending,
125092
+ emitDiagnosticsPerFile: state.emitDiagnosticsPerFile && new Map(state.emitDiagnosticsPerFile)
125091
125093
  };
125092
125094
  }
125093
125095
  function restoreBuilderProgramEmitState(state, savedEmitState) {
@@ -125098,6 +125100,8 @@ function restoreBuilderProgramEmitState(state, savedEmitState) {
125098
125100
  state.outSignature = savedEmitState.outSignature;
125099
125101
  state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
125100
125102
  state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
125103
+ state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
125104
+ state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
125101
125105
  if (savedEmitState.changedFilesSet)
125102
125106
  state.changedFilesSet = savedEmitState.changedFilesSet;
125103
125107
  }
@@ -125188,6 +125192,22 @@ function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
125188
125192
  return { affectedFile, emitKind: pendingKind };
125189
125193
  });
125190
125194
  }
125195
+ function getNextPendingEmitDiagnosticsFile(state) {
125196
+ var _a;
125197
+ if (!((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size))
125198
+ return void 0;
125199
+ return forEachEntry(state.emitDiagnosticsPerFile, (diagnostics, path) => {
125200
+ var _a2;
125201
+ const affectedFile = state.program.getSourceFileByPath(path);
125202
+ if (!affectedFile || !sourceFileMayBeEmitted(affectedFile, state.program)) {
125203
+ state.emitDiagnosticsPerFile.delete(path);
125204
+ return void 0;
125205
+ }
125206
+ const seenKind = ((_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath)) || 0 /* None */;
125207
+ if (!(seenKind & 24 /* AllDts */))
125208
+ return { affectedFile, diagnostics, seenKind };
125209
+ });
125210
+ }
125191
125211
  function removeDiagnosticsOfLibraryFiles(state) {
125192
125212
  if (!state.cleanedDiagnosticsOfLibFiles) {
125193
125213
  state.cleanedDiagnosticsOfLibFiles = true;
@@ -125464,18 +125484,7 @@ function getBuildInfo2(state, bundle) {
125464
125484
  return void 0;
125465
125485
  });
125466
125486
  }
125467
- let semanticDiagnosticsPerFile;
125468
- if (state.semanticDiagnosticsPerFile) {
125469
- for (const key of arrayFrom(state.semanticDiagnosticsPerFile.keys()).sort(compareStringsCaseSensitive)) {
125470
- const value = state.semanticDiagnosticsPerFile.get(key);
125471
- (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(
125472
- value.length ? [
125473
- toFileId(key),
125474
- convertToReusableDiagnostics(value, relativeToBuildInfo)
125475
- ] : toFileId(key)
125476
- );
125477
- }
125478
- }
125487
+ const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.semanticDiagnosticsPerFile);
125479
125488
  let affectedFilesPendingEmit;
125480
125489
  if ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.size) {
125481
125490
  const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
@@ -125505,6 +125514,7 @@ function getBuildInfo2(state, bundle) {
125505
125514
  (changeFileSet || (changeFileSet = [])).push(toFileId(path));
125506
125515
  }
125507
125516
  }
125517
+ const emitDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.emitDiagnosticsPerFile);
125508
125518
  const program = {
125509
125519
  fileNames,
125510
125520
  fileInfos,
@@ -125514,6 +125524,7 @@ function getBuildInfo2(state, bundle) {
125514
125524
  referencedMap,
125515
125525
  exportedModulesMap,
125516
125526
  semanticDiagnosticsPerFile,
125527
+ emitDiagnosticsPerFile,
125517
125528
  affectedFilesPendingEmit,
125518
125529
  changeFileSet,
125519
125530
  emitSignatures,
@@ -125570,73 +125581,87 @@ function getBuildInfo2(state, bundle) {
125570
125581
  if (optionInfo == null ? void 0 : optionInfo.affectsBuildInfo) {
125571
125582
  (result || (result = {}))[name] = convertToReusableCompilerOptionValue(
125572
125583
  optionInfo,
125573
- options[name],
125574
- relativeToBuildInfoEnsuringAbsolutePath
125584
+ options[name]
125575
125585
  );
125576
125586
  }
125577
125587
  }
125578
125588
  return result;
125579
125589
  }
125580
- }
125581
- function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
125582
- if (option) {
125583
- Debug.assert(option.type !== "listOrElement");
125584
- if (option.type === "list") {
125585
- const values = value;
125586
- if (option.element.isFilePath && values.length) {
125587
- return values.map(relativeToBuildInfo);
125590
+ function convertToReusableCompilerOptionValue(option, value) {
125591
+ if (option) {
125592
+ Debug.assert(option.type !== "listOrElement");
125593
+ if (option.type === "list") {
125594
+ const values = value;
125595
+ if (option.element.isFilePath && values.length) {
125596
+ return values.map(relativeToBuildInfoEnsuringAbsolutePath);
125597
+ }
125598
+ } else if (option.isFilePath) {
125599
+ return relativeToBuildInfoEnsuringAbsolutePath(value);
125588
125600
  }
125589
- } else if (option.isFilePath) {
125590
- return relativeToBuildInfo(value);
125591
125601
  }
125602
+ return value;
125592
125603
  }
125593
- return value;
125594
- }
125595
- function convertToReusableDiagnostics(diagnostics, relativeToBuildInfo) {
125596
- Debug.assert(!!diagnostics.length);
125597
- return diagnostics.map((diagnostic) => {
125598
- const result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
125599
- result.reportsUnnecessary = diagnostic.reportsUnnecessary;
125600
- result.reportDeprecated = diagnostic.reportsDeprecated;
125601
- result.source = diagnostic.source;
125602
- result.skippedOn = diagnostic.skippedOn;
125603
- const { relatedInformation } = diagnostic;
125604
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo)) : [] : void 0;
125604
+ function convertToProgramBuildInfoDiagnostics(diagnostics) {
125605
+ let result;
125606
+ if (diagnostics) {
125607
+ for (const key of arrayFrom(diagnostics.keys()).sort(compareStringsCaseSensitive)) {
125608
+ const value = diagnostics.get(key);
125609
+ (result || (result = [])).push(
125610
+ value.length ? [
125611
+ toFileId(key),
125612
+ convertToReusableDiagnostics(value)
125613
+ ] : toFileId(key)
125614
+ );
125615
+ }
125616
+ }
125605
125617
  return result;
125606
- });
125607
- }
125608
- function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo) {
125609
- const { file } = diagnostic;
125610
- return {
125611
- ...diagnostic,
125612
- file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
125613
- messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
125614
- };
125615
- }
125616
- function convertToReusableDiagnosticMessageChain(chain) {
125617
- if (chain.repopulateInfo) {
125618
+ }
125619
+ function convertToReusableDiagnostics(diagnostics) {
125620
+ Debug.assert(!!diagnostics.length);
125621
+ return diagnostics.map((diagnostic) => {
125622
+ const result = convertToReusableDiagnosticRelatedInformation(diagnostic);
125623
+ result.reportsUnnecessary = diagnostic.reportsUnnecessary;
125624
+ result.reportDeprecated = diagnostic.reportsDeprecated;
125625
+ result.source = diagnostic.source;
125626
+ result.skippedOn = diagnostic.skippedOn;
125627
+ const { relatedInformation } = diagnostic;
125628
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r)) : [] : void 0;
125629
+ return result;
125630
+ });
125631
+ }
125632
+ function convertToReusableDiagnosticRelatedInformation(diagnostic) {
125633
+ const { file } = diagnostic;
125618
125634
  return {
125619
- info: chain.repopulateInfo(),
125620
- next: convertToReusableDiagnosticMessageChainArray(chain.next)
125635
+ ...diagnostic,
125636
+ file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
125637
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
125621
125638
  };
125622
125639
  }
125623
- const next = convertToReusableDiagnosticMessageChainArray(chain.next);
125624
- return next === chain.next ? chain : { ...chain, next };
125625
- }
125626
- function convertToReusableDiagnosticMessageChainArray(array) {
125627
- if (!array)
125628
- return array;
125629
- return forEach(array, (chain, index) => {
125630
- const reusable = convertToReusableDiagnosticMessageChain(chain);
125631
- if (chain === reusable)
125632
- return void 0;
125633
- const result = index > 0 ? array.slice(0, index - 1) : [];
125634
- result.push(reusable);
125635
- for (let i = index + 1; i < array.length; i++) {
125636
- result.push(convertToReusableDiagnosticMessageChain(array[i]));
125640
+ function convertToReusableDiagnosticMessageChain(chain) {
125641
+ if (chain.repopulateInfo) {
125642
+ return {
125643
+ info: chain.repopulateInfo(),
125644
+ next: convertToReusableDiagnosticMessageChainArray(chain.next)
125645
+ };
125637
125646
  }
125638
- return result;
125639
- }) || array;
125647
+ const next = convertToReusableDiagnosticMessageChainArray(chain.next);
125648
+ return next === chain.next ? chain : { ...chain, next };
125649
+ }
125650
+ function convertToReusableDiagnosticMessageChainArray(array) {
125651
+ if (!array)
125652
+ return array;
125653
+ return forEach(array, (chain, index) => {
125654
+ const reusable = convertToReusableDiagnosticMessageChain(chain);
125655
+ if (chain === reusable)
125656
+ return void 0;
125657
+ const result = index > 0 ? array.slice(0, index - 1) : [];
125658
+ result.push(reusable);
125659
+ for (let i = index + 1; i < array.length; i++) {
125660
+ result.push(convertToReusableDiagnosticMessageChain(array[i]));
125661
+ }
125662
+ return result;
125663
+ }) || array;
125664
+ }
125640
125665
  }
125641
125666
  var BuilderProgramKind = /* @__PURE__ */ ((BuilderProgramKind2) => {
125642
125667
  BuilderProgramKind2[BuilderProgramKind2["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram";
@@ -125750,6 +125775,14 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
125750
125775
  if (!outFile(state.compilerOptions)) {
125751
125776
  const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
125752
125777
  if (!pendingAffectedFile) {
125778
+ const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
125779
+ if (pendingForDiagnostics) {
125780
+ (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
125781
+ return {
125782
+ result: { emitSkipped: true, diagnostics: pendingForDiagnostics.diagnostics },
125783
+ affected: pendingForDiagnostics.affectedFile
125784
+ };
125785
+ }
125753
125786
  if (!state.buildInfoEmitPending)
125754
125787
  return void 0;
125755
125788
  const affected2 = state.program;
@@ -125798,6 +125831,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
125798
125831
  (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
125799
125832
  else
125800
125833
  (_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.delete(affectedSourceFile.resolvedPath);
125834
+ if (result.diagnostics.length)
125835
+ (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, result.diagnostics);
125801
125836
  } else {
125802
125837
  state.changedFilesSet.clear();
125803
125838
  }
@@ -125970,9 +126005,10 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
125970
126005
  }
125971
126006
  }
125972
126007
  function addToAffectedFilesPendingEmit(state, affectedFilePendingEmit, kind) {
125973
- var _a;
126008
+ var _a, _b;
125974
126009
  const existingKind = ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.get(affectedFilePendingEmit)) || 0 /* None */;
125975
126010
  (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedFilePendingEmit, existingKind | kind);
126011
+ (_b = state.emitDiagnosticsPerFile) == null ? void 0 : _b.delete(affectedFilePendingEmit);
125976
126012
  }
125977
126013
  function toBuilderStateFileInfoForMultiEmit(fileInfo) {
125978
126014
  return isString(fileInfo) ? { version: fileInfo, signature: fileInfo, affectsGlobalScope: void 0, impliedFormat: void 0 } : isString(fileInfo.signature) ? fileInfo : { version: fileInfo.version, signature: fileInfo.signature === false ? void 0 : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
@@ -126037,7 +126073,8 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
126037
126073
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
126038
126074
  referencedMap: toManyToManyPathMap(program.referencedMap),
126039
126075
  exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
126040
- semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && arrayToMap(program.semanticDiagnosticsPerFile, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]),
126076
+ semanticDiagnosticsPerFile: toPerFileDiagnostics(program.semanticDiagnosticsPerFile),
126077
+ emitDiagnosticsPerFile: toPerFileDiagnostics(program.emitDiagnosticsPerFile),
126041
126078
  hasReusableDiagnostic: true,
126042
126079
  affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
126043
126080
  changedFilesSet: new Set(map(program.changeFileSet, toFilePath)),
@@ -126090,6 +126127,9 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
126090
126127
  referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
126091
126128
  return map2;
126092
126129
  }
126130
+ function toPerFileDiagnostics(diagnostics) {
126131
+ return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]);
126132
+ }
126093
126133
  }
126094
126134
  function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
126095
126135
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
@@ -129736,7 +129776,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
129736
129776
  }
129737
129777
  }
129738
129778
  function getUpToDateStatusWorker(state, project, resolvedPath) {
129739
- var _a, _b;
129779
+ var _a, _b, _c;
129740
129780
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
129741
129781
  return {
129742
129782
  type: 16 /* ContainerOnly */
@@ -129810,7 +129850,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
129810
129850
  };
129811
129851
  }
129812
129852
  if (buildInfo.program) {
129813
- if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? (_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length : some(buildInfo.program.semanticDiagnosticsPerFile, isArray))) {
129853
+ 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) : some(buildInfo.program.semanticDiagnosticsPerFile, isArray))) {
129814
129854
  return {
129815
129855
  type: 8 /* OutOfDateBuildInfo */,
129816
129856
  buildInfoFile: buildInfoPath
@@ -165122,6 +165162,7 @@ function provideInlayHints(context) {
165122
165162
  visitForDisplayParts(typeNode);
165123
165163
  return parts;
165124
165164
  function visitForDisplayParts(node) {
165165
+ var _a, _b;
165125
165166
  if (!node) {
165126
165167
  return;
165127
165168
  }
@@ -165136,9 +165177,9 @@ function provideInlayHints(context) {
165136
165177
  }
165137
165178
  switch (node.kind) {
165138
165179
  case 80 /* Identifier */:
165139
- const identifier = node;
165140
- const identifierText = idText(identifier);
165141
- const name = identifier.symbol && identifier.symbol.declarations && identifier.symbol.declarations.length && getNameOfDeclaration(identifier.symbol.declarations[0]);
165180
+ Debug.assertNode(node, isIdentifier);
165181
+ const identifierText = idText(node);
165182
+ const name = node.symbol && node.symbol.declarations && node.symbol.declarations.length && getNameOfDeclaration(node.symbol.declarations[0]);
165142
165183
  if (name) {
165143
165184
  parts.push(getNodeDisplayPart(identifierText, name));
165144
165185
  } else {
@@ -165146,252 +165187,307 @@ function provideInlayHints(context) {
165146
165187
  }
165147
165188
  break;
165148
165189
  case 166 /* QualifiedName */:
165149
- const qualifiedName = node;
165150
- visitForDisplayParts(qualifiedName.left);
165190
+ Debug.assertNode(node, isQualifiedName);
165191
+ visitForDisplayParts(node.left);
165151
165192
  parts.push({ text: "." });
165152
- visitForDisplayParts(qualifiedName.right);
165193
+ visitForDisplayParts(node.right);
165153
165194
  break;
165154
165195
  case 182 /* TypePredicate */:
165155
- const predicate = node;
165156
- if (predicate.assertsModifier) {
165196
+ Debug.assertNode(node, isTypePredicateNode);
165197
+ if (node.assertsModifier) {
165157
165198
  parts.push({ text: "asserts " });
165158
165199
  }
165159
- visitForDisplayParts(predicate.parameterName);
165160
- if (predicate.type) {
165200
+ visitForDisplayParts(node.parameterName);
165201
+ if (node.type) {
165161
165202
  parts.push({ text: " is " });
165162
- visitForDisplayParts(predicate.type);
165203
+ visitForDisplayParts(node.type);
165163
165204
  }
165164
165205
  break;
165165
165206
  case 183 /* TypeReference */:
165166
- const typeReference = node;
165167
- visitForDisplayParts(typeReference.typeName);
165168
- if (typeReference.typeArguments) {
165207
+ Debug.assertNode(node, isTypeReferenceNode);
165208
+ visitForDisplayParts(node.typeName);
165209
+ if (node.typeArguments) {
165169
165210
  parts.push({ text: "<" });
165170
- visitDisplayPartList(typeReference.typeArguments, ", ");
165211
+ visitDisplayPartList(node.typeArguments, ", ");
165171
165212
  parts.push({ text: ">" });
165172
165213
  }
165173
165214
  break;
165174
165215
  case 168 /* TypeParameter */:
165175
- const typeParameter = node;
165176
- if (typeParameter.modifiers) {
165177
- visitDisplayPartList(typeParameter.modifiers, " ");
165216
+ Debug.assertNode(node, isTypeParameterDeclaration);
165217
+ if (node.modifiers) {
165218
+ visitDisplayPartList(node.modifiers, " ");
165178
165219
  }
165179
- visitForDisplayParts(typeParameter.name);
165180
- if (typeParameter.constraint) {
165220
+ visitForDisplayParts(node.name);
165221
+ if (node.constraint) {
165181
165222
  parts.push({ text: " extends " });
165182
- visitForDisplayParts(typeParameter.constraint);
165223
+ visitForDisplayParts(node.constraint);
165183
165224
  }
165184
- if (typeParameter.default) {
165225
+ if (node.default) {
165185
165226
  parts.push({ text: " = " });
165186
- visitForDisplayParts(typeParameter.default);
165227
+ visitForDisplayParts(node.default);
165187
165228
  }
165188
165229
  break;
165189
165230
  case 169 /* Parameter */:
165190
- const parameter = node;
165191
- if (parameter.modifiers) {
165192
- visitDisplayPartList(parameter.modifiers, " ");
165231
+ Debug.assertNode(node, isParameter);
165232
+ if (node.modifiers) {
165233
+ visitDisplayPartList(node.modifiers, " ");
165193
165234
  }
165194
- if (parameter.dotDotDotToken) {
165235
+ if (node.dotDotDotToken) {
165195
165236
  parts.push({ text: "..." });
165196
165237
  }
165197
- visitForDisplayParts(parameter.name);
165198
- if (parameter.questionToken) {
165238
+ visitForDisplayParts(node.name);
165239
+ if (node.questionToken) {
165199
165240
  parts.push({ text: "?" });
165200
165241
  }
165201
- if (parameter.type) {
165242
+ if (node.type) {
165202
165243
  parts.push({ text: ": " });
165203
- visitForDisplayParts(parameter.type);
165244
+ visitForDisplayParts(node.type);
165204
165245
  }
165205
165246
  break;
165206
165247
  case 185 /* ConstructorType */:
165207
- const constructorType = node;
165248
+ Debug.assertNode(node, isConstructorTypeNode);
165208
165249
  parts.push({ text: "new " });
165209
- if (constructorType.typeParameters) {
165210
- parts.push({ text: "<" });
165211
- visitDisplayPartList(constructorType.typeParameters, ", ");
165212
- parts.push({ text: ">" });
165213
- }
165214
- parts.push({ text: "(" });
165215
- visitDisplayPartList(constructorType.parameters, ", ");
165216
- parts.push({ text: ")" });
165250
+ visitParametersAndTypeParameters(node);
165217
165251
  parts.push({ text: " => " });
165218
- visitForDisplayParts(constructorType.type);
165252
+ visitForDisplayParts(node.type);
165219
165253
  break;
165220
165254
  case 186 /* TypeQuery */:
165221
- const typeQuery = node;
165255
+ Debug.assertNode(node, isTypeQueryNode);
165222
165256
  parts.push({ text: "typeof " });
165223
- visitForDisplayParts(typeQuery.exprName);
165224
- if (typeQuery.typeArguments) {
165257
+ visitForDisplayParts(node.exprName);
165258
+ if (node.typeArguments) {
165225
165259
  parts.push({ text: "<" });
165226
- visitDisplayPartList(typeQuery.typeArguments, ", ");
165260
+ visitDisplayPartList(node.typeArguments, ", ");
165227
165261
  parts.push({ text: ">" });
165228
165262
  }
165229
165263
  break;
165230
165264
  case 187 /* TypeLiteral */:
165231
- const typeLiteral = node;
165265
+ Debug.assertNode(node, isTypeLiteralNode);
165232
165266
  parts.push({ text: "{" });
165233
- if (typeLiteral.members.length) {
165267
+ if (node.members.length) {
165234
165268
  parts.push({ text: " " });
165235
- visitDisplayPartList(typeLiteral.members, "; ");
165269
+ visitDisplayPartList(node.members, "; ");
165236
165270
  parts.push({ text: " " });
165237
165271
  }
165238
165272
  parts.push({ text: "}" });
165239
165273
  break;
165240
165274
  case 188 /* ArrayType */:
165275
+ Debug.assertNode(node, isArrayTypeNode);
165241
165276
  visitForDisplayParts(node.elementType);
165242
165277
  parts.push({ text: "[]" });
165243
165278
  break;
165244
165279
  case 189 /* TupleType */:
165280
+ Debug.assertNode(node, isTupleTypeNode);
165245
165281
  parts.push({ text: "[" });
165246
165282
  visitDisplayPartList(node.elements, ", ");
165247
165283
  parts.push({ text: "]" });
165248
165284
  break;
165249
165285
  case 202 /* NamedTupleMember */:
165250
- const member = node;
165251
- if (member.dotDotDotToken) {
165286
+ Debug.assertNode(node, isNamedTupleMember);
165287
+ if (node.dotDotDotToken) {
165252
165288
  parts.push({ text: "..." });
165253
165289
  }
165254
- visitForDisplayParts(member.name);
165255
- if (member.questionToken) {
165290
+ visitForDisplayParts(node.name);
165291
+ if (node.questionToken) {
165256
165292
  parts.push({ text: "?" });
165257
165293
  }
165258
165294
  parts.push({ text: ": " });
165259
- visitForDisplayParts(member.type);
165295
+ visitForDisplayParts(node.type);
165260
165296
  break;
165261
165297
  case 190 /* OptionalType */:
165298
+ Debug.assertNode(node, isOptionalTypeNode);
165262
165299
  visitForDisplayParts(node.type);
165263
165300
  parts.push({ text: "?" });
165264
165301
  break;
165265
165302
  case 191 /* RestType */:
165303
+ Debug.assertNode(node, isRestTypeNode);
165266
165304
  parts.push({ text: "..." });
165267
165305
  visitForDisplayParts(node.type);
165268
165306
  break;
165269
165307
  case 192 /* UnionType */:
165308
+ Debug.assertNode(node, isUnionTypeNode);
165270
165309
  visitDisplayPartList(node.types, " | ");
165271
165310
  break;
165272
165311
  case 193 /* IntersectionType */:
165312
+ Debug.assertNode(node, isIntersectionTypeNode);
165273
165313
  visitDisplayPartList(node.types, " & ");
165274
165314
  break;
165275
165315
  case 194 /* ConditionalType */:
165276
- const conditionalType = node;
165277
- visitForDisplayParts(conditionalType.checkType);
165316
+ Debug.assertNode(node, isConditionalTypeNode);
165317
+ visitForDisplayParts(node.checkType);
165278
165318
  parts.push({ text: " extends " });
165279
- visitForDisplayParts(conditionalType.extendsType);
165319
+ visitForDisplayParts(node.extendsType);
165280
165320
  parts.push({ text: " ? " });
165281
- visitForDisplayParts(conditionalType.trueType);
165321
+ visitForDisplayParts(node.trueType);
165282
165322
  parts.push({ text: " : " });
165283
- visitForDisplayParts(conditionalType.falseType);
165323
+ visitForDisplayParts(node.falseType);
165284
165324
  break;
165285
165325
  case 195 /* InferType */:
165326
+ Debug.assertNode(node, isInferTypeNode);
165286
165327
  parts.push({ text: "infer " });
165287
165328
  visitForDisplayParts(node.typeParameter);
165288
165329
  break;
165289
165330
  case 196 /* ParenthesizedType */:
165331
+ Debug.assertNode(node, isParenthesizedTypeNode);
165290
165332
  parts.push({ text: "(" });
165291
165333
  visitForDisplayParts(node.type);
165292
165334
  parts.push({ text: ")" });
165293
165335
  break;
165294
165336
  case 198 /* TypeOperator */:
165295
- const typeOperator = node;
165296
- parts.push({ text: `${tokenToString(typeOperator.operator)} ` });
165297
- visitForDisplayParts(typeOperator.type);
165337
+ Debug.assertNode(node, isTypeOperatorNode);
165338
+ parts.push({ text: `${tokenToString(node.operator)} ` });
165339
+ visitForDisplayParts(node.type);
165298
165340
  break;
165299
165341
  case 199 /* IndexedAccessType */:
165300
- const indexedAccess = node;
165301
- visitForDisplayParts(indexedAccess.objectType);
165342
+ Debug.assertNode(node, isIndexedAccessTypeNode);
165343
+ visitForDisplayParts(node.objectType);
165302
165344
  parts.push({ text: "[" });
165303
- visitForDisplayParts(indexedAccess.indexType);
165345
+ visitForDisplayParts(node.indexType);
165304
165346
  parts.push({ text: "]" });
165305
165347
  break;
165306
165348
  case 200 /* MappedType */:
165307
- const mappedType = node;
165349
+ Debug.assertNode(node, isMappedTypeNode);
165308
165350
  parts.push({ text: "{ " });
165309
- if (mappedType.readonlyToken) {
165310
- if (mappedType.readonlyToken.kind === 40 /* PlusToken */) {
165351
+ if (node.readonlyToken) {
165352
+ if (node.readonlyToken.kind === 40 /* PlusToken */) {
165311
165353
  parts.push({ text: "+" });
165312
- } else if (mappedType.readonlyToken.kind === 41 /* MinusToken */) {
165354
+ } else if (node.readonlyToken.kind === 41 /* MinusToken */) {
165313
165355
  parts.push({ text: "-" });
165314
165356
  }
165315
165357
  parts.push({ text: "readonly " });
165316
165358
  }
165317
165359
  parts.push({ text: "[" });
165318
- visitForDisplayParts(mappedType.typeParameter);
165319
- if (mappedType.nameType) {
165360
+ visitForDisplayParts(node.typeParameter);
165361
+ if (node.nameType) {
165320
165362
  parts.push({ text: " as " });
165321
- visitForDisplayParts(mappedType.nameType);
165363
+ visitForDisplayParts(node.nameType);
165322
165364
  }
165323
165365
  parts.push({ text: "]" });
165324
- if (mappedType.questionToken) {
165325
- if (mappedType.questionToken.kind === 40 /* PlusToken */) {
165366
+ if (node.questionToken) {
165367
+ if (node.questionToken.kind === 40 /* PlusToken */) {
165326
165368
  parts.push({ text: "+" });
165327
- } else if (mappedType.questionToken.kind === 41 /* MinusToken */) {
165369
+ } else if (node.questionToken.kind === 41 /* MinusToken */) {
165328
165370
  parts.push({ text: "-" });
165329
165371
  }
165330
165372
  parts.push({ text: "?" });
165331
165373
  }
165332
165374
  parts.push({ text: ": " });
165333
- if (mappedType.type) {
165334
- visitForDisplayParts(mappedType.type);
165375
+ if (node.type) {
165376
+ visitForDisplayParts(node.type);
165335
165377
  }
165336
165378
  parts.push({ text: "; }" });
165337
165379
  break;
165338
165380
  case 201 /* LiteralType */:
165381
+ Debug.assertNode(node, isLiteralTypeNode);
165339
165382
  visitForDisplayParts(node.literal);
165340
165383
  break;
165341
165384
  case 184 /* FunctionType */:
165342
- const functionType = node;
165343
- if (functionType.typeParameters) {
165344
- parts.push({ text: "<" });
165345
- visitDisplayPartList(functionType.typeParameters, ", ");
165346
- parts.push({ text: ">" });
165347
- }
165348
- parts.push({ text: "(" });
165349
- visitDisplayPartList(functionType.parameters, ", ");
165350
- parts.push({ text: ")" });
165385
+ Debug.assertNode(node, isFunctionTypeNode);
165386
+ visitParametersAndTypeParameters(node);
165351
165387
  parts.push({ text: " => " });
165352
- visitForDisplayParts(functionType.type);
165388
+ visitForDisplayParts(node.type);
165353
165389
  break;
165354
165390
  case 205 /* ImportType */:
165355
- const importType = node;
165356
- if (importType.isTypeOf) {
165391
+ Debug.assertNode(node, isImportTypeNode);
165392
+ if (node.isTypeOf) {
165357
165393
  parts.push({ text: "typeof " });
165358
165394
  }
165359
165395
  parts.push({ text: "import(" });
165360
- visitForDisplayParts(importType.argument);
165361
- if (importType.assertions) {
165396
+ visitForDisplayParts(node.argument);
165397
+ if (node.assertions) {
165362
165398
  parts.push({ text: ", { assert: " });
165363
- visitDisplayPartList(importType.assertions.assertClause.elements, ", ");
165399
+ visitDisplayPartList(node.assertions.assertClause.elements, ", ");
165364
165400
  parts.push({ text: " }" });
165365
165401
  }
165366
165402
  parts.push({ text: ")" });
165367
- if (importType.qualifier) {
165403
+ if (node.qualifier) {
165368
165404
  parts.push({ text: "." });
165369
- visitForDisplayParts(importType.qualifier);
165405
+ visitForDisplayParts(node.qualifier);
165370
165406
  }
165371
- if (importType.typeArguments) {
165407
+ if (node.typeArguments) {
165372
165408
  parts.push({ text: "<" });
165373
- visitDisplayPartList(importType.typeArguments, ", ");
165409
+ visitDisplayPartList(node.typeArguments, ", ");
165374
165410
  parts.push({ text: ">" });
165375
165411
  }
165376
165412
  break;
165377
165413
  case 171 /* PropertySignature */:
165378
- const propertySignature = node;
165379
- if (propertySignature.modifiers) {
165380
- visitDisplayPartList(propertySignature.modifiers, " ");
165414
+ Debug.assertNode(node, isPropertySignature);
165415
+ if ((_a = node.modifiers) == null ? void 0 : _a.length) {
165416
+ visitDisplayPartList(node.modifiers, " ");
165417
+ parts.push({ text: " " });
165418
+ }
165419
+ visitForDisplayParts(node.name);
165420
+ if (node.questionToken) {
165421
+ parts.push({ text: "?" });
165422
+ }
165423
+ if (node.type) {
165424
+ parts.push({ text: ": " });
165425
+ visitForDisplayParts(node.type);
165426
+ }
165427
+ break;
165428
+ case 173 /* MethodSignature */:
165429
+ Debug.assertNode(node, isMethodSignature);
165430
+ if ((_b = node.modifiers) == null ? void 0 : _b.length) {
165431
+ visitDisplayPartList(node.modifiers, " ");
165432
+ parts.push({ text: " " });
165381
165433
  }
165382
- visitForDisplayParts(propertySignature.name);
165383
- if (propertySignature.questionToken) {
165434
+ visitForDisplayParts(node.name);
165435
+ if (node.questionToken) {
165384
165436
  parts.push({ text: "?" });
165385
165437
  }
165386
- if (propertySignature.type) {
165438
+ visitParametersAndTypeParameters(node);
165439
+ if (node.type) {
165387
165440
  parts.push({ text: ": " });
165388
- visitForDisplayParts(propertySignature.type);
165441
+ visitForDisplayParts(node.type);
165389
165442
  }
165390
165443
  break;
165444
+ case 179 /* CallSignature */:
165445
+ Debug.assertNode(node, isCallSignatureDeclaration);
165446
+ visitParametersAndTypeParameters(node);
165447
+ if (node.type) {
165448
+ parts.push({ text: ": " });
165449
+ visitForDisplayParts(node.type);
165450
+ }
165451
+ break;
165452
+ case 207 /* ArrayBindingPattern */:
165453
+ Debug.assertNode(node, isArrayBindingPattern);
165454
+ parts.push({ text: "[" });
165455
+ visitDisplayPartList(node.elements, ", ");
165456
+ parts.push({ text: "]" });
165457
+ break;
165458
+ case 206 /* ObjectBindingPattern */:
165459
+ Debug.assertNode(node, isObjectBindingPattern);
165460
+ parts.push({ text: "{" });
165461
+ if (node.elements.length) {
165462
+ parts.push({ text: " " });
165463
+ visitDisplayPartList(node.elements, ", ");
165464
+ parts.push({ text: " " });
165465
+ }
165466
+ parts.push({ text: "}" });
165467
+ break;
165468
+ case 208 /* BindingElement */:
165469
+ Debug.assertNode(node, isBindingElement);
165470
+ visitForDisplayParts(node.name);
165471
+ break;
165472
+ case 224 /* PrefixUnaryExpression */:
165473
+ Debug.assertNode(node, isPrefixUnaryExpression);
165474
+ parts.push({ text: tokenToString(node.operator) });
165475
+ visitForDisplayParts(node.operand);
165476
+ break;
165391
165477
  default:
165392
165478
  Debug.failBadSyntaxKind(node);
165393
165479
  }
165394
165480
  }
165481
+ function visitParametersAndTypeParameters(signatureDeclaration) {
165482
+ if (signatureDeclaration.typeParameters) {
165483
+ parts.push({ text: "<" });
165484
+ visitDisplayPartList(signatureDeclaration.typeParameters, ", ");
165485
+ parts.push({ text: ">" });
165486
+ }
165487
+ parts.push({ text: "(" });
165488
+ visitDisplayPartList(signatureDeclaration.parameters, ", ");
165489
+ parts.push({ text: ")" });
165490
+ }
165395
165491
  function visitDisplayPartList(nodes, separator) {
165396
165492
  nodes.forEach((node, index) => {
165397
165493
  if (index > 0) {
@@ -170155,7 +170251,7 @@ function getAllRules() {
170155
170251
  const typeNames = [80 /* Identifier */, ...typeKeywords];
170156
170252
  const functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments;
170157
170253
  const typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([80 /* Identifier */, 3 /* MultiLineCommentTrivia */, 86 /* ClassKeyword */, 95 /* ExportKeyword */, 102 /* ImportKeyword */]);
170158
- const controlOpenBraceLeftTokenRange = tokenRangeFrom([22 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 92 /* DoKeyword */, 113 /* TryKeyword */, 98 /* FinallyKeyword */, 93 /* ElseKeyword */]);
170254
+ const controlOpenBraceLeftTokenRange = tokenRangeFrom([22 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 92 /* DoKeyword */, 113 /* TryKeyword */, 98 /* FinallyKeyword */, 93 /* ElseKeyword */, 85 /* CatchKeyword */]);
170159
170255
  const highPriorityCommonRules = [
170160
170256
  // Leave comments alone
170161
170257
  rule("IgnoreBeforeComment", anyToken, comments, anyContext, 1 /* StopProcessingSpaceActions */),