@typescript-deploys/pr-build 5.2.0-pr-55028-5 → 5.2.0-pr-52095-16

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.
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.2";
38
- version = `${versionMajorMinor}.0-insiders.20230720`;
38
+ version = `${versionMajorMinor}.0-insiders.20230725`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -19225,6 +19225,18 @@ ${lanes.join("\n")}
19225
19225
  function intrinsicTagNameToString(node) {
19226
19226
  return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node);
19227
19227
  }
19228
+ function isTypeUsableAsPropertyName(type) {
19229
+ return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
19230
+ }
19231
+ function getPropertyNameFromType(type) {
19232
+ if (type.flags & 8192 /* UniqueESSymbol */) {
19233
+ return type.escapedName;
19234
+ }
19235
+ if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
19236
+ return escapeLeadingUnderscores("" + type.value);
19237
+ }
19238
+ return Debug.fail();
19239
+ }
19228
19240
  var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashLibReferenceRegEx, fullTripleSlashAMDReferencePathRegEx, fullTripleSlashAMDModuleRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, extensionsNotSupportingExtensionlessResolution, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
19229
19241
  var init_utilities = __esm({
19230
19242
  "src/compiler/utilities.ts"() {
@@ -33182,10 +33194,14 @@ ${lanes.join("\n")}
33182
33194
  case 124 /* ProtectedKeyword */:
33183
33195
  case 125 /* PublicKeyword */:
33184
33196
  case 148 /* ReadonlyKeyword */:
33197
+ const previousToken = token();
33185
33198
  nextToken();
33186
33199
  if (scanner2.hasPrecedingLineBreak()) {
33187
33200
  return false;
33188
33201
  }
33202
+ if (previousToken === 138 /* DeclareKeyword */ && token() === 156 /* TypeKeyword */) {
33203
+ return true;
33204
+ }
33189
33205
  continue;
33190
33206
  case 162 /* GlobalKeyword */:
33191
33207
  nextToken();
@@ -33550,14 +33566,14 @@ ${lanes.join("\n")}
33550
33566
  function parseObjectBindingPattern() {
33551
33567
  const pos = getNodePos();
33552
33568
  parseExpected(19 /* OpenBraceToken */);
33553
- const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
33569
+ const elements = allowInAnd(() => parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement));
33554
33570
  parseExpected(20 /* CloseBraceToken */);
33555
33571
  return finishNode(factory2.createObjectBindingPattern(elements), pos);
33556
33572
  }
33557
33573
  function parseArrayBindingPattern() {
33558
33574
  const pos = getNodePos();
33559
33575
  parseExpected(23 /* OpenBracketToken */);
33560
- const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
33576
+ const elements = allowInAnd(() => parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement));
33561
33577
  parseExpected(24 /* CloseBracketToken */);
33562
33578
  return finishNode(factory2.createArrayBindingPattern(elements), pos);
33563
33579
  }
@@ -34075,6 +34091,9 @@ ${lanes.join("\n")}
34075
34091
  }
34076
34092
  function parseTypeAliasDeclaration(pos, hasJSDoc, modifiers) {
34077
34093
  parseExpected(156 /* TypeKeyword */);
34094
+ if (scanner2.hasPrecedingLineBreak()) {
34095
+ parseErrorAtCurrentToken(Diagnostics.Line_break_not_permitted_here);
34096
+ }
34078
34097
  const name = parseIdentifier();
34079
34098
  const typeParameters = parseTypeParameters();
34080
34099
  parseExpected(64 /* EqualsToken */);
@@ -35858,7 +35877,7 @@ ${lanes.join("\n")}
35858
35877
  })(IncrementalParser || (IncrementalParser = {}));
35859
35878
  namedArgRegExCache = /* @__PURE__ */ new Map();
35860
35879
  tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im;
35861
- singleLinePragmaRegEx = /^\/\/\/?\s*@(\S+)\s*(.*)\s*$/im;
35880
+ singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)\s*$/im;
35862
35881
  }
35863
35882
  });
35864
35883
 
@@ -41731,6 +41750,9 @@ ${lanes.join("\n")}
41731
41750
  if (found === 1 /* Instantiated */) {
41732
41751
  return found;
41733
41752
  }
41753
+ if (statement.kind === 271 /* ImportEqualsDeclaration */) {
41754
+ found = 1 /* Instantiated */;
41755
+ }
41734
41756
  }
41735
41757
  }
41736
41758
  if (found !== void 0) {
@@ -45585,7 +45607,7 @@ ${lanes.join("\n")}
45585
45607
  return node ? getTypeFromTypeNode(node) : errorType;
45586
45608
  },
45587
45609
  getParameterType: getTypeAtPosition,
45588
- getParameterIdentifierNameAtPosition,
45610
+ getParameterIdentifierInfoAtPosition,
45589
45611
  getPromisedTypeOfPromise,
45590
45612
  getAwaitedType: (type) => getAwaitedType(type),
45591
45613
  getReturnTypeOfSignature,
@@ -46849,7 +46871,7 @@ ${lanes.join("\n")}
46849
46871
  false
46850
46872
  );
46851
46873
  } else if (isParameterPropertyDeclaration(declaration, declaration.parent)) {
46852
- return !(useDefineForClassFields && getContainingClass(declaration) === getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration));
46874
+ return !(getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ && useDefineForClassFields && getContainingClass(declaration) === getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration));
46853
46875
  }
46854
46876
  return true;
46855
46877
  }
@@ -46863,7 +46885,7 @@ ${lanes.join("\n")}
46863
46885
  return true;
46864
46886
  }
