typescript 5.3.1-rc → 5.4.0-dev.20231104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/typescript.js CHANGED
@@ -34,8 +34,8 @@ var ts = (() => {
34
34
  var init_corePublic = __esm({
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
- versionMajorMinor = "5.3";
38
- version = "5.3.1-rc";
37
+ versionMajorMinor = "5.4";
38
+ version = `${versionMajorMinor}.0-dev.20231104`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -3034,7 +3034,7 @@ ${lanes.join("\n")}
3034
3034
  function tryGetNodePerformanceHooks() {
3035
3035
  if (isNodeLikeSystem()) {
3036
3036
  try {
3037
- const { performance: performance2, PerformanceObserver: PerformanceObserver2 } = require("perf_hooks");
3037
+ const { performance: performance2, PerformanceObserver: PerformanceObserver2 } = require("perf_hooks");
3038
3038
  if (hasRequiredAPI(performance2, PerformanceObserver2)) {
3039
3039
  return {
3040
3040
  // By default, only write native events when generating a cpu profile or using the v8 profiler.
@@ -3068,7 +3068,7 @@ ${lanes.join("\n")}
3068
3068
  "use strict";
3069
3069
  try {
3070
3070
  const etwModulePath = process.env.TS_ETW_MODULE_PATH ?? "./node_modules/@microsoft/typescript-etw";
3071
- etwModule = require(etwModulePath);
3071
+ etwModule = require(etwModulePath);
3072
3072
  } catch (e) {
3073
3073
  etwModule = void 0;
3074
3074
  }
@@ -3233,7 +3233,7 @@ ${lanes.join("\n")}
3233
3233
  Debug.assert(!tracing, "Tracing already started");
3234
3234
  if (fs === void 0) {
3235
3235
  try {
3236
- fs = require("fs");
3236
+ fs = require("fs");
3237
3237
  } catch (e) {
3238
3238
  throw new Error(`tracing requires having fs
3239
3239
  (original error: ${e.message || e})`);
@@ -6125,18 +6125,18 @@ ${lanes.join("\n")}
6125
6125
  const byteOrderMarkIndicator = "\uFEFF";
6126
6126
  function getNodeSystem() {
6127
6127
  const nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
6128
- const _fs = require("fs");
6129
- const _path = require("path");
6130
- const _os = require("os");
6128
+ const _fs = require("fs");
6129
+ const _path = require("path");
6130
+ const _os = require("os");
6131
6131
  let _crypto;
6132
6132
  try {
6133
- _crypto = require("crypto");
6133
+ _crypto = require("crypto");
6134
6134
  } catch {
6135
6135
  _crypto = void 0;
6136
6136
  }
6137
6137
  let activeSession;
6138
6138
  let profilePath = "./profile.cpuprofile";
6139
- const Buffer2 = require("buffer").Buffer;
6139
+ const Buffer2 = require("buffer").Buffer;
6140
6140
  const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
6141
6141
  const platform = _os.platform();
6142
6142
  const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
@@ -6235,7 +6235,7 @@ ${lanes.join("\n")}
6235
6235
  debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg)) || !!process.recordreplay,
6236
6236
  tryEnableSourceMapsForHost() {
6237
6237
  try {
6238
- require("source-map-support").install();
6238
+ require("source-map-support").install();
6239
6239
  } catch {
6240
6240
  }
6241
6241
  },
@@ -6257,7 +6257,7 @@ ${lanes.join("\n")}
6257
6257
  require: (baseDir, moduleName) => {
6258
6258
  try {
6259
6259
  const modulePath = resolveJSModule(moduleName, baseDir, nodeSystem);
6260
- return { module: require(modulePath), modulePath, error: void 0 };
6260
+ return { module: require(modulePath), modulePath, error: void 0 };
6261
6261
  } catch (error2) {
6262
6262
  return { module: void 0, modulePath: void 0, error: error2 };
6263
6263
  }
@@ -6272,7 +6272,7 @@ ${lanes.join("\n")}
6272
6272
  cb();
6273
6273
  return false;
6274
6274
  }
6275
- const inspector = require("inspector");
6275
+ const inspector = require("inspector");
6276
6276
  if (!inspector || !inspector.Session) {
6277
6277
  cb();
6278
6278
  return false;
@@ -25497,7 +25497,7 @@ ${lanes.join("\n")}
25497
25497
  ]
25498
25498
  );
25499
25499
  }
25500
- function createAwaiterHelper(hasLexicalThis, hasLexicalArguments, promiseConstructor, body) {
25500
+ function createAwaiterHelper(hasLexicalThis, argumentsExpression, promiseConstructor, parameters, body) {
25501
25501
  context.requestEmitHelper(awaiterHelper);
25502
25502
  const generatorFunc = factory2.createFunctionExpression(
25503
25503
  /*modifiers*/
@@ -25507,8 +25507,7 @@ ${lanes.join("\n")}
25507
25507
  void 0,
25508
25508
  /*typeParameters*/
25509
25509
  void 0,
25510
- /*parameters*/
25511
- [],
25510
+ parameters ?? [],
25512
25511
  /*type*/
25513
25512
  void 0,
25514
25513
  body
@@ -25520,7 +25519,7 @@ ${lanes.join("\n")}
25520
25519
  void 0,
25521
25520
  [
25522
25521
  hasLexicalThis ? factory2.createThis() : factory2.createVoidZero(),
25523
- hasLexicalArguments ? factory2.createIdentifier("arguments") : factory2.createVoidZero(),
25522
+ argumentsExpression ?? factory2.createVoidZero(),
25524
25523
  promiseConstructor ? createExpressionFromEntityName(factory2, promiseConstructor) : factory2.createVoidZero(),
25525
25524
  generatorFunc
25526
25525
  ]
@@ -37729,6 +37728,7 @@ ${lanes.join("\n")}
37729
37728
  ["es2015.symbol", "lib.es2015.symbol.d.ts"],
37730
37729
  ["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
37731
37730
  ["es2016.array.include", "lib.es2016.array.include.d.ts"],
37731
+ ["es2016.intl", "lib.es2016.intl.d.ts"],
37732
37732
  ["es2017.date", "lib.es2017.date.d.ts"],
37733
37733
  ["es2017.object", "lib.es2017.object.d.ts"],
37734
37734
  ["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
@@ -38060,6 +38060,7 @@ ${lanes.join("\n")}
38060
38060
  affectsModuleResolution: true,
38061
38061
  affectsEmit: true,
38062
38062
  affectsBuildInfo: true,
38063
+ deprecatedKeys: /* @__PURE__ */ new Set(["es3"]),
38063
38064
  paramType: Diagnostics.VERSION,
38064
38065
  showInSimplifiedHelpView: true,
38065
38066
  category: Diagnostics.Language_and_Environment,
@@ -42540,6 +42541,9 @@ ${lanes.join("\n")}
42540
42541
  case 213 /* CallExpression */:
42541
42542
  return hasNarrowableArgument(expr);
42542
42543
  case 217 /* ParenthesizedExpression */:
42544
+ if (isJSDocTypeAssertion(expr)) {
42545
+ return false;
42546
+ }
42543
42547
  case 235 /* NonNullExpression */:
42544
42548
  return isNarrowingExpression(expr.expression);
42545
42549
  case 226 /* BinaryExpression */:
@@ -69337,15 +69341,23 @@ ${lanes.join("\n")}
69337
69341
  error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
69338
69342
  return errorType;
69339
69343
  }
69340
- const container = getContainingFunction(node);
69341
- if (languageVersion < 2 /* ES2015 */) {
69342
- if (container.kind === 219 /* ArrowFunction */) {
69343
- error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
69344
- } else if (hasSyntacticModifier(container, 1024 /* Async */)) {
69345
- error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);
69344
+ let container = getContainingFunction(node);
69345
+ if (container) {
69346
+ if (languageVersion < 2 /* ES2015 */) {
69347
+ if (container.kind === 219 /* ArrowFunction */) {
69348
+ error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
69349
+ } else if (hasSyntacticModifier(container, 1024 /* Async */)) {
69350
+ error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);
69351
+ }
69352
+ }
69353
+ getNodeLinks(container).flags |= 512 /* CaptureArguments */;
69354
+ while (container && isArrowFunction(container)) {
69355
+ container = getContainingFunction(container);
69356
+ if (container) {
69357
+ getNodeLinks(container).flags |= 512 /* CaptureArguments */;
69358
+ }
69346
69359
  }
69347
69360
  }
69348
- getNodeLinks(container).flags |= 512 /* CaptureArguments */;
69349
69361
  return getTypeOfSymbol(symbol);
69350
69362
  }
69351
69363
  if (shouldMarkIdentifierAliasReferenced(node)) {
@@ -89442,6 +89454,12 @@ ${lanes.join("\n")}
89442
89454
  function accessPrivateIdentifier(env, name) {
89443
89455
  return walkUpLexicalEnvironments(env, (env2) => getPrivateIdentifier(env2.privateEnv, name));
89444
89456
  }
89457
+ function isSimpleParameter(node) {
89458
+ return !node.initializer && isIdentifier(node.name);
89459
+ }
89460
+ function isSimpleParameterList(nodes) {
89461
+ return every(nodes, isSimpleParameter);
89462
+ }
89445
89463
  var IdentifierNameMap, IdentifierNameMultiMap;
89446
89464
  var init_utilities3 = __esm({
89447
89465
  "src/compiler/transformers/utilities.ts"() {
@@ -97071,6 +97089,7 @@ ${lanes.join("\n")}
97071
97089
  let enclosingFunctionParameterNames;
97072
97090
  let capturedSuperProperties;
97073
97091
  let hasSuperElementAccess;
97092
+ let lexicalArgumentsBinding;
97074
97093
  const substitutedSuperAccessors = [];
97075
97094
  let contextFlags = 0 /* None */;
97076
97095
  const previousOnEmitNode = context.onEmitNode;
@@ -97121,9 +97140,30 @@ ${lanes.join("\n")}
97121
97140
  function visitDefault(node) {
97122
97141
  return visitEachChild(node, visitor, context);
97123
97142
  }
97143
+ function argumentsVisitor(node) {
97144
+ switch (node.kind) {
97145
+ case 218 /* FunctionExpression */:
97146
+ case 262 /* FunctionDeclaration */:
97147
+ case 174 /* MethodDeclaration */:
97148
+ case 177 /* GetAccessor */:
97149
+ case 178 /* SetAccessor */:
97150
+ case 176 /* Constructor */:
97151
+ return node;
97152
+ case 169 /* Parameter */:
97153
+ case 208 /* BindingElement */:
97154
+ case 260 /* VariableDeclaration */:
97155
+ break;
97156
+ case 80 /* Identifier */:
97157
+ if (lexicalArgumentsBinding && resolver.isArgumentsLocalBinding(node)) {
97158
+ return lexicalArgumentsBinding;
97159
+ }
97160
+ break;
97161
+ }
97162
+ return visitEachChild(node, argumentsVisitor, context);
97163
+ }
97124
97164
  function visitor(node) {
97125
97165
  if ((node.transformFlags & 256 /* ContainsES2017 */) === 0) {
97126
- return node;
97166
+ return lexicalArgumentsBinding ? argumentsVisitor(node) : node;
97127
97167
  }
97128
97168
  switch (node.kind) {
97129
97169
  case 134 /* AsyncKeyword */:
@@ -97281,15 +97321,23 @@ ${lanes.join("\n")}
97281
97321
  );
97282
97322
  }
97283
97323
  function visitConstructorDeclaration(node) {
97284
- return factory2.updateConstructorDeclaration(
97324
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
97325
+ lexicalArgumentsBinding = void 0;
97326
+ const updated = factory2.updateConstructorDeclaration(
97285
97327
  node,
97286
97328
  visitNodes2(node.modifiers, visitor, isModifier),
97287
97329
  visitParameterList(node.parameters, visitor, context),
97288
97330
  transformMethodBody(node)
97289
97331
  );
97332
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
97333
+ return updated;
97290
97334
  }
97291
97335
  function visitMethodDeclaration(node) {
97292
- return factory2.updateMethodDeclaration(
97336
+ let parameters;
97337
+ const functionFlags = getFunctionFlags(node);
97338
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
97339
+ lexicalArgumentsBinding = void 0;
97340
+ const updated = factory2.updateMethodDeclaration(
97293
97341
  node,
97294
97342
  visitNodes2(node.modifiers, visitor, isModifierLike),
97295
97343
  node.asteriskToken,
@@ -97298,14 +97346,18 @@ ${lanes.join("\n")}
97298
97346
  void 0,
97299
97347
  /*typeParameters*/
97300
97348
  void 0,
97301
- visitParameterList(node.parameters, visitor, context),
97349
+ parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
97302
97350
  /*type*/
97303
97351
  void 0,
97304
- getFunctionFlags(node) & 2 /* Async */ ? transformAsyncFunctionBody(node) : transformMethodBody(node)
97352
+ functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : transformMethodBody(node)
97305
97353
  );
97354
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
97355
+ return updated;
97306
97356
  }
97307
97357
  function visitGetAccessorDeclaration(node) {
97308
- return factory2.updateGetAccessorDeclaration(
97358
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
97359
+ lexicalArgumentsBinding = void 0;
97360
+ const updated = factory2.updateGetAccessorDeclaration(
97309
97361
  node,
97310
97362
  visitNodes2(node.modifiers, visitor, isModifierLike),
97311
97363
  node.name,
@@ -97314,55 +97366,75 @@ ${lanes.join("\n")}
97314
97366
  void 0,
97315
97367
  transformMethodBody(node)
97316
97368
  );
97369
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
97370
+ return updated;
97317
97371
  }
97318
97372
  function visitSetAccessorDeclaration(node) {
97319
- return factory2.updateSetAccessorDeclaration(
97373
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
97374
+ lexicalArgumentsBinding = void 0;
97375
+ const updated = factory2.updateSetAccessorDeclaration(
97320
97376
  node,
97321
97377
  visitNodes2(node.modifiers, visitor, isModifierLike),
97322
97378
  node.name,
97323
97379
  visitParameterList(node.parameters, visitor, context),
97324
97380
  transformMethodBody(node)
97325
97381
  );
97382
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
97383
+ return updated;
97326
97384
  }
97327
97385
  function visitFunctionDeclaration(node) {
97328
- return factory2.updateFunctionDeclaration(
97386
+ let parameters;
97387
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
97388
+ lexicalArgumentsBinding = void 0;
97389
+ const functionFlags = getFunctionFlags(node);
97390
+ const updated = factory2.updateFunctionDeclaration(
97329
97391
  node,
97330
97392
  visitNodes2(node.modifiers, visitor, isModifierLike),
97331
97393
  node.asteriskToken,
97332
97394
  node.name,
97333
97395
  /*typeParameters*/
97334
97396
  void 0,
97335
- visitParameterList(node.parameters, visitor, context),
97397
+ parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
97336
97398
  /*type*/
97337
97399
  void 0,
97338
- getFunctionFlags(node) & 2 /* Async */ ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context)
97400
+ functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
97339
97401
  );
97402
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
97403
+ return updated;
97340
97404
  }
97341
97405
  function visitFunctionExpression(node) {
97342
- return factory2.updateFunctionExpression(
97406
+ let parameters;
97407
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
97408
+ lexicalArgumentsBinding = void 0;
97409
+ const functionFlags = getFunctionFlags(node);
97410
+ const updated = factory2.updateFunctionExpression(
97343
97411
  node,
97344
97412
  visitNodes2(node.modifiers, visitor, isModifier),
97345
97413
  node.asteriskToken,
97346
97414
  node.name,
97347
97415
  /*typeParameters*/
97348
97416
  void 0,
97349
- visitParameterList(node.parameters, visitor, context),
97417
+ parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
97350
97418
  /*type*/
97351
97419
  void 0,
97352
- getFunctionFlags(node) & 2 /* Async */ ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context)
97420
+ functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
97353
97421
  );
97422
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
97423
+ return updated;
97354
97424
  }
97355
97425
  function visitArrowFunction(node) {
97426
+ let parameters;
97427
+ const functionFlags = getFunctionFlags(node);
97356
97428
  return factory2.updateArrowFunction(
97357
97429
  node,
97358
97430
  visitNodes2(node.modifiers, visitor, isModifier),
97359
97431
  /*typeParameters*/
97360
97432
  void 0,
97361
- visitParameterList(node.parameters, visitor, context),
97433
+ parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
97362
97434
  /*type*/
97363
97435
  void 0,
97364
97436
  node.equalsGreaterThanToken,
97365
- getFunctionFlags(node) & 2 /* Async */ ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context)
97437
+ functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
97366
97438
  );
97367
97439
  }
97368
97440
  function recordDeclarationName({ name }, names) {
@@ -97456,13 +97528,91 @@ ${lanes.join("\n")}
97456
97528
  hasSuperElementAccess = savedHasSuperElementAccess;
97457
97529
  return updated;
97458
97530
  }
97459
- function transformAsyncFunctionBody(node) {
97531
+ function createCaptureArgumentsStatement() {
97532
+ Debug.assert(lexicalArgumentsBinding);
97533
+ const variable = factory2.createVariableDeclaration(
97534
+ lexicalArgumentsBinding,
97535
+ /*exclamationToken*/
97536
+ void 0,
97537
+ /*type*/
97538
+ void 0,
97539
+ factory2.createIdentifier("arguments")
97540
+ );
97541
+ const statement = factory2.createVariableStatement(
97542
+ /*modifiers*/
97543
+ void 0,
97544
+ [variable]
97545
+ );
97546
+ startOnNewLine(statement);
97547
+ addEmitFlags(statement, 2097152 /* CustomPrologue */);
97548
+ return statement;
97549
+ }
97550
+ function transformAsyncFunctionParameterList(node) {
97551
+ if (isSimpleParameterList(node.parameters)) {
97552
+ return visitParameterList(node.parameters, visitor, context);
97553
+ }
97554
+ const newParameters = [];
97555
+ for (const parameter of node.parameters) {
97556
+ if (parameter.initializer || parameter.dotDotDotToken) {
97557
+ if (node.kind === 219 /* ArrowFunction */) {
97558
+ const restParameter = factory2.createParameterDeclaration(
97559
+ /*modifiers*/
97560
+ void 0,
97561
+ factory2.createToken(26 /* DotDotDotToken */),
97562
+ factory2.createUniqueName("args", 8 /* ReservedInNestedScopes */)
97563
+ );
97564
+ newParameters.push(restParameter);
97565
+ }
97566
+ break;
97567
+ }
97568
+ const newParameter = factory2.createParameterDeclaration(
97569
+ /*modifiers*/
97570
+ void 0,
97571
+ /*dotDotDotToken*/
97572
+ void 0,
97573
+ factory2.getGeneratedNameForNode(parameter.name, 8 /* ReservedInNestedScopes */)
97574
+ );
97575
+ newParameters.push(newParameter);
97576
+ }
97577
+ const newParametersArray = factory2.createNodeArray(newParameters);
97578
+ setTextRange(newParametersArray, node.parameters);
97579
+ return newParametersArray;
97580
+ }
97581
+ function transformAsyncFunctionBody(node, outerParameters) {
97582
+ const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0;
97460
97583
  resumeLexicalEnvironment();
97461
97584
  const original = getOriginalNode(node, isFunctionLike);
97462
97585
  const nodeType = original.type;
97463
97586
  const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
97464
97587
  const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
97588
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
97465
97589
  const hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 512 /* CaptureArguments */) !== 0;
97590
+ const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
97591
+ if (captureLexicalArguments) {
97592
+ lexicalArgumentsBinding = factory2.createUniqueName("arguments");
97593
+ }
97594
+ let argumentsExpression;
97595
+ if (innerParameters) {
97596
+ if (isArrowFunction2) {
97597
+ const parameterBindings = [];
97598
+ Debug.assert(outerParameters.length <= node.parameters.length);
97599
+ for (let i = 0; i < node.parameters.length; i++) {
97600
+ Debug.assert(i < outerParameters.length);
97601
+ const originalParameter = node.parameters[i];
97602
+ const outerParameter = outerParameters[i];
97603
+ Debug.assertNode(outerParameter.name, isIdentifier);
97604
+ if (originalParameter.initializer || originalParameter.dotDotDotToken) {
97605
+ Debug.assert(i === outerParameters.length - 1);
97606
+ parameterBindings.push(factory2.createSpreadElement(outerParameter.name));
97607
+ break;
97608
+ }
97609
+ parameterBindings.push(outerParameter.name);
97610
+ }
97611
+ argumentsExpression = factory2.createArrayLiteralExpression(parameterBindings);
97612
+ } else {
97613
+ argumentsExpression = factory2.createIdentifier("arguments");
97614
+ }
97615
+ }
97466
97616
  const savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames;
97467
97617
  enclosingFunctionParameterNames = /* @__PURE__ */ new Set();
97468
97618
  for (const parameter of node.parameters) {
@@ -97474,27 +97624,23 @@ ${lanes.join("\n")}
97474
97624
  capturedSuperProperties = /* @__PURE__ */ new Set();
97475
97625
  hasSuperElementAccess = false;
97476
97626
  }
97627
+ const hasLexicalThis = inHasLexicalThisContext();
97628
+ let asyncBody = transformAsyncFunctionBodyWorker(node.body);
97629
+ asyncBody = factory2.updateBlock(asyncBody, factory2.mergeLexicalEnvironment(asyncBody.statements, endLexicalEnvironment()));
97477
97630
  let result;
97478
97631
  if (!isArrowFunction2) {
97479
97632
  const statements = [];
97480
- const statementOffset = factory2.copyPrologue(
97481
- node.body.statements,
97482
- statements,
97483
- /*ensureUseStrict*/
97484
- false,
97485
- visitor
97486
- );
97487
97633
  statements.push(
97488
97634
  factory2.createReturnStatement(
97489
97635
  emitHelpers().createAwaiterHelper(
97490
- inHasLexicalThisContext(),
97491
- hasLexicalArguments,
97636
+ hasLexicalThis,
97637
+ argumentsExpression,
97492
97638
  promiseConstructor,
97493
- transformAsyncFunctionBodyWorker(node.body, statementOffset)
97639
+ innerParameters,
97640
+ asyncBody
97494
97641
  )
97495
97642
  )
97496
97643
  );
97497
- insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
97498
97644
  const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */);
97499
97645
  if (emitSuperHelpers) {
97500
97646
  enableSubstitutionForAsyncMethodsWithSuper();
@@ -97504,6 +97650,9 @@ ${lanes.join("\n")}
97504
97650
  insertStatementsAfterStandardPrologue(statements, [variableStatement]);
97505
97651
  }
97506
97652
  }
97653
+ if (captureLexicalArguments) {
97654
+ insertStatementsAfterStandardPrologue(statements, [createCaptureArgumentsStatement()]);
97655
+ }
97507
97656
  const block = factory2.createBlock(
97508
97657
  statements,
97509
97658
  /*multiLine*/
@@ -97519,24 +97668,23 @@ ${lanes.join("\n")}
97519
97668
  }
97520
97669
  result = block;
97521
97670
  } else {
97522
- const expression = emitHelpers().createAwaiterHelper(
97523
- inHasLexicalThisContext(),
97524
- hasLexicalArguments,
97671
+ result = emitHelpers().createAwaiterHelper(
97672
+ hasLexicalThis,
97673
+ argumentsExpression,
97525
97674
  promiseConstructor,
97526
- transformAsyncFunctionBodyWorker(node.body)
97675
+ innerParameters,
97676
+ asyncBody
97527
97677
  );
97528
- const declarations = endLexicalEnvironment();
97529
- if (some(declarations)) {
97530
- const block = factory2.converters.convertToFunctionBlock(expression);
97531
- result = factory2.updateBlock(block, setTextRange(factory2.createNodeArray(concatenate(declarations, block.statements)), block.statements));
97532
- } else {
97533
- result = expression;
97678
+ if (captureLexicalArguments) {
97679
+ const block = factory2.converters.convertToFunctionBlock(result);
97680
+ result = factory2.updateBlock(block, factory2.mergeLexicalEnvironment(block.statements, [createCaptureArgumentsStatement()]));
97534
97681
  }
97535
97682
  }
97536
97683
  enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames;
97537
97684
  if (!isArrowFunction2) {
97538
97685
  capturedSuperProperties = savedCapturedSuperProperties;
97539
97686
  hasSuperElementAccess = savedHasSuperElementAccess;
97687
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
97540
97688
  }
97541
97689
  return result;
97542
97690
  }
@@ -98658,7 +98806,7 @@ ${lanes.join("\n")}
98658
98806
  ),
98659
98807
  /*typeParameters*/
98660
98808
  void 0,
98661
- visitParameterList(node.parameters, parameterVisitor, context),
98809
+ enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
98662
98810
  /*type*/
98663
98811
  void 0,
98664
98812
  enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node)
@@ -98679,7 +98827,7 @@ ${lanes.join("\n")}
98679
98827
  node.name,
98680
98828
  /*typeParameters*/
98681
98829
  void 0,
98682
- visitParameterList(node.parameters, parameterVisitor, context),
98830
+ enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
98683
98831
  /*type*/
98684
98832
  void 0,
98685
98833
  enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node)
@@ -98720,7 +98868,7 @@ ${lanes.join("\n")}
98720
98868
  node.name,
98721
98869
  /*typeParameters*/
98722
98870
  void 0,
98723
- visitParameterList(node.parameters, parameterVisitor, context),
98871
+ enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
98724
98872
  /*type*/
98725
98873
  void 0,
98726
98874
  enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node)
@@ -98729,21 +98877,38 @@ ${lanes.join("\n")}
98729
98877
  parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread;
98730
98878
  return updated;
98731
98879
  }
98880
+ function transformAsyncGeneratorFunctionParameterList(node) {
98881
+ if (isSimpleParameterList(node.parameters)) {
98882
+ return visitParameterList(node.parameters, visitor, context);
98883
+ }
98884
+ const newParameters = [];
98885
+ for (const parameter of node.parameters) {
98886
+ if (parameter.initializer || parameter.dotDotDotToken) {
98887
+ break;
98888
+ }
98889
+ const newParameter = factory2.createParameterDeclaration(
98890
+ /*modifiers*/
98891
+ void 0,
98892
+ /*dotDotDotToken*/
98893
+ void 0,
98894
+ factory2.getGeneratedNameForNode(parameter.name, 8 /* ReservedInNestedScopes */)
98895
+ );
98896
+ newParameters.push(newParameter);
98897
+ }
98898
+ const newParametersArray = factory2.createNodeArray(newParameters);
98899
+ setTextRange(newParametersArray, node.parameters);
98900
+ return newParametersArray;
98901
+ }
98732
98902
  function transformAsyncGeneratorFunctionBody(node) {
98903
+ const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0;
98733
98904
  resumeLexicalEnvironment();
98734
- const statements = [];
98735
- const statementOffset = factory2.copyPrologue(
98736
- node.body.statements,
98737
- statements,
98738
- /*ensureUseStrict*/
98739
- false,
98740
- visitor
98741
- );
98742
- appendObjectRestAssignmentsIfNeeded(statements, node);
98743
98905
  const savedCapturedSuperProperties = capturedSuperProperties;
98744
98906
  const savedHasSuperElementAccess = hasSuperElementAccess;
98745
98907
  capturedSuperProperties = /* @__PURE__ */ new Set();
98746
98908
  hasSuperElementAccess = false;
98909
+ const outerStatements = [];
98910
+ let asyncBody = factory2.updateBlock(node.body, visitNodes2(node.body.statements, visitor, isStatement));
98911
+ asyncBody = factory2.updateBlock(asyncBody, factory2.mergeLexicalEnvironment(asyncBody.statements, appendObjectRestAssignmentsIfNeeded(endLexicalEnvironment(), node)));
98747
98912
  const returnStatement = factory2.createReturnStatement(
98748
98913
  emitHelpers().createAsyncGeneratorHelper(
98749
98914
  factory2.createFunctionExpression(
@@ -98753,14 +98918,10 @@ ${lanes.join("\n")}
98753
98918
  node.name && factory2.getGeneratedNameForNode(node.name),
98754
98919
  /*typeParameters*/
98755
98920
  void 0,
98756
- /*parameters*/
98757
- [],
98921
+ innerParameters ?? [],
98758
98922
  /*type*/
98759
98923
  void 0,
98760
- factory2.updateBlock(
98761
- node.body,
98762
- visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)
98763
- )
98924
+ asyncBody
98764
98925
  ),
98765
98926
  !!(hierarchyFacts & 1 /* HasLexicalThis */)
98766
98927
  )
@@ -98770,11 +98931,10 @@ ${lanes.join("\n")}
98770
98931
  enableSubstitutionForAsyncMethodsWithSuper();
98771
98932
  const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
98772
98933
  substitutedSuperAccessors[getNodeId(variableStatement)] = true;
98773
- insertStatementsAfterStandardPrologue(statements, [variableStatement]);
98934
+ insertStatementsAfterStandardPrologue(outerStatements, [variableStatement]);
98774
98935
  }
98775
- statements.push(returnStatement);
98776
- insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
98777
- const block = factory2.updateBlock(node.body, statements);
98936
+ outerStatements.push(returnStatement);
98937
+ const block = factory2.updateBlock(node.body, outerStatements);
98778
98938
  if (emitSuperHelpers && hasSuperElementAccess) {
98779
98939
  if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
98780
98940
  addEmitHelper(block, advancedAsyncSuperHelper);
@@ -112726,27 +112886,6 @@ ${lanes.join("\n")}
112726
112886
  (_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Emit, "emitBuildInfo", { buildInfoPath });
112727
112887
  emitBuildInfo(bundleBuildInfo, buildInfoPath);
112728
112888
  (_f = tracing) == null ? void 0 : _f.pop();
112729
- if (!emitSkipped && emittedFilesList) {
112730
- if (!emitOnly) {
112731
- if (jsFilePath) {
112732
- emittedFilesList.push(jsFilePath);
112733
- }
112734
- if (sourceMapFilePath) {
112735
- emittedFilesList.push(sourceMapFilePath);
112736
- }
112737
- if (buildInfoPath) {
112738
- emittedFilesList.push(buildInfoPath);
112739
- }
112740
- }
112741
- if (emitOnly !== 0 /* Js */) {
112742
- if (declarationFilePath) {
112743
- emittedFilesList.push(declarationFilePath);
112744
- }
112745
- if (declarationMapPath) {
112746
- emittedFilesList.push(declarationMapPath);
112747
- }
112748
- }
112749
- }
112750
112889
  function relativeToBuildInfo(path) {
112751
112890
  return ensurePathIsNonModuleName(getRelativePathFromDirectory(buildInfoDirectory, path, host.getCanonicalFileName));
112752
112891
  }
@@ -112774,6 +112913,7 @@ ${lanes.join("\n")}
112774
112913
  void 0,
112775
112914
  { buildInfo }
112776
112915
  );
112916
+ emittedFilesList == null ? void 0 : emittedFilesList.push(buildInfoPath);
112777
112917
  }
112778
112918
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
112779
112919
  if (!sourceFileOrBundle || emitOnly || !jsFilePath) {
@@ -112819,6 +112959,12 @@ ${lanes.join("\n")}
112819
112959
  transform2.dispose();
112820
112960
  if (bundleBuildInfo)
112821
112961
  bundleBuildInfo.js = printer.bundleFileInfo;
112962
+ if (emittedFilesList) {
112963
+ emittedFilesList.push(jsFilePath);
112964
+ if (sourceMapFilePath) {
112965
+ emittedFilesList.push(sourceMapFilePath);
112966
+ }
112967
+ }
112822
112968
  }
112823
112969
  function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) {
112824
112970
  if (!sourceFileOrBundle || emitOnly === 0 /* Js */)
@@ -112849,33 +112995,33 @@ ${lanes.join("\n")}
112849
112995
  emitterDiagnostics.add(diagnostic);
112850
112996
  }
112851
112997
  }
112852
- const printerOptions = {
112853
- removeComments: compilerOptions.removeComments,
112854
- newLine: compilerOptions.newLine,
112855
- noEmitHelpers: true,
112856
- module: compilerOptions.module,
112857
- target: compilerOptions.target,
112858
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
112859
- inlineSourceMap: compilerOptions.inlineSourceMap,
112860
- extendedDiagnostics: compilerOptions.extendedDiagnostics,
112861
- onlyPrintJsDocStyle: true,
112862
- omitBraceSourceMapPositions: true,
112863
- writeBundleFileInfo: !!bundleBuildInfo,
112864
- recordInternalSection: !!bundleBuildInfo,
112865
- relativeToBuildInfo
112866
- };
112867
- const declarationPrinter = createPrinter(printerOptions, {
112868
- // resolver hooks
112869
- hasGlobalName: resolver.hasGlobalName,
112870
- // transform hooks
112871
- onEmitNode: declarationTransform.emitNodeWithNotification,
112872
- isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
112873
- substituteNode: declarationTransform.substituteNode
112874
- });
112875
112998
  const declBlocked = !!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
112876
112999
  emitSkipped = emitSkipped || declBlocked;
112877
113000
  if (!declBlocked || forceDtsEmit) {
112878
113001
  Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
113002
+ const printerOptions = {
113003
+ removeComments: compilerOptions.removeComments,
113004
+ newLine: compilerOptions.newLine,
113005
+ noEmitHelpers: true,
113006
+ module: compilerOptions.module,
113007
+ target: compilerOptions.target,
113008
+ sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
113009
+ inlineSourceMap: compilerOptions.inlineSourceMap,
113010
+ extendedDiagnostics: compilerOptions.extendedDiagnostics,
113011
+ onlyPrintJsDocStyle: true,
113012
+ omitBraceSourceMapPositions: true,
113013
+ writeBundleFileInfo: !!bundleBuildInfo,
113014
+ recordInternalSection: !!bundleBuildInfo,
113015
+ relativeToBuildInfo
113016
+ };
113017
+ const declarationPrinter = createPrinter(printerOptions, {
113018
+ // resolver hooks
113019
+ hasGlobalName: resolver.hasGlobalName,
113020
+ // transform hooks
113021
+ onEmitNode: declarationTransform.emitNodeWithNotification,
113022
+ isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
113023
+ substituteNode: declarationTransform.substituteNode
113024
+ });
112879
113025
  printSourceFileOrBundle(
112880
113026
  declarationFilePath,
112881
113027
  declarationMapPath,
@@ -112889,10 +113035,16 @@ ${lanes.join("\n")}
112889
113035
  // Explicitly do not passthru either `inline` option
112890
113036
  }
112891
113037
  );
113038
+ if (emittedFilesList) {
113039
+ emittedFilesList.push(declarationFilePath);
113040
+ if (declarationMapPath) {
113041
+ emittedFilesList.push(declarationMapPath);
113042
+ }
113043
+ }
113044
+ if (bundleBuildInfo)
113045
+ bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
112892
113046
  }
112893
113047
  declarationTransform.dispose();
112894
- if (bundleBuildInfo)
112895
- bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
112896
113048
  }
112897
113049
  function collectLinkedAliases(node) {
112898
113050
  if (isExportAssignment(node)) {
@@ -123042,6 +123194,7 @@ ${lanes.join("\n")}
123042
123194
  const copyDeclarationFileDiagnostics = canCopySemanticDiagnostics && !compilerOptions.skipLibCheck === !oldCompilerOptions.skipLibCheck;
123043
123195
  const copyLibFileDiagnostics = copyDeclarationFileDiagnostics && !compilerOptions.skipDefaultLibCheck === !oldCompilerOptions.skipDefaultLibCheck;
123044
123196
  state.fileInfos.forEach((info, sourceFilePath) => {
123197
+ var _a2;
123045
123198
  let oldInfo;
123046
123199
  let newReferences;
123047
123200
  if (!useOldState || // File wasn't present in old state
@@ -123051,22 +123204,28 @@ ${lanes.join("\n")}
123051
123204
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
123052
123205
  newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
123053
123206
  addFileToChangeSet(state, sourceFilePath);
123054
- } else if (canCopySemanticDiagnostics) {
123207
+ } else {
123055
123208
  const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
123056
- if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
123057
- return;
123058
- if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
123059
- return;
123060
- const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
123061
- if (diagnostics) {
123062
- state.semanticDiagnosticsPerFile.set(
123209
+ const emitDiagnostics = (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath);
123210
+ if (emitDiagnostics) {
123211
+ (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
123063
123212
  sourceFilePath,
123064
- oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
123213
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
123065
123214
  );
123066
- if (!state.semanticDiagnosticsFromOldState) {
123067
- state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set();
123215
+ }
123216
+ if (canCopySemanticDiagnostics) {
123217
+ if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
123218
+ return;
123219
+ if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
123220
+ return;
123221
+ const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
123222
+ if (diagnostics) {
123223
+ state.semanticDiagnosticsPerFile.set(
123224
+ sourceFilePath,
123225
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
123226
+ );
123227
+ (state.semanticDiagnosticsFromOldState ?? (state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set())).add(sourceFilePath);
123068
123228
  }
123069
- state.semanticDiagnosticsFromOldState.add(sourceFilePath);
123070
123229
  }
123071
123230
  }
123072
123231
  if (canCopyEmitSignatures) {
@@ -123203,7 +123362,9 @@ ${lanes.join("\n")}
123203
123362
  outSignature: state.outSignature,
123204
123363
  latestChangedDtsFile: state.latestChangedDtsFile,
123205
123364
  hasChangedEmitSignature: state.hasChangedEmitSignature,
123206
- changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0
123365
+ changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0,
123366
+ buildInfoEmitPending: state.buildInfoEmitPending,
123367
+ emitDiagnosticsPerFile: state.emitDiagnosticsPerFile && new Map(state.emitDiagnosticsPerFile)
123207
123368
  };
123208
123369
  }
123209
123370
  function restoreBuilderProgramEmitState(state, savedEmitState) {
@@ -123214,6 +123375,8 @@ ${lanes.join("\n")}
123214
123375
  state.outSignature = savedEmitState.outSignature;
123215
123376
  state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
123216
123377
  state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
123378
+ state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
123379
+ state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
123217
123380
  if (savedEmitState.changedFilesSet)
123218
123381
  state.changedFilesSet = savedEmitState.changedFilesSet;
123219
123382
  }
@@ -123304,6 +123467,22 @@ ${lanes.join("\n")}
123304
123467
  return { affectedFile, emitKind: pendingKind };
123305
123468
  });
123306
123469
  }
123470
+ function getNextPendingEmitDiagnosticsFile(state) {
123471
+ var _a;
123472
+ if (!((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size))
123473
+ return void 0;
123474
+ return forEachEntry(state.emitDiagnosticsPerFile, (diagnostics, path) => {
123475
+ var _a2;
123476
+ const affectedFile = state.program.getSourceFileByPath(path);
123477
+ if (!affectedFile || !sourceFileMayBeEmitted(affectedFile, state.program)) {
123478
+ state.emitDiagnosticsPerFile.delete(path);
123479
+ return void 0;
123480
+ }
123481
+ const seenKind = ((_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath)) || 0 /* None */;
123482
+ if (!(seenKind & 24 /* AllDts */))
123483
+ return { affectedFile, diagnostics, seenKind };
123484
+ });
123485
+ }
123307
123486
  function removeDiagnosticsOfLibraryFiles(state) {
123308
123487
  if (!state.cleanedDiagnosticsOfLibFiles) {
123309
123488
  state.cleanedDiagnosticsOfLibFiles = true;
@@ -123580,18 +123759,7 @@ ${lanes.join("\n")}
123580
123759
  return void 0;
123581
123760
  });
123582
123761
  }
123583
- let semanticDiagnosticsPerFile;
123584
- if (state.semanticDiagnosticsPerFile) {
123585
- for (const key of arrayFrom(state.semanticDiagnosticsPerFile.keys()).sort(compareStringsCaseSensitive)) {
123586
- const value = state.semanticDiagnosticsPerFile.get(key);
123587
- (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(
123588
- value.length ? [
123589
- toFileId(key),
123590
- convertToReusableDiagnostics(value, relativeToBuildInfo)
123591
- ] : toFileId(key)
123592
- );
123593
- }
123594
- }
123762
+ const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.semanticDiagnosticsPerFile);
123595
123763
  let affectedFilesPendingEmit;
123596
123764
  if ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.size) {
123597
123765
  const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
@@ -123621,6 +123789,7 @@ ${lanes.join("\n")}
123621
123789
  (changeFileSet || (changeFileSet = [])).push(toFileId(path));
123622
123790
  }
123623
123791
  }
123792
+ const emitDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.emitDiagnosticsPerFile);
123624
123793
  const program = {
123625
123794
  fileNames,
123626
123795
  fileInfos,
@@ -123630,6 +123799,7 @@ ${lanes.join("\n")}
123630
123799
  referencedMap,
123631
123800
  exportedModulesMap,
123632
123801
  semanticDiagnosticsPerFile,
123802
+ emitDiagnosticsPerFile,
123633
123803
  affectedFilesPendingEmit,
123634
123804
  changeFileSet,
123635
123805
  emitSignatures,
@@ -123686,73 +123856,87 @@ ${lanes.join("\n")}
123686
123856
  if (optionInfo == null ? void 0 : optionInfo.affectsBuildInfo) {
123687
123857
  (result || (result = {}))[name] = convertToReusableCompilerOptionValue(
123688
123858
  optionInfo,
123689
- options[name],
123690
- relativeToBuildInfoEnsuringAbsolutePath
123859
+ options[name]
123691
123860
  );
123692
123861
  }
123693
123862
  }
123694
123863
  return result;
123695
123864
  }
123696
- }
123697
- function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
123698
- if (option) {
123699
- Debug.assert(option.type !== "listOrElement");
123700
- if (option.type === "list") {
123701
- const values = value;
123702
- if (option.element.isFilePath && values.length) {
123703
- return values.map(relativeToBuildInfo);
123865
+ function convertToReusableCompilerOptionValue(option, value) {
123866
+ if (option) {
123867
+ Debug.assert(option.type !== "listOrElement");
123868
+ if (option.type === "list") {
123869
+ const values = value;
123870
+ if (option.element.isFilePath && values.length) {
123871
+ return values.map(relativeToBuildInfoEnsuringAbsolutePath);
123872
+ }
123873
+ } else if (option.isFilePath) {
123874
+ return relativeToBuildInfoEnsuringAbsolutePath(value);
123704
123875
  }
123705
- } else if (option.isFilePath) {
123706
- return relativeToBuildInfo(value);
123707
123876
  }
123877
+ return value;
123708
123878
  }
123709
- return value;
123710
- }
123711
- function convertToReusableDiagnostics(diagnostics, relativeToBuildInfo) {
123712
- Debug.assert(!!diagnostics.length);
123713
- return diagnostics.map((diagnostic) => {
123714
- const result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
123715
- result.reportsUnnecessary = diagnostic.reportsUnnecessary;
123716
- result.reportDeprecated = diagnostic.reportsDeprecated;
123717
- result.source = diagnostic.source;
123718
- result.skippedOn = diagnostic.skippedOn;
123719
- const { relatedInformation } = diagnostic;
123720
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo)) : [] : void 0;
123879
+ function convertToProgramBuildInfoDiagnostics(diagnostics) {
123880
+ let result;
123881
+ if (diagnostics) {
123882
+ for (const key of arrayFrom(diagnostics.keys()).sort(compareStringsCaseSensitive)) {
123883
+ const value = diagnostics.get(key);
123884
+ (result || (result = [])).push(
123885
+ value.length ? [
123886
+ toFileId(key),
123887
+ convertToReusableDiagnostics(value)
123888
+ ] : toFileId(key)
123889
+ );
123890
+ }
123891
+ }
123721
123892
  return result;
123722
- });
123723
- }
123724
- function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo) {
123725
- const { file } = diagnostic;
123726
- return {
123727
- ...diagnostic,
123728
- file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
123729
- messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
123730
- };
123731
- }
123732
- function convertToReusableDiagnosticMessageChain(chain) {
123733
- if (chain.repopulateInfo) {
123893
+ }
123894
+ function convertToReusableDiagnostics(diagnostics) {
123895
+ Debug.assert(!!diagnostics.length);
123896
+ return diagnostics.map((diagnostic) => {
123897
+ const result = convertToReusableDiagnosticRelatedInformation(diagnostic);
123898
+ result.reportsUnnecessary = diagnostic.reportsUnnecessary;
123899
+ result.reportDeprecated = diagnostic.reportsDeprecated;
123900
+ result.source = diagnostic.source;
123901
+ result.skippedOn = diagnostic.skippedOn;
123902
+ const { relatedInformation } = diagnostic;
123903
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r)) : [] : void 0;
123904
+ return result;
123905
+ });
123906
+ }
123907
+ function convertToReusableDiagnosticRelatedInformation(diagnostic) {
123908
+ const { file } = diagnostic;
123734
123909
  return {
123735
- info: chain.repopulateInfo(),
123736
- next: convertToReusableDiagnosticMessageChainArray(chain.next)
123910
+ ...diagnostic,
123911
+ file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
123912
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
123737
123913
  };
123738
123914
  }
123739
- const next = convertToReusableDiagnosticMessageChainArray(chain.next);
123740
- return next === chain.next ? chain : { ...chain, next };
123741
- }
123742
- function convertToReusableDiagnosticMessageChainArray(array) {
123743
- if (!array)
123744
- return array;
123745
- return forEach(array, (chain, index) => {
123746
- const reusable = convertToReusableDiagnosticMessageChain(chain);
123747
- if (chain === reusable)
123748
- return void 0;
123749
- const result = index > 0 ? array.slice(0, index - 1) : [];
123750
- result.push(reusable);
123751
- for (let i = index + 1; i < array.length; i++) {
123752
- result.push(convertToReusableDiagnosticMessageChain(array[i]));
123915
+ function convertToReusableDiagnosticMessageChain(chain) {
123916
+ if (chain.repopulateInfo) {
123917
+ return {
123918
+ info: chain.repopulateInfo(),
123919
+ next: convertToReusableDiagnosticMessageChainArray(chain.next)
123920
+ };
123753
123921
  }
123754
- return result;
123755
- }) || array;
123922
+ const next = convertToReusableDiagnosticMessageChainArray(chain.next);
123923
+ return next === chain.next ? chain : { ...chain, next };
123924
+ }
123925
+ function convertToReusableDiagnosticMessageChainArray(array) {
123926
+ if (!array)
123927
+ return array;
123928
+ return forEach(array, (chain, index) => {
123929
+ const reusable = convertToReusableDiagnosticMessageChain(chain);
123930
+ if (chain === reusable)
123931
+ return void 0;
123932
+ const result = index > 0 ? array.slice(0, index - 1) : [];
123933
+ result.push(reusable);
123934
+ for (let i = index + 1; i < array.length; i++) {
123935
+ result.push(convertToReusableDiagnosticMessageChain(array[i]));
123936
+ }
123937
+ return result;
123938
+ }) || array;
123939
+ }
123756
123940
  }
123757
123941
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
123758
123942
  let host;
@@ -123861,6 +124045,14 @@ ${lanes.join("\n")}
123861
124045
  if (!outFile(state.compilerOptions)) {
123862
124046
  const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
123863
124047
  if (!pendingAffectedFile) {
124048
+ const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
124049
+ if (pendingForDiagnostics) {
124050
+ (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
124051
+ return {
124052
+ result: { emitSkipped: true, diagnostics: pendingForDiagnostics.diagnostics },
124053
+ affected: pendingForDiagnostics.affectedFile
124054
+ };
124055
+ }
123864
124056
  if (!state.buildInfoEmitPending)
123865
124057
  return void 0;
123866
124058
  const affected2 = state.program;
@@ -123909,6 +124101,8 @@ ${lanes.join("\n")}
123909
124101
  (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
123910
124102
  else
123911
124103
  (_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.delete(affectedSourceFile.resolvedPath);
124104
+ if (result.diagnostics.length)
124105
+ (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, result.diagnostics);
123912
124106
  } else {
123913
124107
  state.changedFilesSet.clear();
123914
124108
  }
@@ -124081,9 +124275,10 @@ ${lanes.join("\n")}
124081
124275
  }
124082
124276
  }
124083
124277
  function addToAffectedFilesPendingEmit(state, affectedFilePendingEmit, kind) {
124084
- var _a;
124278
+ var _a, _b;
124085
124279
  const existingKind = ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.get(affectedFilePendingEmit)) || 0 /* None */;
124086
124280
  (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedFilePendingEmit, existingKind | kind);
124281
+ (_b = state.emitDiagnosticsPerFile) == null ? void 0 : _b.delete(affectedFilePendingEmit);
124087
124282
  }
124088
124283
  function toBuilderStateFileInfoForMultiEmit(fileInfo) {
124089
124284
  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 };
@@ -124148,7 +124343,8 @@ ${lanes.join("\n")}
124148
124343
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
124149
124344
  referencedMap: toManyToManyPathMap(program.referencedMap),
124150
124345
  exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
124151
- semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && arrayToMap(program.semanticDiagnosticsPerFile, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]),
124346
+ semanticDiagnosticsPerFile: toPerFileDiagnostics(program.semanticDiagnosticsPerFile),
124347
+ emitDiagnosticsPerFile: toPerFileDiagnostics(program.emitDiagnosticsPerFile),
124152
124348
  hasReusableDiagnostic: true,
124153
124349
  affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
124154
124350
  changedFilesSet: new Set(map(program.changeFileSet, toFilePath)),
@@ -124201,6 +124397,9 @@ ${lanes.join("\n")}
124201
124397
  referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
124202
124398
  return map2;
124203
124399
  }
124400
+ function toPerFileDiagnostics(diagnostics) {
124401
+ return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]);
124402
+ }
124204
124403
  }
124205
124404
  function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
124206
124405
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
@@ -127895,7 +128094,7 @@ ${lanes.join("\n")}
127895
128094
  }
