@typescript-deploys/pr-build 5.2.0-pr-54507-7 → 5.2.0-pr-54546-4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsserver.js CHANGED
@@ -919,8 +919,11 @@ __export(server_exports, {
919
919
  getOriginalNodeId: () => getOriginalNodeId,
920
920
  getOriginalSourceFile: () => getOriginalSourceFile,
921
921
  getOutputDeclarationFileName: () => getOutputDeclarationFileName,
922
+ getOutputDeclarationFileNameWithoutConfigFile: () => getOutputDeclarationFileNameWithoutConfigFile,
922
923
  getOutputExtension: () => getOutputExtension,
923
924
  getOutputFileNames: () => getOutputFileNames,
925
+ getOutputJSFileName: () => getOutputJSFileName,
926
+ getOutputJSFileNameWithoutConfigFile: () => getOutputJSFileNameWithoutConfigFile,
924
927
  getOutputPathsFor: () => getOutputPathsFor,
925
928
  getOutputPathsForBundle: () => getOutputPathsForBundle,
926
929
  getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
@@ -2304,7 +2307,7 @@ module.exports = __toCommonJS(server_exports);
2304
2307
 
2305
2308
  // src/compiler/corePublic.ts
2306
2309
  var versionMajorMinor = "5.2";
2307
- var version = `${versionMajorMinor}.0-insiders.20230602`;
2310
+ var version = `${versionMajorMinor}.0-insiders.20230605`;
2308
2311
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2309
2312
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2310
2313
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -9646,6 +9649,7 @@ var Diagnostics = {
9646
9649
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, 1 /* Error */, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
9647
9650
  Add_extends_constraint: diag(2211, 3 /* Message */, "Add_extends_constraint_2211", "Add `extends` constraint."),
9648
9651
  Add_extends_constraint_to_all_type_parameters: diag(2212, 3 /* Message */, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
9652
+ The_project_root_is_ambiguous_but_is_required_to_determine_the_module_format_of_output_js_files_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2213, 1 /* Error */, "The_project_root_is_ambiguous_but_is_required_to_determine_the_module_format_of_output_js_files_Supp_2213", "The project root is ambiguous, but is required to determine the module format of output '.js' files. Supply the `rootDir` compiler option to disambiguate."),
9649
9653
  Duplicate_identifier_0: diag(2300, 1 /* Error */, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
9650
9654
  Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, 1 /* Error */, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
9651
9655
  Static_members_cannot_reference_class_type_parameters: diag(2302, 1 /* Error */, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -47309,10 +47313,11 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
47309
47313
  CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
47310
47314
  CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
47311
47315
  CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
47312
- CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
47313
- CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
47314
- CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
47315
- CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
47316
+ CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
47317
+ CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
47318
+ CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
47319
+ CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
47320
+ CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
47316
47321
  return CheckMode3;
47317
47322
  })(CheckMode || {});
47318
47323
  var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
@@ -47592,9 +47597,9 @@ function createTypeChecker(host) {
47592
47597
  candidatesOutArray,
47593
47598
  /*argumentCount*/
47594
47599
  void 0,
47595
- 32 /* IsForStringLiteralArgumentCompletions */
47600
+ 64 /* IsForStringLiteralArgumentCompletions */
47596
47601
  )),
47597
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
47602
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
47598
47603
  getExpandedParameters,
47599
47604
  hasEffectiveRestParameter,
47600
47605
  containsArgumentsReference,
@@ -55549,7 +55554,7 @@ function createTypeChecker(host) {
55549
55554
  return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
55550
55555
  }
55551
55556
  function getTypeForBindingElement(declaration) {
55552
- const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
55557
+ const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
55553
55558
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
55554
55559
  return parentType && getBindingElementTypeFromParentType(declaration, parentType);
55555
55560
  }
@@ -70449,7 +70454,7 @@ function createTypeChecker(host) {
70449
70454
  return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
70450
70455
  }
70451
70456
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
70452
- const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 64 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
70457
+ const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 128 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
70453
70458
  node,
70454
70459
  /*contextFlags*/
70455
70460
  void 0
@@ -71206,7 +71211,7 @@ function createTypeChecker(host) {
71206
71211
  function getContextualTypeForBindingElement(declaration, contextFlags) {
71207
71212
  const parent2 = declaration.parent.parent;
71208
71213
  const name = declaration.propertyName || declaration.name;
71209
- const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
71214
+ const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
71210
71215
  if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
71211
71216
  return void 0;
71212
71217
  if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
@@ -72255,7 +72260,9 @@ function createTypeChecker(host) {
72255
72260
  elementTypes.push(undefinedOrMissingType);
72256
72261
  elementFlags.push(2 /* Optional */);
72257
72262
  } else {
72258
- const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
72263
+ const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
72264
+ const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
72265
+ const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
72259
72266
  elementTypes.push(addOptionality(
72260
72267
  type,
72261
72268
  /*isProperty*/
@@ -72263,7 +72270,7 @@ function createTypeChecker(host) {
72263
72270
  hasOmittedExpression
72264
72271
  ));
72265
72272
  elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
72266
- if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
72273
+ if (shouldAddAsIntraExpressionInferenceSite) {
72267
72274
  const inferenceContext = getInferenceContext(node);
72268
72275
  Debug.assert(inferenceContext);
72269
72276
  addIntraExpressionInferenceSite(inferenceContext, e, type);
@@ -72404,11 +72411,13 @@ function createTypeChecker(host) {
72404
72411
  let member = getSymbolOfDeclaration(memberDecl);
72405
72412
  const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
72406
72413
  if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
72407
- let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : (
72414
+ const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
72415
+ const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
72416
+ let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
72408
72417
  // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
72409
72418
  // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
72410
72419
  // we don't want to say "could not find 'a'".
72411
- memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode)
72420
+ memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
72412
72421
  );
72413
72422
  if (isInJavascript) {
72414
72423
  const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -72452,7 +72461,7 @@ function createTypeChecker(host) {
72452
72461
  prop.links.target = member;
72453
72462
  member = prop;
72454
72463
  allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
72455
- if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
72464
+ if (shouldAddAsIntraExpressionInferenceSite) {
72456
72465
  const inferenceContext = getInferenceContext(node);
72457
72466
  Debug.assert(inferenceContext);
72458
72467
  const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
@@ -72625,7 +72634,9 @@ function createTypeChecker(host) {
72625
72634
  for (const attributeDecl of attributes.properties) {
72626
72635
  const member = attributeDecl.symbol;
72627
72636
  if (isJsxAttribute(attributeDecl)) {
72628
- const exprType = checkJsxAttribute(attributeDecl, checkMode);
72637
+ const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
72638
+ const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
72639
+ const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
72629
72640
  objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
72630
72641
  const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
72631
72642
  attributeSymbol.declarations = member.declarations;
@@ -72646,7 +72657,7 @@ function createTypeChecker(host) {
72646
72657
  addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
72647
72658
  }
72648
72659
  }
72649
- if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
72660
+ if (shouldAddAsIntraExpressionInferenceSite) {
72650
72661
  const inferenceContext = getInferenceContext(attributes);
72651
72662
  Debug.assert(inferenceContext);
72652
72663
  const inferenceNode = attributeDecl.initializer.expression;
@@ -74264,7 +74275,7 @@ function createTypeChecker(host) {
74264
74275
  }
74265
74276
  for (let i = 0; i < argCount; i++) {
74266
74277
  const arg = args[i];
74267
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
74278
+ if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
74268
74279
  const paramType = getTypeAtPosition(signature, i);
74269
74280
  if (couldContainTypeVariables(paramType)) {
74270
74281
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -74877,12 +74888,12 @@ function createTypeChecker(host) {
74877
74888
  const args = getEffectiveCallArguments(node);
74878
74889
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
74879
74890
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
74880
- argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
74891
+ argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
74881
74892
  let candidatesForArgumentError;
74882
74893
  let candidateForArgumentArityError;
74883
74894
  let candidateForTypeArgumentError;
74884
74895
  let result;
74885
- const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
74896
+ const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
74886
74897
  if (candidates.length > 1) {
74887
74898
  result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
74888
74899
  }
@@ -75101,7 +75112,7 @@ function createTypeChecker(host) {
75101
75112
  continue;
75102
75113
  }
75103
75114
  if (argCheckMode) {
75104
- argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
75115
+ argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
75105
75116
  if (inferenceContext) {
75106
75117
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
75107
75118
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -78179,7 +78190,7 @@ function createTypeChecker(host) {
78179
78190
  case 36 /* ExclamationEqualsToken */:
78180
78191
  case 37 /* EqualsEqualsEqualsToken */:
78181
78192
  case 38 /* ExclamationEqualsEqualsToken */:
78182
- if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
78193
+ if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
78183
78194
  if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
78184
78195
  const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
78185
78196
  error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
@@ -78838,7 +78849,7 @@ function createTypeChecker(host) {
78838
78849
  }
78839
78850
  }
78840
78851
  const startInvocationCount = flowInvocationCount;
78841
- const type = checkExpression(node, 128 /* TypeOnly */);
78852
+ const type = checkExpression(node, 256 /* TypeOnly */);
78842
78853
  if (flowInvocationCount !== startInvocationCount) {
78843
78854
  const cache = flowTypeCache || (flowTypeCache = []);
78844
78855
  cache[getNodeId(node)] = type;
@@ -81309,7 +81320,7 @@ function createTypeChecker(host) {
81309
81320
  checkComputedPropertyName(node.propertyName);
81310
81321
  }
81311
81322
  const parent2 = node.parent.parent;
81312
- const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
81323
+ const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
81313
81324
  const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
81314
81325
  const name = node.propertyName || node.name;
81315
81326
  if (parentType && !isBindingPattern(name)) {
@@ -111976,6 +111987,15 @@ function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, get
111976
111987
  getDeclarationEmitExtensionForPath(inputFileName)
111977
111988
  );
111978
111989
  }
111990
+ function getOutputDeclarationFileNameWithoutConfigFile(inputFileName, options, ignoreCase, currentDirectory, getCommonSourceDirectory2) {
111991
+ const directory = options.declarationDir || options.outDir ? getNormalizedAbsolutePath(options.declarationDir || options.outDir, currentDirectory) : void 0;
111992
+ const outputPathWithoutChangedExtension = directory ? resolvePath(directory, getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)) : inputFileName;
111993
+ const outputFileName = changeExtension(
111994
+ outputPathWithoutChangedExtension,
111995
+ getDeclarationEmitExtensionForPath(inputFileName)
111996
+ );
111997
+ return outputFileName;
111998
+ }
111979
111999
  function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) {
111980
112000
  if (configFile.options.emitDeclarationOnly)
111981
112001
  return void 0;
@@ -111986,6 +112006,18 @@ function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSou
111986
112006
  );
111987
112007
  return !isJsonFile || comparePaths(inputFileName, outputFileName, Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
111988
112008
  }
112009
+ function getOutputJSFileNameWithoutConfigFile(inputFileName, options, ignoreCase, currentDirectory, getCommonSourceDirectory2) {
112010
+ if (options.emitDeclarationOnly)
112011
+ return void 0;
112012
+ const isJsonFile = fileExtensionIs(inputFileName, ".json" /* Json */);
112013
+ const outDir = options.outDir ? getNormalizedAbsolutePath(options.outDir, currentDirectory) : void 0;
112014
+ const outputPathWithoutChangedExtension = outDir ? resolvePath(outDir, getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)) : inputFileName;
112015
+ const outputFileName = changeExtension(
112016
+ outputPathWithoutChangedExtension,
112017
+ getOutputExtension(inputFileName, options)
112018
+ );
112019
+ return !isJsonFile || !options.configFilePath || comparePaths(inputFileName, outputFileName, options.configFilePath, ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
112020
+ }
111989
112021
  function createAddOutput() {
111990
112022
  let outputs;
111991
112023
  return { addOutput, getOutputs };
@@ -118526,6 +118558,15 @@ function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host,
118526
118558
  return { impliedNodeFormat, packageJsonLocations, packageJsonScope };
118527
118559
  }
118528
118560
  }
118561
+ function moduleFormatNeedsPackageJsonLookup(fileName, options) {
118562
+ switch (getEmitModuleResolutionKind(options)) {
118563
+ case 3 /* Node16 */:
118564
+ case 99 /* NodeNext */:
118565
+ return fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]);
118566
+ default:
118567
+ return false;
118568
+ }
118569
+ }
118529
118570
  var plainJSErrors = /* @__PURE__ */ new Set([
118530
118571
  // binder errors
118531
118572
  Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
@@ -118646,6 +118687,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118646
118687
  let files;
118647
118688
  let symlinks;
118648
118689
  let commonSourceDirectory;
118690
+ let assumedCommonSourceDirectory;
118649
118691
  let typeChecker;
118650
118692
  let classifiableNames;
118651
118693
  const ambientModuleNameToUnmodifiedFileName = /* @__PURE__ */ new Map();
@@ -119137,6 +119179,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119137
119179
  }
119138
119180
  return commonSourceDirectory;
119139
119181
  }
119182
+ function getAssumedCommonSourceDirectory() {
119183
+ return commonSourceDirectory ?? (assumedCommonSourceDirectory ?? (assumedCommonSourceDirectory = getCommonSourceDirectory(options, () => rootNames, host.getCurrentDirectory(), getCanonicalFileName)));
119184
+ }
119140
119185
  function getClassifiableNames() {
119141
119186
  var _a2;
119142
119187
  if (!classifiableNames) {
@@ -119360,7 +119405,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119360
119405
  })(SeenPackageName || (SeenPackageName = {}));
119361
119406
  const seenPackageNames = /* @__PURE__ */ new Map();
119362
119407
  for (const oldSourceFile of oldSourceFiles) {
119363
- const sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options);
119408
+ const sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName);
119364
119409
  let newSourceFile = host.getSourceFileByPath ? host.getSourceFileByPath(
119365
119410
  oldSourceFile.fileName,
119366
119411
  oldSourceFile.resolvedPath,
@@ -120322,10 +120367,48 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120322
120367
  (_b2 = tracing) == null ? void 0 : _b2.pop();
120323
120368
  return result;
120324
120369
  }
120325
- function getCreateSourceFileOptions(fileName, moduleResolutionCache2, host2, options2) {
120326
- const result = getImpliedNodeFormatForFileWorker(getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache2 == null ? void 0 : moduleResolutionCache2.getPackageJsonInfoCache(), host2, options2);
120327
- const languageVersion = getEmitScriptTarget(options2);
120328
- const setExternalModuleIndicator2 = getSetExternalModuleIndicator(options2);
120370
+ function getImpliedNodeFormatForFile2(fileName) {
120371
+ let fileNameForModuleFormatDetection = getNormalizedAbsolutePath(fileName, currentDirectory);
120372
+ if (moduleFormatNeedsPackageJsonLookup(fileName, options)) {
120373
+ const projectReference = getResolvedProjectReferenceToRedirect(fileName);
120374
+ if (projectReference) {
120375
+ Debug.assert(useSourceOfProjectReferenceRedirect);
120376
+ fileNameForModuleFormatDetection = getOutputDeclarationFileName(
120377
+ fileNameForModuleFormatDetection,
120378
+ projectReference.commandLine,
120379
+ !host.useCaseSensitiveFileNames()
120380
+ ) || getOutputJSFileName(
120381
+ fileNameForModuleFormatDetection,
120382
+ projectReference.commandLine,
120383
+ !host.useCaseSensitiveFileNames()
120384
+ ) || fileNameForModuleFormatDetection;
120385
+ } else {
120386
+ fileNameForModuleFormatDetection = getOutputDeclarationFileNameWithoutConfigFile(
120387
+ fileNameForModuleFormatDetection,
120388
+ options,
120389
+ !host.useCaseSensitiveFileNames(),
120390
+ currentDirectory,
120391
+ getAssumedCommonSourceDirectory
120392
+ ) || getOutputJSFileNameWithoutConfigFile(
120393
+ fileNameForModuleFormatDetection,
120394
+ options,
120395
+ !host.useCaseSensitiveFileNames(),
120396
+ currentDirectory,
120397
+ getAssumedCommonSourceDirectory
120398
+ ) || fileNameForModuleFormatDetection;
120399
+ }
120400
+ }
120401
+ return getImpliedNodeFormatForFileWorker(
120402
+ fileNameForModuleFormatDetection,
120403
+ moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(),
120404
+ host,
120405
+ options
120406
+ );
120407
+ }
120408
+ function getCreateSourceFileOptions(fileName) {
120409
+ const result = getImpliedNodeFormatForFile2(fileName);
120410
+ const languageVersion = getEmitScriptTarget(options);
120411
+ const setExternalModuleIndicator2 = getSetExternalModuleIndicator(options);
120329
120412
  return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 };
120330
120413
  }
120331
120414
  function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
@@ -120397,7 +120480,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120397
120480
  redirectedPath = toPath3(redirect);
120398
120481
  }
120399
120482
  }
120400
- const sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
120483
+ const sourceFileOptions = getCreateSourceFileOptions(fileName);
120401
120484
  const file = host.getSourceFile(
120402
120485
  fileName,
120403
120486
  sourceFileOptions,
@@ -121020,6 +121103,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121020
121103
  createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
121021
121104
  }
121022
121105
  }
121106
+ if (assumedCommonSourceDirectory && assumedCommonSourceDirectory !== getCommonSourceDirectory2()) {
121107
+ programDiagnostics.add(createCompilerDiagnostic(Diagnostics.The_project_root_is_ambiguous_but_is_required_to_determine_the_module_format_of_output_js_files_Supply_the_rootDir_compiler_option_to_disambiguate));
121108
+ }
121023
121109
  if (options.useDefineForClassFields && languageVersion === 0 /* ES3 */) {
121024
121110
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_when_option_target_is_ES3, "useDefineForClassFields");
121025
121111
  }
@@ -162744,13 +162830,29 @@ function provideInlayHints(context) {
162744
162830
  if (!signature || !candidates.length) {
162745
162831
  return;
162746
162832
  }
162747
- for (let i = 0; i < args.length; ++i) {
162748
- const originalArg = args[i];
162833
+ let signatureParamPos = 0;
162834
+ for (const originalArg of args) {
162749
162835
  const arg = skipParentheses(originalArg);
162750
162836
  if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
162751
162837
  continue;
162752
162838
  }
162753
- const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, i);
162839
+ let spreadArgs = 0;
162840
+ if (isSpreadElement(arg)) {
162841
+ const spreadType = checker.getTypeAtLocation(arg.expression);
162842
+ if (checker.isTupleType(spreadType)) {
162843
+ const { elementFlags, fixedLength } = spreadType.target;
162844
+ if (fixedLength === 0) {
162845
+ continue;
162846
+ }
162847
+ const firstOptionalIndex = findIndex(elementFlags, (f) => !(f & 1 /* Required */));
162848
+ const requiredArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
162849
+ if (requiredArgs > 0) {
162850
+ spreadArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
162851
+ }
162852
+ }
162853
+ }
162854
+ const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, signatureParamPos);
162855
+ signatureParamPos = signatureParamPos + (spreadArgs || 1);
162754
162856
  if (identifierNameInfo) {
162755
162857
  const [parameterName, isFirstVariadicArgument] = identifierNameInfo;
162756
162858
  const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
@@ -170784,8 +170886,11 @@ __export(ts_exports2, {
170784
170886
  getOriginalNodeId: () => getOriginalNodeId,
170785
170887
  getOriginalSourceFile: () => getOriginalSourceFile,
170786
170888
  getOutputDeclarationFileName: () => getOutputDeclarationFileName,
170889
+ getOutputDeclarationFileNameWithoutConfigFile: () => getOutputDeclarationFileNameWithoutConfigFile,
170787
170890
  getOutputExtension: () => getOutputExtension,
170788
170891
  getOutputFileNames: () => getOutputFileNames,
170892
+ getOutputJSFileName: () => getOutputJSFileName,
170893
+ getOutputJSFileNameWithoutConfigFile: () => getOutputJSFileNameWithoutConfigFile,
170789
170894
  getOutputPathsFor: () => getOutputPathsFor,
170790
170895
  getOutputPathsForBundle: () => getOutputPathsForBundle,
170791
170896
  getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
@@ -185257,8 +185362,11 @@ start(initializeNodeSystem(), require("os").platform());
185257
185362
  getOriginalNodeId,
185258
185363
  getOriginalSourceFile,
185259
185364
  getOutputDeclarationFileName,
185365
+ getOutputDeclarationFileNameWithoutConfigFile,
185260
185366
  getOutputExtension,
185261
185367
  getOutputFileNames,
185368
+ getOutputJSFileName,
185369
+ getOutputJSFileNameWithoutConfigFile,
185262
185370
  getOutputPathsFor,
185263
185371
  getOutputPathsForBundle,
185264
185372
  getOwnEmitOutputFilePath,