46865
46887
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
46866
- if (useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
46888
+ if (getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */ && useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
46867
46889
  return !isPropertyImmediatelyReferencedWithinDeclaration(
46868
46890
  declaration,
46869
46891
  usage,
@@ -46987,7 +47009,7 @@ ${lanes.join("\n")}
46987
47009
  return requiresScopeChangeWorker(node.name);
46988
47010
  case 172 /* PropertyDeclaration */:
46989
47011
  if (hasStaticModifier(node)) {
46990
- return !useDefineForClassFields;
47012
+ return target < 99 /* ESNext */ || !useDefineForClassFields;
46991
47013
  }
46992
47014
  return requiresScopeChangeWorker(node.name);
46993
47015
  default:
@@ -47258,7 +47280,7 @@ ${lanes.join("\n")}
47258
47280
  }
47259
47281
  }
47260
47282
  function checkAndReportErrorForInvalidInitializer() {
47261
- if (propertyWithInvalidInitializer && !useDefineForClassFields) {
47283
+ if (propertyWithInvalidInitializer && !(useDefineForClassFields && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */)) {
47262
47284
  error2(
47263
47285
  errorLocation,
47264
47286
  errorLocation && propertyWithInvalidInitializer.type && textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,
@@ -48642,7 +48664,7 @@ ${lanes.join("\n")}
48642
48664
  return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
48643
48665
  }
48644
48666
  function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
48645
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
48667
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
48646
48668
  if (startsWith(moduleReference, "@types/")) {
48647
48669
  const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
48648
48670
  const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
@@ -48677,8 +48699,11 @@ ${lanes.join("\n")}
48677
48699
  );
48678
48700
  }
48679
48701
  } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
48680
- const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
48681
- error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
48702
+ const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
48703
+ if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
48704
+ const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
48705
+ error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
48706
+ }
48682
48707
  }
48683
48708
  if (sourceFile.symbol) {
48684
48709
  if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
@@ -48695,7 +48720,7 @@ ${lanes.join("\n")}
48695
48720
  if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
48696
48721
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
48697
48722
  const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
48698
- const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
48723
+ const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_i = overrideClauseHost.assertions) == null ? void 0 : _i.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
48699
48724
  if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
48700
48725
  if (findAncestor(location, isImportEqualsDeclaration)) {
48701
48726
  error2(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
@@ -48798,7 +48823,7 @@ ${lanes.join("\n")}
48798
48823
  error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
48799
48824
  } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
48800
48825
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
48801
- const suggestedExt = (_i = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _i[1];
48826
+ const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
48802
48827
  if (suggestedExt) {
48803
48828
  error2(
48804
48829
  errorNode,
@@ -50234,11 +50259,13 @@ ${lanes.join("\n")}
50234
50259
  return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
50235
50260
  }
50236
50261
  function createMappedTypeNodeFromType(type2) {
50262
+ var _a2;
50237
50263
  Debug.assert(!!(type2.flags & 524288 /* Object */));
50238
50264
  const readonlyToken = type2.declaration.readonlyToken ? factory.createToken(type2.declaration.readonlyToken.kind) : void 0;
50239
50265
  const questionToken = type2.declaration.questionToken ? factory.createToken(type2.declaration.questionToken.kind) : void 0;
50240
50266
  let appropriateConstraintTypeNode;
50241
50267
  let newTypeVariable;
50268
+ const needsModifierPreservingWrapper = !isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 2 /* Unknown */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && !(getConstraintTypeFromMappedType(type2).flags & 262144 /* TypeParameter */ && ((_a2 = getConstraintOfTypeParameter(getConstraintTypeFromMappedType(type2))) == null ? void 0 : _a2.flags) & 4194304 /* Index */);
50242
50269
  if (isMappedTypeWithKeyofConstraintDeclaration(type2)) {
50243
50270
  if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
50244
50271
  const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
@@ -50246,6 +50273,11 @@ ${lanes.join("\n")}
50246
50273
  newTypeVariable = factory.createTypeReferenceNode(name);
50247
50274
  }
50248
50275
  appropriateConstraintTypeNode = factory.createTypeOperatorNode(143 /* KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context));
50276
+ } else if (needsModifierPreservingWrapper) {
50277
+ const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
50278
+ const name = typeParameterToName(newParam, context);
50279
+ newTypeVariable = factory.createTypeReferenceNode(name);
50280
+ appropriateConstraintTypeNode = newTypeVariable;
50249
50281
  } else {
50250
50282
  appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context);
50251
50283
  }
@@ -50276,6 +50308,18 @@ ${lanes.join("\n")}
50276
50308
  result,
50277
50309
  factory.createKeywordTypeNode(146 /* NeverKeyword */)
50278
50310
  );
50311
+ } else if (needsModifierPreservingWrapper) {
50312
+ return factory.createConditionalTypeNode(
50313
+ typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context),
50314
+ factory.createInferTypeNode(factory.createTypeParameterDeclaration(
50315
+ /*modifiers*/
50316
+ void 0,
50317
+ factory.cloneNode(newTypeVariable.typeName),
50318
+ factory.createTypeOperatorNode(143 /* KeyOfKeyword */, typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context))
50319
+ )),
50320
+ result,
50321
+ factory.createKeywordTypeNode(146 /* NeverKeyword */)
50322
+ );
50279
50323
  }
50280
50324
  return result;
50281
50325
  }
@@ -55327,9 +55371,6 @@ ${lanes.join("\n")}
55327
55371
  }
55328
55372
  return type;
55329
55373
  }
55330
- function isTypeUsableAsPropertyName(type) {
55331
- return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
55332
- }
55333
55374
  function isLateBindableName(node) {
55334
55375
  if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
55335
55376
  return false;
@@ -55350,15 +55391,6 @@ ${lanes.join("\n")}
55350
55391
  function isNonBindableDynamicName(node) {
55351
55392
  return isDynamicName(node) && !isLateBindableName(node);
55352
55393
  }
55353
- function getPropertyNameFromType(type) {
55354
- if (type.flags & 8192 /* UniqueESSymbol */) {
55355
- return type.escapedName;
55356
- }
55357
- if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
55358
- return escapeLeadingUnderscores("" + type.value);
55359
- }
55360
- return Debug.fail();
55361
- }
55362
55394
  function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