127896
128095
  }
127897
128096
  function getUpToDateStatusWorker(state, project, resolvedPath) {
127898
- var _a, _b;
128097
+ var _a, _b, _c;
127899
128098
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
127900
128099
  return {
127901
128100
  type: 16 /* ContainerOnly */
@@ -127969,7 +128168,7 @@ ${lanes.join("\n")}
127969
128168
  };
127970
128169
  }
127971
128170
  if (buildInfo.program) {
127972
- 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))) {
128171
+ 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))) {
127973
128172
  return {
127974
128173
  type: 8 /* OutOfDateBuildInfo */,
127975
128174
  buildInfoFile: buildInfoPath
@@ -143964,7 +144163,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
143964
144163
  if (discriminatedPropertySymbols.length === 0) {
143965
144164
  return mapDefined(contextualType.types, (t) => t.getProperty(name));
143966
144165
  }
143967
- return discriminatedPropertySymbols;
144166
+ return deduplicate(discriminatedPropertySymbols, equateValues);
143968
144167
  }
143969
144168
  function isArgumentOfElementAccessExpression(node) {
143970
144169
  return node && node.parent && node.parent.kind === 212 /* ElementAccessExpression */ && node.parent.argumentExpression === node;
@@ -164466,6 +164665,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164466
164665
  visitForDisplayParts(typeNode);
164467
164666
  return parts;
164468
164667
  function visitForDisplayParts(node) {
164668
+ var _a, _b;
164469
164669
  if (!node) {
164470
164670
  return;
164471
164671
  }
@@ -164480,9 +164680,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164480
164680
  }
164481
164681
  switch (node.kind) {
164482
164682
  case 80 /* Identifier */:
164483
- const identifier = node;
164484
- const identifierText = idText(identifier);
164485
- const name = identifier.symbol && identifier.symbol.declarations && identifier.symbol.declarations.length && getNameOfDeclaration(identifier.symbol.declarations[0]);
164683
+ Debug.assertNode(node, isIdentifier);
164684
+ const identifierText = idText(node);
164685
+ const name = node.symbol && node.symbol.declarations && node.symbol.declarations.length && getNameOfDeclaration(node.symbol.declarations[0]);
164486
164686
  if (name) {
164487
164687
  parts.push(getNodeDisplayPart(identifierText, name));
164488
164688
  } else {
@@ -164490,252 +164690,307 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164490
164690
  }
164491
164691
  break;
164492
164692
  case 166 /* QualifiedName */:
164493
- const qualifiedName = node;
164494
- visitForDisplayParts(qualifiedName.left);
164693
+ Debug.assertNode(node, isQualifiedName);
164694
+ visitForDisplayParts(node.left);
164495
164695
  parts.push({ text: "." });
164496
- visitForDisplayParts(qualifiedName.right);
164696
+ visitForDisplayParts(node.right);
164497
164697
  break;
164498
164698
  case 182 /* TypePredicate */:
164499
- const predicate = node;
164500
- if (predicate.assertsModifier) {
164699
+ Debug.assertNode(node, isTypePredicateNode);
164700
+ if (node.assertsModifier) {
164501
164701
  parts.push({ text: "asserts " });
164502
164702
  }
164503
- visitForDisplayParts(predicate.parameterName);
164504
- if (predicate.type) {
164703
+ visitForDisplayParts(node.parameterName);
164704
+ if (node.type) {
164505
164705
  parts.push({ text: " is " });
164506
- visitForDisplayParts(predicate.type);
164706
+ visitForDisplayParts(node.type);
164507
164707
  }
164508
164708
  break;
164509
164709
  case 183 /* TypeReference */:
164510
- const typeReference = node;
164511
- visitForDisplayParts(typeReference.typeName);
164512
- if (typeReference.typeArguments) {
164710
+ Debug.assertNode(node, isTypeReferenceNode);
164711
+ visitForDisplayParts(node.typeName);
164712
+ if (node.typeArguments) {
164513
164713
  parts.push({ text: "<" });
164514
- visitDisplayPartList(typeReference.typeArguments, ", ");
164714
+ visitDisplayPartList(node.typeArguments, ", ");
164515
164715
  parts.push({ text: ">" });
164516
164716
  }
164517
164717
  break;
164518
164718
  case 168 /* TypeParameter */:
164519
- const typeParameter = node;
164520
- if (typeParameter.modifiers) {
164521
- visitDisplayPartList(typeParameter.modifiers, " ");
164719
+ Debug.assertNode(node, isTypeParameterDeclaration);
164720
+ if (node.modifiers) {
164721
+ visitDisplayPartList(node.modifiers, " ");
164522
164722
  }
164523
- visitForDisplayParts(typeParameter.name);
164524
- if (typeParameter.constraint) {
164723
+ visitForDisplayParts(node.name);
164724
+ if (node.constraint) {
164525
164725
  parts.push({ text: " extends " });
164526
- visitForDisplayParts(typeParameter.constraint);
164726
+ visitForDisplayParts(node.constraint);
164527
164727
  }
164528
- if (typeParameter.default) {
164728
+ if (node.default) {
164529
164729
  parts.push({ text: " = " });
164530
- visitForDisplayParts(typeParameter.default);
164730
+ visitForDisplayParts(node.default);
164531
164731
  }
164532
164732
  break;
164533
164733
  case 169 /* Parameter */:
164534
- const parameter = node;
164535
- if (parameter.modifiers) {
164536
- visitDisplayPartList(parameter.modifiers, " ");
164734
+ Debug.assertNode(node, isParameter);
164735
+ if (node.modifiers) {
164736
+ visitDisplayPartList(node.modifiers, " ");
164537
164737
  }
164538
- if (parameter.dotDotDotToken) {
164738
+ if (node.dotDotDotToken) {
164539
164739
  parts.push({ text: "..." });
164540
164740
  }
164541
- visitForDisplayParts(parameter.name);
164542
- if (parameter.questionToken) {
164741
+ visitForDisplayParts(node.name);
164742
+ if (node.questionToken) {
164543
164743
  parts.push({ text: "?" });
164544
164744
  }
164545
- if (parameter.type) {
164745
+ if (node.type) {
164546
164746
  parts.push({ text: ": " });
164547
- visitForDisplayParts(parameter.type);
164747
+ visitForDisplayParts(node.type);
164548
164748
  }
164549
164749
  break;
164550
164750
  case 185 /* ConstructorType */:
164551
- const constructorType = node;
164751
+ Debug.assertNode(node, isConstructorTypeNode);
164552
164752
  parts.push({ text: "new " });
164553
- if (constructorType.typeParameters) {
164554
- parts.push({ text: "<" });
164555
- visitDisplayPartList(constructorType.typeParameters, ", ");
164556
- parts.push({ text: ">" });
164557
- }
164558
- parts.push({ text: "(" });
164559
- visitDisplayPartList(constructorType.parameters, ", ");
164560
- parts.push({ text: ")" });
164753
+ visitParametersAndTypeParameters(node);
164561
164754
  parts.push({ text: " => " });
164562
- visitForDisplayParts(constructorType.type);
164755
+ visitForDisplayParts(node.type);
164563
164756
  break;
164564
164757
  case 186 /* TypeQuery */:
164565
- const typeQuery = node;
164758
+ Debug.assertNode(node, isTypeQueryNode);
164566
164759
  parts.push({ text: "typeof " });
164567
- visitForDisplayParts(typeQuery.exprName);
164568
- if (typeQuery.typeArguments) {
164760
+ visitForDisplayParts(node.exprName);
164761
+ if (node.typeArguments) {
164569
164762
  parts.push({ text: "<" });
164570
- visitDisplayPartList(typeQuery.typeArguments, ", ");
164763
+ visitDisplayPartList(node.typeArguments, ", ");
164571
164764
  parts.push({ text: ">" });
164572
164765
  }
164573
164766
  break;
164574
164767
  case 187 /* TypeLiteral */:
164575
- const typeLiteral = node;
164768
+ Debug.assertNode(node, isTypeLiteralNode);
164576
164769
  parts.push({ text: "{" });
164577
- if (typeLiteral.members.length) {
164770
+ if (node.members.length) {
164578
164771
  parts.push({ text: " " });
164579
- visitDisplayPartList(typeLiteral.members, "; ");
164772
+ visitDisplayPartList(node.members, "; ");
164580
164773
  parts.push({ text: " " });
164581
164774
  }
164582
164775
  parts.push({ text: "}" });
164583
164776
  break;
164584
164777
  case 188 /* ArrayType */:
164778
+ Debug.assertNode(node, isArrayTypeNode);
164585
164779
  visitForDisplayParts(node.elementType);
164586
164780
  parts.push({ text: "[]" });
164587
164781
  break;
164588
164782
  case 189 /* TupleType */:
164783
+ Debug.assertNode(node, isTupleTypeNode);
164589
164784
  parts.push({ text: "[" });
164590
164785
  visitDisplayPartList(node.elements, ", ");
164591
164786
  parts.push({ text: "]" });
164592
164787
  break;
164593
164788
  case 202 /* NamedTupleMember */:
164594
- const member = node;
164595
- if (member.dotDotDotToken) {
164789
+ Debug.assertNode(node, isNamedTupleMember);
164790
+ if (node.dotDotDotToken) {
164596
164791
  parts.push({ text: "..." });
164597
164792
  }
164598
- visitForDisplayParts(member.name);
164599
- if (member.questionToken) {
164793
+ visitForDisplayParts(node.name);
164794
+ if (node.questionToken) {
164600
164795
  parts.push({ text: "?" });
164601
164796
  }
164602
164797
  parts.push({ text: ": " });
164603
- visitForDisplayParts(member.type);
164798
+ visitForDisplayParts(node.type);
164604
164799
  break;
164605
164800
  case 190 /* OptionalType */:
164801
+ Debug.assertNode(node, isOptionalTypeNode);
164606
164802
  visitForDisplayParts(node.type);
164607
164803
  parts.push({ text: "?" });
164608
164804
  break;
164609
164805
  case 191 /* RestType */:
164806
+ Debug.assertNode(node, isRestTypeNode);
164610
164807
  parts.push({ text: "..." });
164611
164808
  visitForDisplayParts(node.type);
164612
164809
  break;
164613
164810
  case 192 /* UnionType */:
164811
+ Debug.assertNode(node, isUnionTypeNode);
164614
164812
  visitDisplayPartList(node.types, " | ");
164615
164813
  break;
164616
164814
  case 193 /* IntersectionType */:
164815
+ Debug.assertNode(node, isIntersectionTypeNode);
164617
164816
  visitDisplayPartList(node.types, " & ");
164618
164817
  break;
164619
164818
  case 194 /* ConditionalType */:
164620
- const conditionalType = node;
164621
- visitForDisplayParts(conditionalType.checkType);
164819
+ Debug.assertNode(node, isConditionalTypeNode);
164820
+ visitForDisplayParts(node.checkType);
164622
164821
  parts.push({ text: " extends " });
164623
- visitForDisplayParts(conditionalType.extendsType);
164822
+ visitForDisplayParts(node.extendsType);
164624
164823
  parts.push({ text: " ? " });
164625
- visitForDisplayParts(conditionalType.trueType);
164824
+ visitForDisplayParts(node.trueType);
164626
164825
  parts.push({ text: " : " });
164627
- visitForDisplayParts(conditionalType.falseType);
164826
+ visitForDisplayParts(node.falseType);
164628
164827
  break;
164629
164828
  case 195 /* InferType */:
164829
+ Debug.assertNode(node, isInferTypeNode);
164630
164830
  parts.push({ text: "infer " });
164631
164831
  visitForDisplayParts(node.typeParameter);
164632
164832
  break;
164633
164833
  case 196 /* ParenthesizedType */:
164834
+ Debug.assertNode(node, isParenthesizedTypeNode);
164634
164835
  parts.push({ text: "(" });
164635
164836
  visitForDisplayParts(node.type);
164636
164837
  parts.push({ text: ")" });
164637
164838
  break;
164638
164839
  case 198 /* TypeOperator */:
164639
- const typeOperator = node;
164640
- parts.push({ text: `${tokenToString(typeOperator.operator)} ` });
164641
- visitForDisplayParts(typeOperator.type);
164840
+ Debug.assertNode(node, isTypeOperatorNode);
164841
+ parts.push({ text: `${tokenToString(node.operator)} ` });
164842
+ visitForDisplayParts(node.type);
164642
164843
  break;
164643
164844
  case 199 /* IndexedAccessType */:
164644
- const indexedAccess = node;
164645
- visitForDisplayParts(indexedAccess.objectType);
164845
+ Debug.assertNode(node, isIndexedAccessTypeNode);
164846
+ visitForDisplayParts(node.objectType);
164646
164847
  parts.push({ text: "[" });
164647
- visitForDisplayParts(indexedAccess.indexType);
164848
+ visitForDisplayParts(node.indexType);
164648
164849
  parts.push({ text: "]" });
164649
164850
  break;
164650
164851
  case 200 /* MappedType */:
164651
- const mappedType = node;
164852
+ Debug.assertNode(node, isMappedTypeNode);
164652
164853
  parts.push({ text: "{ " });
164653
- if (mappedType.readonlyToken) {
164654
- if (mappedType.readonlyToken.kind === 40 /* PlusToken */) {
164854
+ if (node.readonlyToken) {
164855
+ if (node.readonlyToken.kind === 40 /* PlusToken */) {
164655
164856
  parts.push({ text: "+" });
164656
- } else if (mappedType.readonlyToken.kind === 41 /* MinusToken */) {
164857
+ } else if (node.readonlyToken.kind === 41 /* MinusToken */) {
164657
164858
  parts.push({ text: "-" });
164658
164859
  }
164659
164860
  parts.push({ text: "readonly " });
164660
164861
  }
164661
164862
  parts.push({ text: "[" });
164662
- visitForDisplayParts(mappedType.typeParameter);
164663
- if (mappedType.nameType) {
164863
+ visitForDisplayParts(node.typeParameter);
164864
+ if (node.nameType) {
164664
164865
  parts.push({ text: " as " });
164665
- visitForDisplayParts(mappedType.nameType);
164866
+ visitForDisplayParts(node.nameType);
164666
164867
  }
164667
164868
  parts.push({ text: "]" });
164668
- if (mappedType.questionToken) {
164669
- if (mappedType.questionToken.kind === 40 /* PlusToken */) {
164869
+ if (node.questionToken) {
164870
+ if (node.questionToken.kind === 40 /* PlusToken */) {
164670
164871
  parts.push({ text: "+" });
164671
- } else if (mappedType.questionToken.kind === 41 /* MinusToken */) {
164872
+ } else if (node.questionToken.kind === 41 /* MinusToken */) {
164672
164873
  parts.push({ text: "-" });
164673
164874
  }
164674
164875
  parts.push({ text: "?" });
164675
164876
  }
164676
164877
  parts.push({ text: ": " });
164677
- if (mappedType.type) {
164678
- visitForDisplayParts(mappedType.type);
164878
+ if (node.type) {
164879
+ visitForDisplayParts(node.type);
164679
164880
  }
164680
164881
  parts.push({ text: "; }" });
164681
164882
  break;
164682
164883
  case 201 /* LiteralType */:
164884
+ Debug.assertNode(node, isLiteralTypeNode);
164683
164885
  visitForDisplayParts(node.literal);
164684
164886
  break;
164685
164887
  case 184 /* FunctionType */:
164686
- const functionType = node;
164687
- if (functionType.typeParameters) {
164688
- parts.push({ text: "<" });
164689
- visitDisplayPartList(functionType.typeParameters, ", ");
164690
- parts.push({ text: ">" });
164691
- }
164692
- parts.push({ text: "(" });
164693
- visitDisplayPartList(functionType.parameters, ", ");
164694
- parts.push({ text: ")" });
164888
+ Debug.assertNode(node, isFunctionTypeNode);
164889
+ visitParametersAndTypeParameters(node);
164695
164890
  parts.push({ text: " => " });
164696
- visitForDisplayParts(functionType.type);
164891
+ visitForDisplayParts(node.type);
164697
164892
  break;
164698
164893
  case 205 /* ImportType */:
164699
- const importType = node;
164700
- if (importType.isTypeOf) {
164894
+ Debug.assertNode(node, isImportTypeNode);
164895
+ if (node.isTypeOf) {
164701
164896
  parts.push({ text: "typeof " });
164702
164897
  }
164703
164898
  parts.push({ text: "import(" });
164704
- visitForDisplayParts(importType.argument);
164705
- if (importType.assertions) {
164899
+ visitForDisplayParts(node.argument);
164900
+ if (node.assertions) {
164706
164901
  parts.push({ text: ", { assert: " });
164707
- visitDisplayPartList(importType.assertions.assertClause.elements, ", ");
164902
+ visitDisplayPartList(node.assertions.assertClause.elements, ", ");
164708
164903
  parts.push({ text: " }" });
164709
164904
  }
164710
164905
  parts.push({ text: ")" });
164711
- if (importType.qualifier) {
164906
+ if (node.qualifier) {
164712
164907
  parts.push({ text: "." });
164713
- visitForDisplayParts(importType.qualifier);
164908
+ visitForDisplayParts(node.qualifier);
164714
164909
  }
164715
- if (importType.typeArguments) {
164910
+ if (node.typeArguments) {
164716
164911
  parts.push({ text: "<" });
164717
- visitDisplayPartList(importType.typeArguments, ", ");
164912
+ visitDisplayPartList(node.typeArguments, ", ");
164718
164913
  parts.push({ text: ">" });
164719
164914
  }
164720
164915
  break;
164721
164916
  case 171 /* PropertySignature */:
164722
- const propertySignature = node;
164723
- if (propertySignature.modifiers) {
164724
- visitDisplayPartList(propertySignature.modifiers, " ");
164917
+ Debug.assertNode(node, isPropertySignature);
164918
+ if ((_a = node.modifiers) == null ? void 0 : _a.length) {
164919
+ visitDisplayPartList(node.modifiers, " ");
164920
+ parts.push({ text: " " });
164921
+ }
164922
+ visitForDisplayParts(node.name);
164923
+ if (node.questionToken) {
164924
+ parts.push({ text: "?" });
164925
+ }
164926
+ if (node.type) {
164927
+ parts.push({ text: ": " });
164928
+ visitForDisplayParts(node.type);
164725
164929
  }
164726
- visitForDisplayParts(propertySignature.name);
164727
- if (propertySignature.questionToken) {
164930
+ break;
164931
+ case 173 /* MethodSignature */:
164932
+ Debug.assertNode(node, isMethodSignature);
164933
+ if ((_b = node.modifiers) == null ? void 0 : _b.length) {
164934
+ visitDisplayPartList(node.modifiers, " ");
164935
+ parts.push({ text: " " });
164936
+ }
164937
+ visitForDisplayParts(node.name);
164938
+ if (node.questionToken) {
164728
164939
  parts.push({ text: "?" });
164729
164940
  }
164730
- if (propertySignature.type) {
164941
+ visitParametersAndTypeParameters(node);
164942
+ if (node.type) {
164731
164943
  parts.push({ text: ": " });
164732
- visitForDisplayParts(propertySignature.type);
164944
+ visitForDisplayParts(node.type);
164733
164945
  }
164734
164946
  break;
164947
+ case 179 /* CallSignature */:
164948
+ Debug.assertNode(node, isCallSignatureDeclaration);
164949
+ visitParametersAndTypeParameters(node);
164950
+ if (node.type) {
164951
+ parts.push({ text: ": " });
164952
+ visitForDisplayParts(node.type);
164953
+ }
164954
+ break;
164955
+ case 207 /* ArrayBindingPattern */:
164956
+ Debug.assertNode(node, isArrayBindingPattern);
164957
+ parts.push({ text: "[" });
164958
+ visitDisplayPartList(node.elements, ", ");
164959
+ parts.push({ text: "]" });
164960
+ break;
164961
+ case 206 /* ObjectBindingPattern */:
164962
+ Debug.assertNode(node, isObjectBindingPattern);
164963
+ parts.push({ text: "{" });
164964
+ if (node.elements.length) {
164965
+ parts.push({ text: " " });
164966
+ visitDisplayPartList(node.elements, ", ");
164967
+ parts.push({ text: " " });
164968
+ }
164969
+ parts.push({ text: "}" });
164970
+ break;
164971
+ case 208 /* BindingElement */:
164972
+ Debug.assertNode(node, isBindingElement);
164973
+ visitForDisplayParts(node.name);
164974
+ break;
164975
+ case 224 /* PrefixUnaryExpression */:
164976
+ Debug.assertNode(node, isPrefixUnaryExpression);
164977
+ parts.push({ text: tokenToString(node.operator) });
164978
+ visitForDisplayParts(node.operand);
164979
+ break;
164735
164980
  default:
164736
164981
  Debug.failBadSyntaxKind(node);
164737
164982
  }
164738
164983
  }
164984
+ function visitParametersAndTypeParameters(signatureDeclaration) {
164985
+ if (signatureDeclaration.typeParameters) {
164986
+ parts.push({ text: "<" });
164987
+ visitDisplayPartList(signatureDeclaration.typeParameters, ", ");
164988
+ parts.push({ text: ">" });
164989
+ }
164990
+ parts.push({ text: "(" });
164991
+ visitDisplayPartList(signatureDeclaration.parameters, ", ");
164992
+ parts.push({ text: ")" });
164993
+ }
164739
164994
  function visitDisplayPartList(nodes, separator) {
164740
164995
  nodes.forEach((node, index) => {
164741
164996
  if (index > 0) {
@@ -169618,7 +169873,7 @@ ${options.prefix}` : "\n" : options.prefix
169618
169873
  const typeNames = [80 /* Identifier */, ...typeKeywords];
169619
169874
  const functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments;
169620
169875
  const typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([80 /* Identifier */, 3 /* MultiLineCommentTrivia */, 86 /* ClassKeyword */, 95 /* ExportKeyword */, 102 /* ImportKeyword */]);
169621
- const controlOpenBraceLeftTokenRange = tokenRangeFrom([22 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 92 /* DoKeyword */, 113 /* TryKeyword */, 98 /* FinallyKeyword */, 93 /* ElseKeyword */]);
169876
+ const controlOpenBraceLeftTokenRange = tokenRangeFrom([22 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 92 /* DoKeyword */, 113 /* TryKeyword */, 98 /* FinallyKeyword */, 93 /* ElseKeyword */, 85 /* CatchKeyword */]);
169622
169877
  const highPriorityCommonRules = [
169623
169878
  // Leave comments alone
169624
169879
  rule("IgnoreBeforeComment", anyToken, comments, anyContext, 1 /* StopProcessingSpaceActions */),
@@ -172151,9 +172406,9 @@ ${options.prefix}` : "\n" : options.prefix
172151
172406
  init_ts5();
172152
172407
  init_deprecate();
172153
172408
  addObjectAllocatorPatcher((objectAllocator2) => {
172154
- const Identifier78 = objectAllocator2.getIdentifierConstructor();
172155
- if (!hasProperty(Identifier78.prototype, "originalKeywordKind")) {
172156
- Object.defineProperty(Identifier78.prototype, "originalKeywordKind", {
172409
+ const Identifier79 = objectAllocator2.getIdentifierConstructor();
172410
+ if (!hasProperty(Identifier79.prototype, "originalKeywordKind")) {
172411
+ Object.defineProperty(Identifier79.prototype, "originalKeywordKind", {
172157
172412
  get: deprecate(function() {
172158
172413
  return identifierToKeywordKind(this);
172159
172414
  }, {
@@ -172165,8 +172420,8 @@ ${options.prefix}` : "\n" : options.prefix
172165
172420
  })
172166
172421
  });
172167
172422
  }
172168
- if (!hasProperty(Identifier78.prototype, "isInJSDocNamespace")) {
172169
- Object.defineProperty(Identifier78.prototype, "isInJSDocNamespace", {
172423
+ if (!hasProperty(Identifier79.prototype, "isInJSDocNamespace")) {
172424
+ Object.defineProperty(Identifier79.prototype, "isInJSDocNamespace", {
172170
172425
  get: deprecate(function() {
172171
172426
  return this.flags & 4096 /* IdentifierIsInJSDocNamespace */ ? true : void 0;
172172
172427
  }, {
@@ -185415,6 +185670,8 @@ ${e.message}`;
185415
185670
  isSignedNumericLiteral: () => isSignedNumericLiteral,
185416
185671
  isSimpleCopiableExpression: () => isSimpleCopiableExpression,
185417
185672
  isSimpleInlineableExpression: () => isSimpleInlineableExpression,
185673
+ isSimpleParameter: () => isSimpleParameter,
185674
+ isSimpleParameterList: () => isSimpleParameterList,
185418
185675
  isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
185419
185676
  isSourceFile: () => isSourceFile,
185420
185677
  isSourceFileFromLibrary: () => isSourceFileFromLibrary,
@@ -187823,6 +188080,8 @@ ${e.message}`;
187823
188080
  isSignedNumericLiteral: () => isSignedNumericLiteral,
187824
188081
  isSimpleCopiableExpression: () => isSimpleCopiableExpression,
187825
188082
  isSimpleInlineableExpression: () => isSimpleInlineableExpression,
188083
+ isSimpleParameter: () => isSimpleParameter,
188084
+ isSimpleParameterList: () => isSimpleParameterList,
187826
188085
  isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
187827
188086
  isSourceFile: () => isSourceFile,
187828
188087
  isSourceFileFromLibrary: () => isSourceFileFromLibrary,