55363
55395
  Debug.assert(!!(getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol.");
55364
55396
  symbol.flags |= symbolFlags;
@@ -56005,20 +56037,17 @@ ${lanes.join("\n")}
56005
56037
  setStructuredTypeMembers(type, members2, callSignatures, constructSignatures, indexInfos2);
56006
56038
  return;
56007
56039
  }
56008
- let members = emptySymbols;
56040
+ let members = getExportsOfSymbol(symbol);
56009
56041
  let indexInfos;
56010
- if (symbol.exports) {
56011
- members = getExportsOfSymbol(symbol);
56012
- if (symbol === globalThisSymbol) {
56013
- const varsOnly = /* @__PURE__ */ new Map();
56014
- members.forEach((p) => {
56015
- var _a;
56016
- if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) {
56017
- varsOnly.set(p.escapedName, p);
56018
- }
56019
- });
56020
- members = varsOnly;
56021
- }
56042
+ if (symbol === globalThisSymbol) {
56043
+ const varsOnly = /* @__PURE__ */ new Map();
56044
+ members.forEach((p) => {
56045
+ var _a;
56046
+ if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) {
56047
+ varsOnly.set(p.escapedName, p);
56048
+ }
56049
+ });
56050
+ members = varsOnly;
56022
56051
  }
56023
56052
  let baseConstructorIndexInfo;
56024
56053
  setStructuredTypeMembers(type, members, emptyArray, emptyArray, emptyArray);
@@ -69717,41 +69746,75 @@ ${lanes.join("\n")}
69717
69746
  return mapType(
69718
69747
  type,
69719
69748
  (t) => {
69720
- var _a;
69721
- if (isGenericMappedType(t) && !t.declaration.nameType) {
69722
- const constraint = getConstraintTypeFromMappedType(t);
69723
- const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
69724
- const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
69725
- if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
69726
- return substituteIndexedMappedType(t, propertyNameType);
69727
- }
69728
- } else if (t.flags & 3670016 /* StructuredType */) {
69729
- const prop = getPropertyOfType(t, name);
69730
- if (prop) {
69731
- return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
69732
- }
69733
- if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
69734
- const restType = getElementTypeOfSliceOfTupleType(
69735
- t,
69736
- t.target.fixedLength,
69737
- /*endSkipCount*/
69738
- 0,
69739
- /*writing*/
69740
- false,
69741
- /*noReductions*/
69742
- true
69743
- );
69744
- if (restType) {
69745
- return restType;
69749
+ if (!(t.flags & 3670016 /* StructuredType */)) {
69750
+ return void 0;
69751
+ }
69752
+ if (t.flags & 2097152 /* Intersection */) {
69753
+ const intersection = t;
69754
+ let applicableIndexedMappedTypeSubstitions;
69755
+ let concretePropertyTypes;
69756
+ let applicableIndexInfoCandidates;
69757
+ for (const t2 of intersection.types) {
69758
+ if (isGenericMappedType(t2) && !t2.declaration.nameType) {
69759
+ applicableIndexedMappedTypeSubstitions = append(applicableIndexedMappedTypeSubstitions, getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t2));
69760
+ continue;
69746
69761
  }
69762
+ const typeOfConcreteProperty = getTypeOfConcretePropertyOfContextualType(t2);
69763
+ if (typeOfConcreteProperty) {
69764
+ concretePropertyTypes = append(concretePropertyTypes, typeOfConcreteProperty);
69765
+ continue;
69766
+ }
69767
+ applicableIndexInfoCandidates = append(applicableIndexInfoCandidates, t2);
69768
+ }
69769
+ if (concretePropertyTypes) {
69770
+ return getIntersectionType(concatenate(concretePropertyTypes, applicableIndexedMappedTypeSubstitions));
69747
69771
  }
69748
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
69772
+ const types = concatenate(mapDefined(applicableIndexInfoCandidates, getTypeOfApplicableIndexInfoOfContextualType), applicableIndexedMappedTypeSubstitions);
69773
+ if (types.length > 0) {
69774
+ return getIntersectionType(types);
69775
+ }
69776
+ return void 0;
69749
69777
  }
69750
- return void 0;
69778
+ return isGenericMappedType(t) && !t.declaration.nameType ? getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) : getTypeOfConcretePropertyOfContextualType(t) || getTypeOfApplicableIndexInfoOfContextualType(t);
69751
69779
  },
69752
69780
  /*noReductions*/
69753
69781
  true
69754
69782
  );
69783
+ function getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) {
69784
+ const constraint = getConstraintTypeFromMappedType(t);
69785
+ const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
69786
+ const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
69787
+ if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
69788
+ return substituteIndexedMappedType(t, propertyNameType);
69789
+ }
69790
+ return void 0;
69791
+ }
69792
+ function getTypeOfConcretePropertyOfContextualType(t) {
69793
+ const prop = getPropertyOfType(t, name);
69794
+ if (prop) {
69795
+ return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
69796
+ }
69797
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
69798
+ const restType = getElementTypeOfSliceOfTupleType(
69799
+ t,
69800
+ t.target.fixedLength,
69801
+ /*endSkipCount*/
69802
+ 0,
69803
+ /*writing*/
69804
+ false,
69805
+ /*noReductions*/
69806
+ true
69807
+ );
69808
+ if (restType) {
69809
+ return restType;
69810
+ }
69811
+ }
69812
+ return void 0;
69813
+ }
69814
+ function getTypeOfApplicableIndexInfoOfContextualType(t) {
69815
+ var _a;
69816
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
69817
+ }
69755
69818
  }
69756
69819
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
69757
69820
  Debug.assert(isObjectLiteralMethod(node));
@@ -71836,7 +71899,7 @@ ${lanes.join("\n")}
71836
71899
  }
71837
71900
  let diagnosticMessage;
71838
71901
  const declarationName = idText(right);
71839
- if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
71902
+ if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
71840
71903
  diagnosticMessage = error2(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
71841
71904
  } else if (valueDeclaration.kind === 263 /* ClassDeclaration */ && node.parent.kind !== 183 /* TypeReference */ && !(valueDeclaration.flags & 33554432 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
71842
71905
  diagnosticMessage = error2(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
@@ -74530,7 +74593,7 @@ ${lanes.join("\n")}
74530
74593
  }
74531
74594
  return restParameter.escapedName;
74532
74595
  }
74533
- function getParameterIdentifierNameAtPosition(signature, pos) {
74596
+ function getParameterIdentifierInfoAtPosition(signature, pos) {
74534
74597
  var _a;
74535
74598
  if (((_a = signature.declaration) == null ? void 0 : _a.kind) === 324 /* JSDocFunctionType */) {
74536
74599
  return void 0;
@@ -74538,10 +74601,16 @@ ${lanes.join("\n")}
74538
74601
  const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
74539
74602
  if (pos < paramCount) {
74540
74603
  const param = signature.parameters[pos];
74541
- return isParameterDeclarationWithIdentifierName(param) ? [param.escapedName, false] : void 0;
74604
+ const paramIdent = getParameterDeclarationIdentifier(param);
74605
+ return paramIdent ? {
74606
+ parameter: paramIdent,
74607
+ parameterName: param.escapedName,
74608
+ isRestParameter: false
74609
+ } : void 0;
74542
74610
  }
74543
74611
  const restParameter = signature.parameters[paramCount] || unknownSymbol;
74544
- if (!isParameterDeclarationWithIdentifierName(restParameter)) {
74612
+ const restIdent = getParameterDeclarationIdentifier(restParameter);
74613
+ if (!restIdent) {
74545
74614
  return void 0;
74546
74615
  }
74547
74616
  const restType = getTypeOfSymbol(restParameter);
@@ -74550,18 +74619,19 @@ ${lanes.join("\n")}
74550
74619
  const index = pos - paramCount;
74551
74620
  const associatedName = associatedNames == null ? void 0 : associatedNames[index];
74552
74621
  const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken);
74553
- return associatedName ? [
74554
- getTupleElementLabel(associatedName),
74555
- isRestTupleElement
74556
- ] : void 0;
74622
+ if (associatedName) {
74623
+ Debug.assert(isIdentifier(associatedName.name));
74624
+ return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement };
74625
+ }
74626
+ return void 0;
74557
74627
  }
74558
74628
  if (pos === paramCount) {
74559
- return [restParameter.escapedName, true];
74629
+ return { parameter: restIdent, parameterName: restParameter.escapedName, isRestParameter: true };
74560
74630
  }
74561
74631
  return void 0;
74562
74632
  }
74563
- function isParameterDeclarationWithIdentifierName(symbol) {
74564
- return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name);
74633
+ function getParameterDeclarationIdentifier(symbol) {
74634
+ return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name) && symbol.valueDeclaration.name;
74565
74635
  }
74566
74636
  function isValidDeclarationForTupleLabel(d) {
74567
74637
  return d.kind === 202 /* NamedTupleMember */ || isParameter(d) && d.name && isIdentifier(d.name);
@@ -77530,7 +77600,7 @@ ${lanes.join("\n")}
77530
77600
  case "length":
77531
77601
  case "caller":
77532
77602
  case "arguments":
77533
- if (useDefineForClassFields) {
77603
+ if (compilerOptions.useDefineForClassFields) {
77534
77604
  break;
77535
77605
  }
77536
77606
  case "prototype":
@@ -77678,7 +77748,7 @@ ${lanes.join("\n")}
77678
77748
  if (classExtendsNull) {
77679
77749
  error2(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
77680
77750
  }
77681
- const superCallShouldBeRootLevel = !useDefineForClassFields && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
77751
+ const superCallShouldBeRootLevel = (getEmitScriptTarget(compilerOptions) !== 99 /* ESNext */ || !useDefineForClassFields) && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
77682
77752
  if (superCallShouldBeRootLevel) {
77683
77753
  if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
77684
77754
  error2(superCall, Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
@@ -80948,7 +81018,7 @@ ${lanes.join("\n")}
80948
81018
  node
80949
81019
  );
80950
81020
  const willTransformPrivateElementsOrClassStaticBlocks = languageVersion <= 9 /* ES2022 */;
80951
- const willTransformInitializers = !useDefineForClassFields;
81021
+ const willTransformInitializers = !useDefineForClassFields || languageVersion < 9 /* ES2022 */;
80952
81022
  if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) {
80953
81023
  for (const member of node.members) {
80954
81024
  if (willTransformStaticElementsOfDecoratedClass && classElementOrClassElementParameterIsDecorated(
@@ -125197,7 +125267,6 @@ ${lanes.join("\n")}
125197
125267
  if (hasChangedCompilerOptions) {
125198
125268
  newLine = updateNewLine();
125199
125269
  if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
125200
- debugger;
125201
125270
  resolutionCache.onChangesAffectModuleResolution();
125202
125271
  }
125203
125272
  }
@@ -134400,8 +134469,8 @@ ${lanes.join("\n")}
134400
134469
  diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import));
134401
134470
  }
134402
134471
  }
134403
- const jsdocTypedefNode = ts_codefix_exports.getJSDocTypedefNode(node);
134404
- if (jsdocTypedefNode) {
134472
+ const jsdocTypedefNodes = ts_codefix_exports.getJSDocTypedefNodes(node);
134473
+ for (const jsdocTypedefNode of jsdocTypedefNodes) {
134405
134474
  diags.push(createDiagnosticForNode(jsdocTypedefNode, Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type));
134406
134475
  }
134407
134476
  if (ts_codefix_exports.parameterShouldGetTypeFromJSDoc(node)) {
@@ -148329,23 +148398,60 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
148329
148398
  });
148330
148399
 
148331
148400
  // src/services/codefixes/convertTypedefToType.ts
148332
- function doChange12(changes, node, sourceFile) {
148333
- if (isJSDocTypedefTag(node)) {
148334
- fixSingleTypeDef(changes, node, sourceFile);
148335
- }
148336
- }
148337
- function fixSingleTypeDef(changes, typeDefNode, sourceFile) {
148338
- if (!typeDefNode)
148401
+ function doChange12(changes, node, sourceFile, newLine, fixAll = false) {
148402
+ if (!isJSDocTypedefTag(node))
148339
148403
  return;
148340
- const declaration = createDeclaration(typeDefNode);
148404
+ const declaration = createDeclaration(node);
148341
148405
  if (!declaration)
148342
148406
  return;
148343
- const comment = typeDefNode.parent;
148344
- changes.replaceNode(
148345
- sourceFile,
148346
- comment,
148347
- declaration
148407
+ const commentNode = node.parent;
148408
+ const { leftSibling, rightSibling } = getLeftAndRightSiblings(node);
148409
+ let pos = commentNode.getStart();
148410
+ let prefix = "";
148411
+ if (!leftSibling && commentNode.comment) {
148412
+ pos = findEndOfTextBetween(commentNode, commentNode.getStart(), node.getStart());
148413
+ prefix = `${newLine} */${newLine}`;
148414
+ }
148415
+ if (leftSibling) {
148416
+ if (fixAll && isJSDocTypedefTag(leftSibling)) {
148417
+ pos = node.getStart();
148418
+ prefix = "";
148419
+ } else {
148420
+ pos = findEndOfTextBetween(commentNode, leftSibling.getStart(), node.getStart());
148421
+ prefix = `${newLine} */${newLine}`;
148422
+ }
148423
+ }
148424
+ let end = commentNode.getEnd();
148425
+ let suffix = "";
148426
+ if (rightSibling) {
148427
+ if (fixAll && isJSDocTypedefTag(rightSibling)) {
148428
+ end = rightSibling.getStart();
148429
+ suffix = `${newLine}${newLine}`;
148430
+ } else {
148431
+ end = rightSibling.getStart();
148432
+ suffix = `${newLine}/**${newLine} * `;
148433
+ }
148434
+ }
148435
+ changes.replaceRange(sourceFile, { pos, end }, declaration, { prefix, suffix });
148436
+ }
148437
+ function getLeftAndRightSiblings(typedefNode) {
148438
+ const commentNode = typedefNode.parent;
148439
+ const maxChildIndex = commentNode.getChildCount() - 1;
148440
+ const currentNodeIndex = commentNode.getChildren().findIndex(
148441
+ (n) => n.getStart() === typedefNode.getStart() && n.getEnd() === typedefNode.getEnd()
148348
148442
  );
148443
+ const leftSibling = currentNodeIndex > 0 ? commentNode.getChildAt(currentNodeIndex - 1) : void 0;
148444
+ const rightSibling = currentNodeIndex < maxChildIndex ? commentNode.getChildAt(currentNodeIndex + 1) : void 0;
148445
+ return { leftSibling, rightSibling };
148446
+ }
148447
+ function findEndOfTextBetween(jsDocComment, from, to) {
148448
+ const comment = jsDocComment.getText().substring(from - jsDocComment.getStart(), to - jsDocComment.getStart());
148449
+ for (let i = comment.length; i > 0; i--) {
148450
+ if (!/[*\/\s]/g.test(comment.substring(i - 1, i))) {
148451
+ return from + i;
148452
+ }
148453
+ }
148454
+ return to;
148349
148455
  }
148350
148456
  function createDeclaration(tag) {
148351
148457
  var _a;
@@ -148366,7 +148472,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
148366
148472
  const propertySignatures = createSignatureFromTypeLiteral(typeLiteral);
148367
148473
  if (!some(propertySignatures))
148368
148474
  return;
148369
- const interfaceDeclaration = factory.createInterfaceDeclaration(
148475
+ return factory.createInterfaceDeclaration(
148370
148476
  /*modifiers*/
148371
148477
  void 0,
148372
148478
  typeName,
@@ -148376,13 +148482,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
148376
148482
  void 0,
148377
148483
  propertySignatures
148378
148484
  );
148379
- return interfaceDeclaration;
148380
148485
  }
148381
148486
  function createTypeAliasForTypeExpression(typeName, typeExpression) {
148382
148487
  const typeReference = getSynthesizedDeepClone(typeExpression.type);
148383
148488
  if (!typeReference)
148384
148489
  return;
148385
- const declaration = factory.createTypeAliasDeclaration(
148490
+ return factory.createTypeAliasDeclaration(
148386
148491
  /*modifiers*/
148387
148492
  void 0,
148388
148493
  factory.createIdentifier(typeName),
@@ -148390,7 +148495,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
148390
148495
  void 0,
148391
148496
  typeReference
148392
148497
  );
148393
- return declaration;
148394
148498
  }
148395
148499
  function createSignatureFromTypeLiteral(typeLiteral) {
148396
148500
  const propertyTags = typeLiteral.jsDocPropertyTags;
@@ -148410,30 +148514,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
148410
148514
  }
148411
148515
  if (typeReference && name) {
148412
148516
  const questionToken = isOptional ? factory.createToken(58 /* QuestionToken */) : void 0;
148413
- const prop = factory.createPropertySignature(
148517
+ return factory.createPropertySignature(
148414
148518
  /*modifiers*/
148415
148519
  void 0,
148416
148520
  name,
148417
148521
  questionToken,
148418
148522
  typeReference
148419
148523
  );
148420
- return prop;
148421
148524
  }
148422
148525
  };
148423
- const props = mapDefined(propertyTags, getSignature);
148424
- return props;
148526
+ return mapDefined(propertyTags, getSignature);
148425
148527
  }
148426
148528
  function getPropertyName(tag) {
148427
148529
  return tag.name.kind === 80 /* Identifier */ ? tag.name.text : tag.name.right.text;
148428
148530
  }
148429
- function getJSDocTypedefNode(node) {
148531
+ function getJSDocTypedefNodes(node) {
148430
148532
  if (hasJSDocNodes(node)) {
148431
- return forEach(node.jsDoc, (node2) => {
148533
+ return flatMap(node.jsDoc, (doc) => {
148432
148534
  var _a;
148433
- return (_a = node2.tags) == null ? void 0 : _a.find(isJSDocTypedefTag);
148535
+ return (_a = doc.tags) == null ? void 0 : _a.filter((tag) => isJSDocTypedefTag(tag));
148434
148536
  });
148435
148537
  }
148436
- return void 0;
148538
+ return [];
148437
148539
  }
148438
148540
  var fixId14, errorCodes15;
148439
148541
  var init_convertTypedefToType = __esm({
@@ -148447,13 +148549,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
148447
148549
  fixIds: [fixId14],
148448
148550
  errorCodes: errorCodes15,
148449
148551
  getCodeActions(context) {
148552
+ const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options);
148450
148553
  const node = getTokenAtPosition(
148451
148554
  context.sourceFile,
148452
148555
  context.span.start
148453
148556
  );
148454
148557
  if (!node)
148455
148558
  return;
148456
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, node, context.sourceFile));
148559
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, node, context.sourceFile, newLineCharacter));
148457
148560
  if (changes.length > 0) {
148458
148561
  return [
148459
148562
  createCodeFixAction(
@@ -148466,11 +148569,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
148466
148569
  ];
148467
148570
  }
148468
148571
  },
148469
- getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => {
148470
- const node = getTokenAtPosition(diag2.file, diag2.start);
148471
- if (node)
148472
- doChange12(changes, node, diag2.file);
148473
- })
148572
+ getAllCodeActions: (context) => codeFixAll(
148573
+ context,
148574
+ errorCodes15,
148575
+ (changes, diag2) => {
148576
+ const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options);
148577
+ const node = getTokenAtPosition(diag2.file, diag2.start);
148578
+ const fixAll = true;
148579
+ if (node)
148580
+ doChange12(changes, node, diag2.file, newLineCharacter, fixAll);
148581
+ }
148582
+ )
148474
148583
  });
148475
148584
  }
148476
148585
  });
@@ -149568,6 +149677,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149568
149677
  }
149569
149678
  function promoteImportClause(importClause) {
149570
149679
  changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
149680
+ if (!compilerOptions.allowImportingTsExtensions) {
149681
+ const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
149682
+ const resolvedModule = moduleSpecifier && getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier));
149683
+ if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
149684
+ const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
149685
+ changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
149686
+ }
149687
+ }
149571
149688
  if (convertExistingToTypeOnly) {
149572
149689
  const namedImports = tryCast(importClause.namedBindings, isNamedImports);
149573
149690
  if (namedImports && namedImports.elements.length > 1) {
@@ -150745,6 +150862,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150745
150862
  if (!declaration || !isCallExpression(declaration.parent) || !declaration.body)
150746
150863
  return void 0;
150747
150864
  const pos = declaration.parent.arguments.indexOf(declaration);
150865
+ if (pos === -1)
150866
+ return void 0;
150748
150867
  const type = checker.getContextualTypeForArgumentAtIndex(declaration.parent, pos);
150749
150868
  if (!type)
150750
150869
  return void 0;
@@ -154170,15 +154289,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
154170
154289
  }
154171
154290
  function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional = 3 /* All */, isAmbient = false) {
154172
154291
  const declarations = symbol.getDeclarations();
154173
- const declaration = declarations == null ? void 0 : declarations[0];
154292
+ const declaration = firstOrUndefined(declarations);
154174
154293
  const checker = context.program.getTypeChecker();
154175
154294
  const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
154176
154295
  const kind = (declaration == null ? void 0 : declaration.kind) ?? 171 /* PropertySignature */;
154177
- const declarationName = getSynthesizedDeepClone(
154178
- getNameOfDeclaration(declaration),
154179
- /*includeTrivia*/
154180
- false
154181
- );
154296
+ const declarationName = createDeclarationName(symbol, declaration);
154182
154297
  const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
154183
154298
  let modifierFlags = effectiveModifierFlags & 32 /* Static */;
154184
154299
  modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
@@ -154329,6 +154444,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
154329
154444
  false
154330
154445
  );
154331
154446
  }
154447
+ function createDeclarationName(symbol2, declaration2) {
154448
+ if (getCheckFlags(symbol2) & 262144 /* Mapped */) {
154449
+ const nameType = symbol2.links.nameType;
154450
+ if (nameType && isTypeUsableAsPropertyName(nameType)) {
154451
+ return factory.createIdentifier(unescapeLeadingUnderscores(getPropertyNameFromType(nameType)));
154452
+ }
154453
+ }
154454
+ return getSynthesizedDeepClone(
154455
+ getNameOfDeclaration(declaration2),
154456
+ /*includeTrivia*/
154457
+ false
154458
+ );
154459
+ }
154332
154460
  }
154333
154461
  function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) {
154334
154462
  const program = context.program;
@@ -155984,7 +156112,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
155984
156112
  getFixes: () => getFixes,
155985
156113
  getImportCompletionAction: () => getImportCompletionAction,
155986
156114
  getImportKind: () => getImportKind,
155987
- getJSDocTypedefNode: () => getJSDocTypedefNode,
156115
+ getJSDocTypedefNodes: () => getJSDocTypedefNodes,
155988
156116
  getNoopSymbolTrackerWithResolver: () => getNoopSymbolTrackerWithResolver,
155989
156117
  getPromoteTypeOnlyCompletionAction: () => getPromoteTypeOnlyCompletionAction,
155990
156118
  getSupportedErrorCodes: () => getSupportedErrorCodes,
@@ -163860,6 +163988,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163860
163988
  function shouldShowLiteralParameterNameHintsOnly(preferences) {
163861
163989
  return preferences.includeInlayParameterNameHints === "literals";
163862
163990
  }
163991
+ function shouldUseInteractiveInlayHints(preferences) {
163992
+ return preferences.interactiveInlayHints === true;
163993
+ }
163863
163994
  function provideInlayHints(context) {
163864
163995
  const { file, program, span, cancellationToken, preferences } = context;
163865
163996
  const sourceFileText = file.text;
@@ -163910,9 +164041,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163910
164041
  function isSignatureSupportingReturnAnnotation(node) {
163911
164042
  return isArrowFunction(node) || isFunctionExpression(node) || isFunctionDeclaration(node) || isMethodDeclaration(node) || isGetAccessorDeclaration(node);
163912
164043
  }
163913
- function addParameterHints(text, position, isFirstVariadicArgument) {
164044
+ function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile) {
164045
+ let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
164046
+ if (shouldUseInteractiveInlayHints(preferences)) {
164047
+ hintText = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
164048
+ } else {
164049
+ hintText += ":";
164050
+ }
163914
164051
  result.push({
163915
- text: `${isFirstVariadicArgument ? "..." : ""}${truncation(text, maxHintsLength)}:`,
164052
+ text: hintText,
163916
164053
  position,
163917
164054
  kind: "Parameter" /* Parameter */,
163918
164055
  whitespaceAfter: true
@@ -163920,7 +164057,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163920
164057
  }
163921
164058
  function addTypeHints(text, position) {
163922
164059
  result.push({
163923
- text: `: ${truncation(text, maxHintsLength)}`,
164060
+ text: `: ${text.length > maxTypeHintLength ? text.substr(0, maxTypeHintLength - "...".length) + "..." : text}`,
163924
164061
  position,
163925
164062
  kind: "Type" /* Type */,
163926
164063
  whitespaceBefore: true
@@ -163928,7 +164065,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163928
164065
  }
163929
164066
  function addEnumMemberValueHints(text, position) {
163930
164067
  result.push({
163931
- text: `= ${truncation(text, maxHintsLength)}`,
164068
+ text: `= ${text}`,
163932
164069
  position,
163933
164070
  kind: "Enum" /* Enum */,
163934
164071
  whitespaceBefore: true
@@ -163978,6 +164115,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163978
164115
  return;
163979
164116
  }
163980
164117
  let signatureParamPos = 0;
164118
+ const sourceFile = shouldUseInteractiveInlayHints(preferences) ? expr.getSourceFile() : void 0;
163981
164119
  for (const originalArg of args) {
163982
164120
  const arg = skipParentheses(originalArg);
163983
164121
  if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
@@ -163998,10 +164136,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163998
164136
  }
163999
164137
  }
164000
164138
  }
164001
- const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, signatureParamPos);
164139
+ const identifierInfo = checker.getParameterIdentifierInfoAtPosition(signature, signatureParamPos);
164002
164140
  signatureParamPos = signatureParamPos + (spreadArgs || 1);
164003
- if (identifierNameInfo) {
164004
- const [parameterName, isFirstVariadicArgument] = identifierNameInfo;
164141
+ if (identifierInfo) {
164142
+ const { parameter, parameterName, isRestParameter: isFirstVariadicArgument } = identifierInfo;
164005
164143
  const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
164006
164144
  if (!isParameterNameNotSameAsArgument && !isFirstVariadicArgument) {
164007
164145
  continue;
@@ -164010,7 +164148,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164010
164148
  if (leadingCommentsContainsParameterName(arg, name)) {
164011
164149
  continue;
164012
164150
  }
164013
- addParameterHints(name, originalArg.getStart(), isFirstVariadicArgument);
164151
+ addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument, sourceFile);
164014
164152
  }
164015
164153
  }
164016
164154
  }
@@ -164116,12 +164254,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164116
164254
  }
164117
164255
  return printTypeInSingleLine(signatureParamType);
164118
164256
  }
164119
- function truncation(text, maxLength2) {
164120
- if (text.length > maxLength2) {
164121
- return text.substr(0, maxLength2 - "...".length) + "...";
164122
- }
164123
- return text;
164124
- }
164125
164257
  function printTypeInSingleLine(type) {
164126
164258
  const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
164127
164259
  const printer = createPrinterWithRemoveComments();
@@ -164152,13 +164284,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164152
164284
  }
164153
164285
  return true;
164154
164286
  }
164287
+ function getNodeDisplayPart(text, node, sourceFile) {
164288
+ return {
164289
+ text,
164290
+ span: createTextSpanFromNode(node, sourceFile),
164291
+ file: sourceFile.fileName
164292
+ };
164293
+ }
164155
164294
  }
164156
- var maxHintsLength, leadingParameterNameCommentRegexFactory;
164295
+ var maxTypeHintLength, leadingParameterNameCommentRegexFactory;
164157
164296
  var init_inlayHints = __esm({
164158
164297
  "src/services/inlayHints.ts"() {
164159
164298
  "use strict";
164160
164299
  init_ts4();
164161
- maxHintsLength = 30;
164300
+ maxTypeHintLength = 30;
164162
164301
  leadingParameterNameCommentRegexFactory = (name) => {
164163
164302
  return new RegExp(`^\\s?/\\*\\*?\\s?${name}\\s?\\*\\/\\s?$`);
164164
164303
  };
@@ -166660,7 +166799,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
166660
166799
  }
166661
166800
  return modifiers.size > 0 ? arrayFrom(modifiers.values()).join(",") : "" /* none */;
166662
166801
  }
166663
- function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) {
166802
+ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias) {
166664
166803
  var _a;
166665
166804
  const displayParts = [];
166666
166805
  let documentation = [];
@@ -166669,7 +166808,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
166669
166808
  let symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */;
166670
166809
  let hasAddedSymbolInfo = false;
166671
166810
  const isThisExpression = location.kind === 110 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location);
166672
- let type;
166673
166811
  let documentationFromAlias;
166674
166812
  let tagsFromAlias;
166675
166813
  let hasMultipleSignatures = false;
@@ -166698,7 +166836,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
166698
166836
  }
166699
166837
  }
166700
166838
  let signature;
166701
- type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
166839
+ type ?? (type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location));
166702
166840
  if (location.parent && location.parent.kind === 211 /* PropertyAccessExpression */) {
166703
166841
  const right = location.parent.name;
166704
166842
  if (right === location || right && right.getFullWidth() === 0) {
@@ -166913,12 +167051,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
166913
167051
  if (declarationName && !hasAddedSymbolInfo) {
166914
167052
  const isExternalModuleDeclaration = isModuleWithStringLiteralName(resolvedNode) && hasSyntacticModifier(resolvedNode, 2 /* Ambient */);
166915
167053
  const shouldUseAliasName = symbol.name !== "default" && !isExternalModuleDeclaration;
166916
- const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKind(
167054
+ const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
166917
167055
  typeChecker,
166918
167056
  resolvedSymbol,
166919
167057
  getSourceFileOfNode(resolvedNode),
166920
167058
  resolvedNode,
166921
167059
  declarationName,
167060
+ type,
166922
167061
  semanticMeaning,
166923
167062
  shouldUseAliasName ? symbol : resolvedSymbol
166924
167063
  );
@@ -167173,6 +167312,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
167173
167312
  addRange(displayParts, typeParameterParts);
167174
167313
  }
167175
167314
  }
167315
+ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) {
167316
+ return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
167317
+ typeChecker,
167318
+ symbol,
167319
+ sourceFile,
167320
+ enclosingDeclaration,
167321
+ location,
167322
+ /*type*/
167323
+ void 0,
167324
+ semanticMeaning,
167325
+ alias
167326
+ );
167327
+ }
167176
167328
  function isLocalVariableOrFunction(symbol) {
167177
167329
  if (symbol.parent) {
167178
167330
  return false;
@@ -180846,10 +180998,22 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
180846
180998
  const { file, project } = this.getFileAndProject(args);
180847
180999
  const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
180848
181000
  const hints = project.getLanguageService().provideInlayHints(file, args, this.getPreferences(file));
180849
- return hints.map((hint) => ({
180850
- ...hint,
180851
- position: scriptInfo.positionToLineOffset(hint.position)
180852
- }));
181001
+ return hints.map((hint) => {
181002
+ const { text, position } = hint;
181003
+ const hintText = typeof text === "string" ? text : text.map(({ text: text2, span, file: file2 }) => ({
181004
+ text: text2,
181005
+ span: span && {
181006
+ start: scriptInfo.positionToLineOffset(span.start),
181007
+ end: scriptInfo.positionToLineOffset(span.start + span.length),
181008
+ file: file2
181009
+ }
181010
+ }));
181011
+ return {
181012
+ ...hint,
181013
+ position: scriptInfo.positionToLineOffset(position),
181014
+ text: hintText
181015
+ };
181016
+ });
180853
181017
  }
180854
181018
  setCompilerOptionsForInferredProjects(args) {
180855
181019
  this.projectService.setCompilerOptionsForInferredProjects(args.options, args.projectRootPath);
@@ -183882,6 +184046,7 @@ ${e.message}`;
183882
184046
  getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
183883
184047
  getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
183884
184048
  getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
184049
+ getPropertyNameFromType: () => getPropertyNameFromType,
183885
184050
  getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
183886
184051
  getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
183887
184052
  getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType,
@@ -184714,6 +184879,7 @@ ${e.message}`;
184714
184879
  isTypeQueryNode: () => isTypeQueryNode,
184715
184880
  isTypeReferenceNode: () => isTypeReferenceNode,
184716
184881
  isTypeReferenceType: () => isTypeReferenceType,
184882
+ isTypeUsableAsPropertyName: () => isTypeUsableAsPropertyName,
184717
184883
  isUMDExportSymbol: () => isUMDExportSymbol,
184718
184884
  isUnaryExpression: () => isUnaryExpression,
184719
184885
  isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite,
@@ -186285,6 +186451,7 @@ ${e.message}`;
186285
186451
  getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
186286
186452
  getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
186287
186453
  getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
186454
+ getPropertyNameFromType: () => getPropertyNameFromType,
186288
186455
  getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
186289
186456
  getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
186290
186457
  getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType,
@@ -187117,6 +187284,7 @@ ${e.message}`;
187117
187284
  isTypeQueryNode: () => isTypeQueryNode,
187118
187285
  isTypeReferenceNode: () => isTypeReferenceNode,
187119
187286
  isTypeReferenceType: () => isTypeReferenceType,
187287
+ isTypeUsableAsPropertyName: () => isTypeUsableAsPropertyName,
187120
187288
  isUMDExportSymbol: () => isUMDExportSymbol,
187121
187289
  isUnaryExpression: () => isUnaryExpression,
187122
187290
  isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite,