typescript 5.6.0-dev.20240808 → 5.6.0-dev.20240810

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
@@ -96,6 +96,7 @@ __export(typescript_exports, {
96
96
  InlayHintKind: () => InlayHintKind2,
97
97
  InlayHints: () => ts_InlayHints_exports,
98
98
  InternalEmitFlags: () => InternalEmitFlags,
99
+ InternalNodeBuilderFlags: () => InternalNodeBuilderFlags,
99
100
  InternalSymbolName: () => InternalSymbolName,
100
101
  IntersectionFlags: () => IntersectionFlags,
101
102
  InvalidatedProjectKind: () => InvalidatedProjectKind,
@@ -1083,6 +1084,7 @@ __export(typescript_exports, {
1083
1084
  hasEffectiveModifiers: () => hasEffectiveModifiers,
1084
1085
  hasEffectiveReadonlyModifier: () => hasEffectiveReadonlyModifier,
1085
1086
  hasExtension: () => hasExtension,
1087
+ hasImplementationTSFileExtension: () => hasImplementationTSFileExtension,
1086
1088
  hasIndexSignature: () => hasIndexSignature,
1087
1089
  hasInferredType: () => hasInferredType,
1088
1090
  hasInitializer: () => hasInitializer,
@@ -2260,7 +2262,7 @@ module.exports = __toCommonJS(typescript_exports);
2260
2262
 
2261
2263
  // src/compiler/corePublic.ts
2262
2264
  var versionMajorMinor = "5.6";
2263
- var version = `${versionMajorMinor}.0-dev.20240808`;
2265
+ var version = `${versionMajorMinor}.0-dev.20240810`;
2264
2266
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2265
2267
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2266
2268
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6168,17 +6170,21 @@ var NodeBuilderFlags = /* @__PURE__ */ ((NodeBuilderFlags2) => {
6168
6170
  NodeBuilderFlags2[NodeBuilderFlags2["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple";
6169
6171
  NodeBuilderFlags2[NodeBuilderFlags2["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType";
6170
6172
  NodeBuilderFlags2[NodeBuilderFlags2["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType";
6171
- NodeBuilderFlags2[NodeBuilderFlags2["WriteComputedProps"] = 1073741824] = "WriteComputedProps";
6172
- NodeBuilderFlags2[NodeBuilderFlags2["NoSyntacticPrinter"] = -2147483648] = "NoSyntacticPrinter";
6173
6173
  NodeBuilderFlags2[NodeBuilderFlags2["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths";
6174
- NodeBuilderFlags2[NodeBuilderFlags2["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain";
6175
- NodeBuilderFlags2[NodeBuilderFlags2["AllowUnresolvedNames"] = 1] = "AllowUnresolvedNames";
6176
6174
  NodeBuilderFlags2[NodeBuilderFlags2["IgnoreErrors"] = 70221824] = "IgnoreErrors";
6177
6175
  NodeBuilderFlags2[NodeBuilderFlags2["InObjectTypeLiteral"] = 4194304] = "InObjectTypeLiteral";
6178
6176
  NodeBuilderFlags2[NodeBuilderFlags2["InTypeAlias"] = 8388608] = "InTypeAlias";
6179
6177
  NodeBuilderFlags2[NodeBuilderFlags2["InInitialEntityName"] = 16777216] = "InInitialEntityName";
6180
6178
  return NodeBuilderFlags2;
6181
6179
  })(NodeBuilderFlags || {});
6180
+ var InternalNodeBuilderFlags = /* @__PURE__ */ ((InternalNodeBuilderFlags2) => {
6181
+ InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["None"] = 0] = "None";
6182
+ InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["WriteComputedProps"] = 1] = "WriteComputedProps";
6183
+ InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["NoSyntacticPrinter"] = 2] = "NoSyntacticPrinter";
6184
+ InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["DoNotIncludeSymbolChain"] = 4] = "DoNotIncludeSymbolChain";
6185
+ InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["AllowUnresolvedNames"] = 8] = "AllowUnresolvedNames";
6186
+ return InternalNodeBuilderFlags2;
6187
+ })(InternalNodeBuilderFlags || {});
6182
6188
  var TypeFormatFlags = /* @__PURE__ */ ((TypeFormatFlags2) => {
6183
6189
  TypeFormatFlags2[TypeFormatFlags2["None"] = 0] = "None";
6184
6190
  TypeFormatFlags2[TypeFormatFlags2["NoTruncation"] = 1] = "NoTruncation";
@@ -22233,6 +22239,9 @@ function hasJSFileExtension(fileName) {
22233
22239
  function hasTSFileExtension(fileName) {
22234
22240
  return some(supportedTSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
22235
22241
  }
22242
+ function hasImplementationTSFileExtension(fileName) {
22243
+ return some(supportedTSImplementationExtensions, (extension) => fileExtensionIs(fileName, extension)) && !isDeclarationFileName(fileName);
22244
+ }
22236
22245
  var ModuleSpecifierEnding = /* @__PURE__ */ ((ModuleSpecifierEnding2) => {
22237
22246
  ModuleSpecifierEnding2[ModuleSpecifierEnding2["Minimal"] = 0] = "Minimal";
22238
22247
  ModuleSpecifierEnding2[ModuleSpecifierEnding2["Index"] = 1] = "Index";
@@ -25386,7 +25395,11 @@ function createNodeFactory(flags, baseFactory2) {
25386
25395
  node.modifiers = asNodeArray(modifiers);
25387
25396
  node.parameters = createNodeArray(parameters);
25388
25397
  node.body = body;
25389
- node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildrenFlags(node.parameters) | propagateChildFlags(node.body) & ~67108864 /* ContainsPossibleTopLevelAwait */ | 1024 /* ContainsES2015 */;
25398
+ if (!node.body) {
25399
+ node.transformFlags = 1 /* ContainsTypeScript */;
25400
+ } else {
25401
+ node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildrenFlags(node.parameters) | propagateChildFlags(node.body) & ~67108864 /* ContainsPossibleTopLevelAwait */ | 1024 /* ContainsES2015 */;
25402
+ }
25390
25403
  node.typeParameters = void 0;
25391
25404
  node.type = void 0;
25392
25405
  node.typeArguments = void 0;
@@ -29555,7 +29568,7 @@ var asyncGeneratorHelper = {
29555
29568
  var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
29556
29569
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
29557
29570
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
29558
- return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
29571
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
29559
29572
  function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
29560
29573
  function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
29561
29574
  function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
@@ -29737,8 +29750,8 @@ var generatorHelper = {
29737
29750
  priority: 6,
29738
29751
  text: `
29739
29752
  var __generator = (this && this.__generator) || function (thisArg, body) {
29740
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
29741
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29753
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
29754
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29742
29755
  function verb(n) { return function (v) { return step([n, v]); }; }
29743
29756
  function step(op) {
29744
29757
  if (f) throw new TypeError("Generator is already executing.");
@@ -48877,6 +48890,28 @@ __export(ts_moduleSpecifiers_exports, {
48877
48890
  });
48878
48891
 
48879
48892
  // src/compiler/moduleSpecifiers.ts
48893
+ var stringToRegex = memoizeOne((pattern) => {
48894
+ try {
48895
+ let slash = pattern.indexOf("/");
48896
+ if (slash !== 0) {
48897
+ return new RegExp(pattern);
48898
+ }
48899
+ const lastSlash = pattern.lastIndexOf("/");
48900
+ if (slash === lastSlash) {
48901
+ return new RegExp(pattern);
48902
+ }
48903
+ while ((slash = pattern.indexOf("/", slash + 1)) !== lastSlash) {
48904
+ if (pattern[slash - 1] !== "\\") {
48905
+ return new RegExp(pattern);
48906
+ }
48907
+ }
48908
+ const flags = pattern.substring(lastSlash + 1).replace(/[^iu]/g, "");
48909
+ pattern = pattern.substring(1, lastSlash);
48910
+ return new RegExp(pattern, flags);
48911
+ } catch {
48912
+ return void 0;
48913
+ }
48914
+ });
48880
48915
  var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
48881
48916
  RelativePreference2[RelativePreference2["Relative"] = 0] = "Relative";
48882
48917
  RelativePreference2[RelativePreference2["NonRelative"] = 1] = "NonRelative";
@@ -48884,9 +48919,10 @@ var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
48884
48919
  RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative";
48885
48920
  return RelativePreference2;
48886
48921
  })(RelativePreference || {});
48887
- function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
48922
+ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding, autoImportSpecifierExcludeRegexes }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
48888
48923
  const filePreferredEnding = getPreferredEnding();
48889
48924
  return {
48925
+ excludeRegexes: autoImportSpecifierExcludeRegexes,
48890
48926
  relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
48891
48927
  getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
48892
48928
  const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
@@ -49003,7 +49039,13 @@ function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSo
49003
49039
  function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
49004
49040
  let computedWithoutCache = false;
49005
49041
  const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
49006
- if (ambient) return { kind: "ambient", moduleSpecifiers: [ambient], computedWithoutCache };
49042
+ if (ambient) {
49043
+ return {
49044
+ kind: "ambient",
49045
+ moduleSpecifiers: !(forAutoImport && isExcludedByRegex(ambient, userPreferences.autoImportSpecifierExcludeRegexes)) ? [ambient] : emptyArray,
49046
+ computedWithoutCache
49047
+ };
49048
+ }
49007
49049
  let [kind, specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
49008
49050
  moduleSymbol,
49009
49051
  importingSourceFile,
@@ -49075,9 +49117,11 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
49075
49117
  void 0,
49076
49118
  options.overrideImportMode
49077
49119
  ) : void 0;
49078
- nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
49079
- if (specifier && modulePath.isRedirect) {
49080
- return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
49120
+ if (specifier && !(forAutoImport && isExcludedByRegex(specifier, preferences.excludeRegexes))) {
49121
+ nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
49122
+ if (modulePath.isRedirect) {
49123
+ return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
49124
+ }
49081
49125
  }
49082
49126
  if (!specifier) {
49083
49127
  const local = getLocalModuleSpecifier(
@@ -49090,7 +49134,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
49090
49134
  /*pathsOnly*/
49091
49135
  modulePath.isRedirect
49092
49136
  );
49093
- if (!local) {
49137
+ if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
49094
49138
  continue;
49095
49139
  }
49096
49140
  if (modulePath.isRedirect) {
@@ -49106,7 +49150,13 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
49106
49150
  }
49107
49151
  }
49108
49152
  }
49109
- return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: Debug.checkDefined(relativeSpecifiers), computedWithoutCache: true };
49153
+ return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: relativeSpecifiers ?? emptyArray, computedWithoutCache: true };
49154
+ }
49155
+ function isExcludedByRegex(moduleSpecifier, excludeRegexes) {
49156
+ return some(excludeRegexes, (pattern) => {
49157
+ var _a;
49158
+ return !!((_a = stringToRegex(pattern)) == null ? void 0 : _a.test(moduleSpecifier));
49159
+ });
49110
49160
  }
49111
49161
  function getInfo(importingSourceFileName, host) {
49112
49162
  importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
@@ -49119,7 +49169,7 @@ function getInfo(importingSourceFileName, host) {
49119
49169
  canonicalSourceDirectory: getCanonicalFileName(sourceDirectory)
49120
49170
  };
49121
49171
  }
49122
- function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference }, pathsOnly) {
49172
+ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference, excludeRegexes }, pathsOnly) {
49123
49173
  const { baseUrl, paths, rootDirs } = compilerOptions;
49124
49174
  if (pathsOnly && !paths) {
49125
49175
  return void 0;
@@ -49135,7 +49185,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
49135
49185
  if (!relativeToBaseUrl) {
49136
49186
  return pathsOnly ? void 0 : relativePath;
49137
49187
  }
49138
- const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
49188
+ const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(
49189
+ moduleFileName,
49190
+ sourceDirectory,
49191
+ compilerOptions,
49192
+ host,
49193
+ importMode,
49194
+ prefersTsExtension(allowedEndings)
49195
+ );
49139
49196
  const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
49140
49197
  if (pathsOnly) {
49141
49198
  return fromPaths;
@@ -49144,6 +49201,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
49144
49201
  if (!maybeNonRelative) {
49145
49202
  return relativePath;
49146
49203
  }
49204
+ const relativeIsExcluded = isExcludedByRegex(relativePath, excludeRegexes);
49205
+ const nonRelativeIsExcluded = isExcludedByRegex(maybeNonRelative, excludeRegexes);
49206
+ if (!relativeIsExcluded && nonRelativeIsExcluded) {
49207
+ return relativePath;
49208
+ }
49209
+ if (relativeIsExcluded && !nonRelativeIsExcluded) {
49210
+ return maybeNonRelative;
49211
+ }
49147
49212
  if (relativePreference === 1 /* NonRelative */ && !pathIsRelative(maybeNonRelative)) {
49148
49213
  return maybeNonRelative;
49149
49214
  }
@@ -49383,7 +49448,7 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
49383
49448
  return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
49384
49449
  }
49385
49450
  }
49386
- function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports) {
49451
+ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports, preferTsExtension) {
49387
49452
  if (typeof exports2 === "string") {
49388
49453
  const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
49389
49454
  const getCommonSourceDirectory2 = () => host.getCommonSourceDirectory();
@@ -49395,6 +49460,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
49395
49460
  void 0
49396
49461
  );
49397
49462
  const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
49463
+ const canTryTsExtension = preferTsExtension && hasImplementationTSFileExtension(targetFilePath);
49398
49464
  switch (mode) {
49399
49465
  case 0 /* Exact */:
49400
49466
  if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */) {
@@ -49402,6 +49468,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
49402
49468
  }
49403
49469
  break;
49404
49470
  case 1 /* Directory */:
49471
+ if (canTryTsExtension && containsPath(targetFilePath, pathOrPattern, ignoreCase)) {
49472
+ const fragment = getRelativePathFromDirectory(
49473
+ pathOrPattern,
49474
+ targetFilePath,
49475
+ /*ignoreCase*/
49476
+ false
49477
+ );
49478
+ return { moduleFileToTry: getNormalizedAbsolutePath(
49479
+ combinePaths(combinePaths(packageName, exports2), fragment),
49480
+ /*currentDirectory*/
49481
+ void 0
49482
+ ) };
49483
+ }
49405
49484
  if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget, ignoreCase)) {
49406
49485
  const fragment = getRelativePathFromDirectory(
49407
49486
  pathOrPattern,
@@ -49415,7 +49494,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
49415
49494
  void 0
49416
49495
  ) };
49417
49496
  }
49418
- if (containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
49497
+ if (!canTryTsExtension && containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
49419
49498
  const fragment = getRelativePathFromDirectory(
49420
49499
  pathOrPattern,
49421
49500
  targetFilePath,
@@ -49438,12 +49517,12 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
49438
49517
  return { moduleFileToTry: combinePaths(packageName, fragment) };
49439
49518
  }
49440
49519
  if (declarationFile && containsPath(pathOrPattern, declarationFile, ignoreCase)) {
49441
- const fragment = getRelativePathFromDirectory(
49520
+ const fragment = changeFullExtension(getRelativePathFromDirectory(
49442
49521
  pathOrPattern,
49443
49522
  declarationFile,
49444
49523
  /*ignoreCase*/
49445
49524
  false
49446
- );
49525
+ ), getJSExtensionForFile(declarationFile, options));
49447
49526
  return { moduleFileToTry: combinePaths(packageName, fragment) };
49448
49527
  }
49449
49528
  break;
@@ -49451,11 +49530,15 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
49451
49530
  const starPos = pathOrPattern.indexOf("*");
49452
49531
  const leadingSlice = pathOrPattern.slice(0, starPos);
49453
49532
  const trailingSlice = pathOrPattern.slice(starPos + 1);
49533
+ if (canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
49534
+ const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
49535
+ return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
49536
+ }
49454
49537
  if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice, ignoreCase) && endsWith(extensionSwappedTarget, trailingSlice, ignoreCase)) {
49455
49538
  const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
49456
49539
  return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
49457
49540
  }
49458
- if (startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
49541
+ if (!canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
49459
49542
  const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
49460
49543
  return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
49461
49544
  }
@@ -49465,17 +49548,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
49465
49548
  }
49466
49549
  if (declarationFile && startsWith(declarationFile, leadingSlice, ignoreCase) && endsWith(declarationFile, trailingSlice, ignoreCase)) {
49467
49550
  const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
49468
- return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
49551
+ const substituted = replaceFirstStar(packageName, starReplacement);
49552
+ const jsExtension = tryGetJSExtensionForFile(declarationFile, options);
49553
+ return jsExtension ? { moduleFileToTry: changeFullExtension(substituted, jsExtension) } : void 0;
49469
49554
  }
49470
49555
  break;
49471
49556
  }
49472
49557
  } else if (Array.isArray(exports2)) {
49473
- return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
49558
+ return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports, preferTsExtension));
49474
49559
  } else if (typeof exports2 === "object" && exports2 !== null) {
49475
49560
  for (const key of getOwnKeys(exports2)) {
49476
49561
  if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
49477
49562
  const subTarget = exports2[key];
49478
- const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
49563
+ const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports, preferTsExtension);
49479
49564
  if (result) {
49480
49565
  return result;
49481
49566
  }
@@ -49503,6 +49588,8 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
49503
49588
  conditions,
49504
49589
  mode,
49505
49590
  /*isImports*/
49591
+ false,
49592
+ /*preferTsExtension*/
49506
49593
  false
49507
49594
  );
49508
49595
  });
@@ -49517,10 +49604,12 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
49517
49604
  conditions,
49518
49605
  0 /* Exact */,
49519
49606
  /*isImports*/
49607
+ false,
49608
+ /*preferTsExtension*/
49520
49609
  false
49521
49610
  );
49522
49611
  }
49523
- function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
49612
+ function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode, preferTsExtension) {
49524
49613
  var _a, _b, _c;
49525
49614
  if (!host.readFile || !getResolvePackageJsonImports(options)) {
49526
49615
  return void 0;
@@ -49553,7 +49642,8 @@ function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory,
49553
49642
  conditions,
49554
49643
  mode,
49555
49644
  /*isImports*/
49556
- true
49645
+ true,
49646
+ preferTsExtension
49557
49647
  );
49558
49648
  })) == null ? void 0 : _c.moduleFileToTry;
49559
49649
  }
@@ -49635,7 +49725,15 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
49635
49725
  const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
49636
49726
  const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
49637
49727
  const conditions = getConditions(options, importMode);
49638
- const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
49728
+ const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(
49729
+ options,
49730
+ host,
49731
+ path,
49732
+ packageRootPath,
49733
+ packageName2,
49734
+ packageJsonContent.exports,
49735
+ conditions
49736
+ ) : void 0;
49639
49737
  if (fromExports) {
49640
49738
  return { ...fromExports, verbatimFromExports: true };
49641
49739
  }
@@ -49783,6 +49881,10 @@ function isPathRelativeToParent(path) {
49783
49881
  function getDefaultResolutionModeForFile(file, host, compilerOptions) {
49784
49882
  return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
49785
49883
  }
49884
+ function prefersTsExtension(allowedEndings) {
49885
+ const tsPriority = allowedEndings.indexOf(3 /* TsExtension */);
49886
+ return tsPriority > -1 && tsPriority < allowedEndings.indexOf(2 /* JsExtension */);
49887
+ }
49786
49888
 
49787
49889
  // src/compiler/checker.ts
49788
49890
  var ambientModuleSymbolRegex = /^".+"$/;
@@ -53977,6 +54079,7 @@ function createTypeChecker(host) {
53977
54079
  }
53978
54080
  function symbolToString(symbol, enclosingDeclaration, meaning, flags = 4 /* AllowAnyNodeKind */, writer) {
53979
54081
  let nodeFlags = 70221824 /* IgnoreErrors */;
54082
+ let internalNodeFlags = 0 /* None */;
53980
54083
  if (flags & 2 /* UseOnlyExternalAliasing */) {
53981
54084
  nodeFlags |= 128 /* UseOnlyExternalAliasing */;
53982
54085
  }
@@ -53987,15 +54090,15 @@ function createTypeChecker(host) {
53987
54090
  nodeFlags |= 16384 /* UseAliasDefinedOutsideCurrentScope */;
53988
54091
  }
53989
54092
  if (flags & 32 /* DoNotIncludeSymbolChain */) {
53990
- nodeFlags |= 134217728 /* DoNotIncludeSymbolChain */;
54093
+ internalNodeFlags |= 4 /* DoNotIncludeSymbolChain */;
53991
54094
  }
53992
54095
  if (flags & 16 /* WriteComputedProps */) {
53993
- nodeFlags |= 1073741824 /* WriteComputedProps */;
54096
+ internalNodeFlags |= 1 /* WriteComputedProps */;
53994
54097
  }
53995
54098
  const builder = flags & 4 /* AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName;
53996
54099
  return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
53997
54100
  function symbolToStringWorker(writer2) {
53998
- const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
54101
+ const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags, internalNodeFlags);
53999
54102
  const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 307 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
54000
54103
  const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
54001
54104
  printer.writeNode(
@@ -54032,7 +54135,13 @@ function createTypeChecker(host) {
54032
54135
  }
54033
54136
  function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")) {
54034
54137
  const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
54035
- const typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0));
54138
+ const typeNode = nodeBuilder.typeToTypeNode(
54139
+ type,
54140
+ enclosingDeclaration,
54141
+ toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0 /* None */),
54142
+ /*internalFlags*/
54143
+ void 0
54144
+ );
54036
54145
  if (typeNode === void 0) return Debug.fail("should always get typenode");
54037
54146
  const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
54038
54147
  const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
@@ -54081,31 +54190,31 @@ function createTypeChecker(host) {
54081
54190
  }
54082
54191
  function createNodeBuilder() {
54083
54192
  return {
54084
- typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
54085
- typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
54086
- expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
54087
- serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
54088
- serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
54089
- indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
54193
+ typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeToTypeNodeHelper(type, context)),
54194
+ typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
54195
+ expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
54196
+ serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
54197
+ serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
54198
+ indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
54090
54199
  indexInfo,
54091
54200
  context,
54092
54201
  /*typeNode*/
54093
54202
  void 0
54094
54203
  )),
54095
- signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
54096
- symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToName(
54204
+ signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
54205
+ symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToName(
54097
54206
  symbol,
54098
54207
  context,
54099
54208
  meaning,
54100
54209
  /*expectsIdentifier*/
54101
54210
  false
54102
54211
  )),
54103
- symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
54104
- symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
54105
- symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
54106
- typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
54107
- symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
54108
- symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
54212
+ symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
54213
+ symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
54214
+ symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
54215
+ typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
54216
+ symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
54217
+ symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToNode(symbol, context, meaning))
54109
54218
  };
54110
54219
  function getTypeFromTypeNode2(context, node, noMappedTypes) {
54111
54220
  const type = getTypeFromTypeNodeWithoutContext(node);
@@ -54127,13 +54236,13 @@ function createTypeChecker(host) {
54127
54236
  return setTextRange(setOriginalNode(range, location), location);
54128
54237
  }
54129
54238
  function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
54130
- const oldFlags = context.flags;
54131
- if (expr && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
54239
+ const restoreFlags = saveRestoreFlags(context);
54240
+ if (expr && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
54132
54241
  syntacticNodeBuilder.serializeTypeOfExpression(expr, context, addUndefined);
54133
54242
  }
54134
- context.flags |= -2147483648 /* NoSyntacticPrinter */;
54243
+ context.internalFlags |= 2 /* NoSyntacticPrinter */;
54135
54244
  const result = expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined);
54136
- context.flags = oldFlags;
54245
+ restoreFlags();
54137
54246
  return result;
54138
54247
  }
54139
54248
  function expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined) {
@@ -54186,7 +54295,7 @@ function createTypeChecker(host) {
54186
54295
  return void 0;
54187
54296
  }
54188
54297
  function symbolToNode(symbol, context, meaning) {
54189
- if (context.flags & 1073741824 /* WriteComputedProps */) {
54298
+ if (context.internalFlags & 1 /* WriteComputedProps */) {
54190
54299
  if (symbol.valueDeclaration) {
54191
54300
  const name = getNameOfDeclaration(symbol.valueDeclaration);
54192
54301
  if (name && isComputedPropertyName(name)) return name;
@@ -54199,12 +54308,13 @@ function createTypeChecker(host) {
54199
54308
  }
54200
54309
  return symbolToExpression(symbol, context, meaning);
54201
54310
  }
54202
- function withContext2(enclosingDeclaration, flags, tracker, cb) {
54203
- const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : flags & 134217728 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
54311
+ function withContext2(enclosingDeclaration, flags, internalFlags, tracker, cb) {
54312
+ const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
54204
54313
  const context = {
54205
54314
  enclosingDeclaration,
54206
54315
  enclosingFile: enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration),
54207
54316
  flags: flags || 0 /* None */,
54317
+ internalFlags: internalFlags || 0 /* None */,
54208
54318
  tracker: void 0,
54209
54319
  encounteredError: false,
54210
54320
  reportedDiagnostic: false,
@@ -54234,14 +54344,23 @@ function createTypeChecker(host) {
54234
54344
  }
54235
54345
  return context.encounteredError ? void 0 : resultingNode;
54236
54346
  }
54347
+ function saveRestoreFlags(context) {
54348
+ const flags = context.flags;
54349
+ const internalFlags = context.internalFlags;
54350
+ return restore;
54351
+ function restore() {
54352
+ context.flags = flags;
54353
+ context.internalFlags = internalFlags;
54354
+ }
54355
+ }
54237
54356
  function checkTruncationLength(context) {
54238
54357
  if (context.truncating) return context.truncating;
54239
54358
  return context.truncating = context.approximateLength > (context.flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
54240
54359
  }
54241
54360
  function typeToTypeNodeHelper(type, context) {
54242
- const savedFlags = context.flags;
54361
+ const restoreFlags = saveRestoreFlags(context);
54243
54362
  const typeNode = typeToTypeNodeWorker(type, context);
54244
- context.flags = savedFlags;
54363
+ restoreFlags();
54245
54364
  return typeNode;
54246
54365
  }
54247
54366
  function typeToTypeNodeWorker(type, context) {
@@ -54695,7 +54814,7 @@ function createTypeChecker(host) {
54695
54814
  context.symbolDepth = /* @__PURE__ */ new Map();
54696
54815
  }
54697
54816
  const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
54698
- const key = `${getTypeId(type2)}|${context.flags}`;
54817
+ const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`;
54699
54818
  if (links) {
54700
54819
  links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
54701
54820
  }
@@ -54801,10 +54920,10 @@ function createTypeChecker(host) {
54801
54920
  }
54802
54921
  return typeToTypeNodeHelper(getIntersectionType(types), context);
54803
54922
  }
54804
- const savedFlags = context.flags;
54923
+ const restoreFlags = saveRestoreFlags(context);
54805
54924
  context.flags |= 4194304 /* InObjectTypeLiteral */;
54806
54925
  const members = createTypeNodesFromResolvedType(resolved);
54807
- context.flags = savedFlags;
54926
+ restoreFlags();
54808
54927
  const typeLiteralNode = factory.createTypeLiteralNode(members);
54809
54928
  context.approximateLength += 2;
54810
54929
  setEmitFlags(typeLiteralNode, context.flags & 1024 /* MultilineObjectLiterals */ ? 0 : 1 /* SingleLine */);
@@ -54867,10 +54986,10 @@ function createTypeChecker(host) {
54867
54986
  } while (i < length2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent2);
54868
54987
  if (!rangeEquals(outerTypeParameters, typeArguments, start, i)) {
54869
54988
  const typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
54870
- const flags2 = context.flags;
54989
+ const restoreFlags2 = saveRestoreFlags(context);
54871
54990
  context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
54872
54991
  const ref = symbolToTypeNode(parent2, context, 788968 /* Type */, typeArgumentSlice);
54873
- context.flags = flags2;
54992
+ restoreFlags2();
54874
54993
  resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
54875
54994
  }
54876
54995
  }
@@ -54908,10 +55027,10 @@ function createTypeChecker(host) {
54908
55027
  }
54909
55028
  typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
54910
55029
  }
54911
- const flags = context.flags;
55030
+ const restoreFlags = saveRestoreFlags(context);
54912
55031
  context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
54913
55032
  const finalRef = symbolToTypeNode(type2.symbol, context, 788968 /* Type */, typeArgumentNodes);
54914
- context.flags = flags;
55033
+ restoreFlags();
54915
55034
  return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
54916
55035
  }
54917
55036
  }
@@ -55223,7 +55342,7 @@ function createTypeChecker(host) {
55223
55342
  }
55224
55343
  }
55225
55344
  if (seenNames) {
55226
- const saveContextFlags = context.flags;
55345
+ const restoreFlags = saveRestoreFlags(context);
55227
55346
  context.flags |= 64 /* UseFullyQualifiedType */;
55228
55347
  seenNames.forEach((types2) => {
55229
55348
  if (!arrayIsHomogeneous(types2, ([a], [b]) => typesAreSameReference(a, b))) {
@@ -55232,7 +55351,7 @@ function createTypeChecker(host) {
55232
55351
  }
55233
55352
  }
55234
55353
  });
55235
- context.flags = saveContextFlags;
55354
+ restoreFlags();
55236
55355
  }
55237
55356
  return result;
55238
55357
  }
@@ -55284,19 +55403,19 @@ function createTypeChecker(host) {
55284
55403
  } else {
55285
55404
  typeParameters = signature.typeParameters && signature.typeParameters.map((parameter) => typeParameterToDeclaration(parameter, context));
55286
55405
  }
55287
- const flags = context.flags;
55406
+ const restoreFlags = saveRestoreFlags(context);
55288
55407
  context.flags &= ~256 /* SuppressAnyReturnType */;
55289
55408
  const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */));
55290
55409
  const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
55291
55410
  if (thisParameter) {
55292
55411
  parameters.unshift(thisParameter);
55293
55412
  }
55294
- context.flags = flags;
55413
+ restoreFlags();
55295
55414
  const returnTypeNode = serializeReturnTypeForSignature(context, signature);
55296
55415
  let modifiers = options == null ? void 0 : options.modifiers;
55297
55416
  if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
55298
- const flags2 = modifiersToFlags(modifiers);
55299
- modifiers = factory.createModifiersFromModifierFlags(flags2 | 64 /* Abstract */);
55417
+ const flags = modifiersToFlags(modifiers);
55418
+ modifiers = factory.createModifiersFromModifierFlags(flags | 64 /* Abstract */);
55300
55419
  }
55301
55420
  const node = kind === 179 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 180 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 173 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 174 /* MethodDeclaration */ ? factory.createMethodDeclaration(
55302
55421
  modifiers,
@@ -55516,13 +55635,13 @@ function createTypeChecker(host) {
55516
55635
  }
55517
55636
  }
55518
55637
  function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
55519
- const savedContextFlags = context.flags;
55638
+ const restoreFlags = saveRestoreFlags(context);
55520
55639
  context.flags &= ~512 /* WriteTypeParametersInQualifiedName */;
55521
55640
  const modifiers = factory.createModifiersFromModifierFlags(getTypeParameterModifiers(type));
55522
55641
  const name = typeParameterToName(type, context);
55523
55642
  const defaultParameter = getDefaultFromTypeParameter(type);
55524
55643
  const defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context);
55525
- context.flags = savedContextFlags;
55644
+ restoreFlags();
55526
55645
  return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
55527
55646
  }
55528
55647
  function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
@@ -55626,7 +55745,7 @@ function createTypeChecker(host) {
55626
55745
  function lookupSymbolChainWorker(symbol, context, meaning, yieldModuleSymbol) {
55627
55746
  let chain;
55628
55747
  const isTypeParameter = symbol.flags & 262144 /* TypeParameter */;
55629
- if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64 /* UseFullyQualifiedType */) && !(context.flags & 134217728 /* DoNotIncludeSymbolChain */)) {
55748
+ if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64 /* UseFullyQualifiedType */) && !(context.internalFlags & 4 /* DoNotIncludeSymbolChain */)) {
55630
55749
  chain = Debug.checkDefined(getSymbolChain(
55631
55750
  symbol,
55632
55751
  meaning,
@@ -56152,19 +56271,19 @@ function createTypeChecker(host) {
56152
56271
  var _a, _b;
56153
56272
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
56154
56273
  const enclosingDeclaration = context.enclosingDeclaration;
56155
- const oldFlags = context.flags;
56156
- if (declaration && hasInferredType(declaration) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
56274
+ const restoreFlags = saveRestoreFlags(context);
56275
+ if (declaration && hasInferredType(declaration) && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
56157
56276
  syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, context);
56158
56277
  }
56159
- context.flags |= -2147483648 /* NoSyntacticPrinter */;
56160
- if (enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
56278
+ context.internalFlags |= 2 /* NoSyntacticPrinter */;
56279
+ if (enclosingDeclaration && (!isErrorType(type) || context.internalFlags & 8 /* AllowUnresolvedNames */)) {
56161
56280
  const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
56162
56281
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
56163
56282
  const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
56164
56283
  const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
56165
56284
  const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
56166
56285
  if (result2) {
56167
- context.flags = oldFlags;
56286
+ restoreFlags();
56168
56287
  return result2;
56169
56288
  }
56170
56289
  }
@@ -56175,7 +56294,7 @@ function createTypeChecker(host) {
56175
56294
  const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
56176
56295
  const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
56177
56296
  const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
56178
- context.flags = oldFlags;
56297
+ restoreFlags();
56179
56298
  return result;
56180
56299
  }
56181
56300
  function typeNodeIsEquivalentToType(annotatedDeclaration, type, typeFromTypeNode) {
@@ -56189,26 +56308,26 @@ function createTypeChecker(host) {
56189
56308
  }
56190
56309
  function serializeReturnTypeForSignature(context, signature) {
56191
56310
  const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
56192
- const flags = context.flags;
56311
+ const restoreFlags = saveRestoreFlags(context);
56193
56312
  if (suppressAny) context.flags &= ~256 /* SuppressAnyReturnType */;
56194
56313
  let returnTypeNode;
56195
56314
  const returnType = getReturnTypeOfSignature(signature);
56196
56315
  if (returnType && !(suppressAny && isTypeAny(returnType))) {
56197
- if (signature.declaration && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
56316
+ if (signature.declaration && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
56198
56317
  syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, context);
56199
56318
  }
56200
- context.flags |= -2147483648 /* NoSyntacticPrinter */;
56319
+ context.internalFlags |= 2 /* NoSyntacticPrinter */;
56201
56320
  returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
56202
56321
  } else if (!suppressAny) {
56203
56322
  returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
56204
56323
  }
56205
- context.flags = flags;
56324
+ restoreFlags();
56206
56325
  return returnTypeNode;
56207
56326
  }
56208
56327
  function serializeReturnTypeForSignatureWorker(context, signature) {
56209
56328
  const typePredicate = getTypePredicateOfSignature(signature);
56210
56329
  const type = getReturnTypeOfSignature(signature);
56211
- if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
56330
+ if (context.enclosingDeclaration && (!isErrorType(type) || context.internalFlags & 8 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
56212
56331
  const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
56213
56332
  if (annotation) {
56214
56333
  const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
@@ -56710,7 +56829,7 @@ function createTypeChecker(host) {
56710
56829
  if (!hasDynamicName(node)) {
56711
56830
  return visitEachChild2(node, visitExistingNodeTreeSymbols);
56712
56831
  }
56713
- if (!(context.flags & 1 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
56832
+ if (!(context.internalFlags & 8 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
56714
56833
  return void 0;
56715
56834
  }
56716
56835
  }
@@ -57362,7 +57481,7 @@ function createTypeChecker(host) {
57362
57481
  const typeParamDecls = map(typeParams, (p) => typeParameterToDeclaration(p, context));
57363
57482
  const jsdocAliasDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isJSDocTypeAlias);
57364
57483
  const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0);
57365
- const oldFlags = context.flags;
57484
+ const restoreFlags = saveRestoreFlags(context);
57366
57485
  context.flags |= 8388608 /* InTypeAlias */;
57367
57486
  const oldEnclosingDecl = context.enclosingDeclaration;
57368
57487
  context.enclosingDeclaration = jsdocAliasDecl;
@@ -57386,7 +57505,7 @@ function createTypeChecker(host) {
57386
57505
  ),
57387
57506
  modifierFlags
57388
57507
  );
57389
- context.flags = oldFlags;
57508
+ restoreFlags();
57390
57509
  context.enclosingDeclaration = oldEnclosingDecl;
57391
57510
  }
57392
57511
  function serializeInterface(symbol, symbolName2, modifierFlags) {
@@ -58395,10 +58514,10 @@ function createTypeChecker(host) {
58395
58514
  }
58396
58515
  function getNameCandidateWorker(symbol, localName) {
58397
58516
  if (localName === "default" /* Default */ || localName === "__class" /* Class */ || localName === "__function" /* Function */) {
58398
- const flags = context.flags;
58517
+ const restoreFlags = saveRestoreFlags(context);
58399
58518
  context.flags |= 16777216 /* InInitialEntityName */;
58400
58519
  const nameCandidate = getNameOfSymbolAsWritten(symbol, context);
58401
- context.flags = flags;
58520
+ restoreFlags();
58402
58521
  localName = nameCandidate.length > 0 && isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? stripQuotes(nameCandidate) : nameCandidate;
58403
58522
  }
58404
58523
  if (localName === "default" /* Default */) {
@@ -59981,7 +60100,8 @@ function createTypeChecker(host) {
59981
60100
  if (!node) {
59982
60101
  return void 0;
59983
60102
  }
59984
- switch (node.kind) {
60103
+ const kind = node.kind;
60104
+ switch (kind) {
59985
60105
  case 263 /* ClassDeclaration */:
59986
60106
  case 231 /* ClassExpression */:
59987
60107
  case 264 /* InterfaceDeclaration */:
@@ -60003,13 +60123,19 @@ function createTypeChecker(host) {
60003
60123
  case 200 /* MappedType */:
60004
60124
  case 194 /* ConditionalType */: {
60005
60125
  const outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
60006
- if (node.kind === 200 /* MappedType */) {
60126
+ if ((kind === 218 /* FunctionExpression */ || kind === 219 /* ArrowFunction */ || isObjectLiteralMethod(node)) && isContextSensitive(node)) {
60127
+ const signature = firstOrUndefined(getSignaturesOfType(getTypeOfSymbol(getSymbolOfDeclaration(node)), 0 /* Call */));
60128
+ if (signature && signature.typeParameters) {
60129
+ return [...outerTypeParameters || emptyArray, ...signature.typeParameters];
60130
+ }
60131
+ }
60132
+ if (kind === 200 /* MappedType */) {
60007
60133
  return append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter)));
60008
- } else if (node.kind === 194 /* ConditionalType */) {
60134
+ } else if (kind === 194 /* ConditionalType */) {
60009
60135
  return concatenate(outerTypeParameters, getInferTypeParameters(node));
60010
60136
  }
60011
60137
  const outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, getEffectiveTypeParameterDeclarations(node));
60012
- const thisType = includeThisTypes && (node.kind === 263 /* ClassDeclaration */ || node.kind === 231 /* ClassExpression */ || node.kind === 264 /* InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node)).thisType;
60138
+ const thisType = includeThisTypes && (kind === 263 /* ClassDeclaration */ || kind === 231 /* ClassExpression */ || kind === 264 /* InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node)).thisType;
60013
60139
  return thisType ? append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
60014
60140
  }
60015
60141
  case 341 /* JSDocParameterTag */:
@@ -62821,8 +62947,11 @@ function createTypeChecker(host) {
62821
62947
  true
62822
62948
  );
62823
62949
  }
62950
+ function getTypeParametersForMapper(signature) {
62951
+ return sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp);
62952
+ }
62824
62953
  function createSignatureTypeMapper(signature, typeArguments) {
62825
- return createTypeMapper(sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp), typeArguments);
62954
+ return createTypeMapper(getTypeParametersForMapper(signature), typeArguments);
62826
62955
  }
62827
62956
  function getErasedSignature(signature) {
62828
62957
  return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
@@ -75836,7 +75965,7 @@ function createTypeChecker(host) {
75836
75965
  type,
75837
75966
  (t) => {
75838
75967
  var _a;
75839
- if (isGenericMappedType(t) && !t.declaration.nameType) {
75968
+ if (isGenericMappedType(t) && getMappedTypeNameTypeKind(t) !== 2 /* Remapping */) {
75840
75969
  const constraint = getConstraintTypeFromMappedType(t);
75841
75970
  const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
75842
75971
  const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
@@ -78522,7 +78651,7 @@ function createTypeChecker(host) {
78522
78651
  return void 0;
78523
78652
  }
78524
78653
  function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) {
78525
- const context = createInferenceContext(signature.typeParameters, signature, 0 /* None */, compareTypes);
78654
+ const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0 /* None */, compareTypes);
78526
78655
  const restType = getEffectiveRestType(contextualSignature);
78527
78656
  const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
78528
78657
  const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
@@ -90559,14 +90688,14 @@ function createTypeChecker(host) {
90559
90688
  return 11 /* ObjectType */;
90560
90689
  }
90561
90690
  }
90562
- function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker) {
90691
+ function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, internalFlags, tracker) {
90563
90692
  const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor);
90564
90693
  if (!declaration) {
90565
90694
  return factory.createToken(133 /* AnyKeyword */);
90566
90695
  }
90567
90696
  const symbol = getSymbolOfDeclaration(declaration);
90568
90697
  const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
90569
- return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
90698
+ return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, internalFlags, tracker);
90570
90699
  }
90571
90700
  function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
90572
90701
  return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
@@ -90609,14 +90738,14 @@ function createTypeChecker(host) {
90609
90738
  }
90610
90739
  return candidateExpr;
90611
90740
  }
90612
- function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
90741
+ function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, internalFlags, tracker) {
90613
90742
  const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
90614
90743
  if (!signatureDeclaration) {
90615
90744
  return factory.createToken(133 /* AnyKeyword */);
90616
90745
  }
90617
- return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
90746
+ return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, internalFlags, tracker);
90618
90747
  }
90619
- function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
90748
+ function createTypeOfExpression(exprIn, enclosingDeclaration, flags, internalFlags, tracker) {
90620
90749
  const expr = getParseTreeNode(exprIn, isExpression);
90621
90750
  if (!expr) {
90622
90751
  return factory.createToken(133 /* AnyKeyword */);
@@ -90629,6 +90758,7 @@ function createTypeChecker(host) {
90629
90758
  void 0,
90630
90759
  enclosingDeclaration,
90631
90760
  flags | 1024 /* MultilineObjectLiterals */,
90761
+ internalFlags,
90632
90762
  tracker
90633
90763
  );
90634
90764
  }
@@ -90734,6 +90864,8 @@ function createTypeChecker(host) {
90734
90864
  enclosing,
90735
90865
  /*flags*/
90736
90866
  void 0,
90867
+ /*internalFlags*/
90868
+ void 0,
90737
90869
  tracker
90738
90870
  ) : type === trueType ? factory.createTrue() : type === falseType && factory.createFalse();
90739
90871
  if (enumResult) return enumResult;
@@ -90862,15 +90994,15 @@ function createTypeChecker(host) {
90862
90994
  const parseDecl = getParseTreeNode(decl);
90863
90995
  return !!parseNode && !!parseDecl && (isVariableDeclaration(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl);
90864
90996
  },
90865
- getDeclarationStatementsForSourceFile: (node, flags, tracker) => {
90997
+ getDeclarationStatementsForSourceFile: (node, flags, internalFlags, tracker) => {
90866
90998
  const n = getParseTreeNode(node);
90867
90999
  Debug.assert(n && n.kind === 307 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile");
90868
91000
  const sym = getSymbolOfDeclaration(node);
90869
91001
  if (!sym) {
90870
- return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker);
91002
+ return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, internalFlags, tracker);
90871
91003
  }
90872
91004
  resolveExternalModuleSymbol(sym);
90873
- return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
91005
+ return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, internalFlags, tracker);
90874
91006
  },
90875
91007
  isImportRequiredByAugmentation,
90876
91008
  isDefinitelyReferenceToGlobalSymbolObject
@@ -96024,7 +96156,6 @@ function transformTypeScript(context) {
96024
96156
  let currentNamespaceContainerName;
96025
96157
  let currentLexicalScope;
96026
96158
  let currentScopeFirstDeclarationsOfName;
96027
- let currentClassHasParameterProperties;
96028
96159
  let enabledSubstitutions;
96029
96160
  let applicableSubstitutions;
96030
96161
  return transformSourceFileOrBundle;
@@ -96052,14 +96183,12 @@ function transformTypeScript(context) {
96052
96183
  function saveStateAndInvoke(node, f) {
96053
96184
  const savedCurrentScope = currentLexicalScope;
96054
96185
  const savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
96055
- const savedCurrentClassHasParameterProperties = currentClassHasParameterProperties;
96056
96186
  onBeforeVisitNode(node);
96057
96187
  const visited = f(node);
96058
96188
  if (currentLexicalScope !== savedCurrentScope) {
96059
96189
  currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
96060
96190
  }
96061
96191
  currentLexicalScope = savedCurrentScope;
96062
- currentClassHasParameterProperties = savedCurrentClassHasParameterProperties;
96063
96192
  return visited;
96064
96193
  }
96065
96194
  function onBeforeVisitNode(node) {
@@ -96692,7 +96821,7 @@ function transformTypeScript(context) {
96692
96821
  }
96693
96822
  function visitPropertyNameOfClassElement(member) {
96694
96823
  const name = member.name;
96695
- if (isComputedPropertyName(name) && (!hasStaticModifier(member) && currentClassHasParameterProperties || hasDecorators(member) && legacyDecorators)) {
96824
+ if (legacyDecorators && isComputedPropertyName(name) && hasDecorators(member)) {
96696
96825
  const expression = visitNode(name.expression, visitor, isExpression);
96697
96826
  Debug.assert(expression);
96698
96827
  const innerExpression = skipPartiallyEmittedExpressions(expression);
@@ -116155,7 +116284,8 @@ function getDeclarationDiagnostics(host, resolver, file) {
116155
116284
  false
116156
116285
  ).diagnostics : void 0;
116157
116286
  }
116158
- var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /* AllowUnresolvedNames */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
116287
+ var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
116288
+ var declarationEmitInternalNodeBuilderFlags = 8 /* AllowUnresolvedNames */;
116159
116289
  function transformDeclarations(context) {
116160
116290
  const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
116161
116291
  let getSymbolAccessibilityDiagnostic = throwDiagnostic;
@@ -116311,7 +116441,7 @@ function transformDeclarations(context) {
116311
116441
  diagnosticMessage: s.errorModuleName ? Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit : Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit,
116312
116442
  errorNode: s.errorNode || sourceFile
116313
116443
  };
116314
- const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker);
116444
+ const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
116315
116445
  getSymbolAccessibilityDiagnostic = oldDiag;
116316
116446
  return result;
116317
116447
  }
@@ -116581,7 +116711,7 @@ function transformDeclarations(context) {
116581
116711
  case 172 /* PropertyDeclaration */:
116582
116712
  case 208 /* BindingElement */:
116583
116713
  case 260 /* VariableDeclaration */:
116584
- typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
116714
+ typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
116585
116715
  break;
116586
116716
  case 262 /* FunctionDeclaration */:
116587
116717
  case 180 /* ConstructSignature */:
@@ -116589,7 +116719,7 @@ function transformDeclarations(context) {
116589
116719
  case 174 /* MethodDeclaration */:
116590
116720
  case 177 /* GetAccessor */:
116591
116721
  case 179 /* CallSignature */:
116592
- typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
116722
+ typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
116593
116723
  break;
116594
116724
  default:
116595
116725
  Debug.assertNever(node);
@@ -117190,7 +117320,7 @@ function transformDeclarations(context) {
117190
117320
  newId,
117191
117321
  /*exclamationToken*/
117192
117322
  void 0,
117193
- resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
117323
+ resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker),
117194
117324
  /*initializer*/
117195
117325
  void 0
117196
117326
  );
@@ -117316,7 +117446,7 @@ function transformDeclarations(context) {
117316
117446
  return void 0;
117317
117447
  }
117318
117448
  getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
117319
- const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags | -2147483648 /* NoSyntacticPrinter */, symbolTracker);
117449
+ const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags | 2 /* NoSyntacticPrinter */, symbolTracker);
117320
117450
  getSymbolAccessibilityDiagnostic = oldDiag;
117321
117451
  const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
117322
117452
  const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
@@ -117519,7 +117649,7 @@ function transformDeclarations(context) {
117519
117649
  newId,
117520
117650
  /*exclamationToken*/
117521
117651
  void 0,
117522
- resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
117652
+ resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker),
117523
117653
  /*initializer*/
117524
117654
  void 0
117525
117655
  );
@@ -138309,7 +138439,7 @@ function getTypeNodeIfAccessible(type, enclosingScope, program, host) {
138309
138439
  const checker = program.getTypeChecker();
138310
138440
  let typeIsAccessible = true;
138311
138441
  const notAccessible = () => typeIsAccessible = false;
138312
- const res = checker.typeToTypeNode(type, enclosingScope, 1 /* NoTruncation */, {
138442
+ const res = checker.typeToTypeNode(type, enclosingScope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */, {
138313
138443
  trackSymbol: (symbol, declaration, meaning) => {
138314
138444
  typeIsAccessible = typeIsAccessible && checker.isSymbolAccessible(
138315
138445
  symbol,
@@ -144166,7 +144296,7 @@ function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols
144166
144296
  deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
144167
144297
  const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(getNormalizedAbsolutePath(oldFile.fileName, program.getCurrentDirectory())), targetFileName);
144168
144298
  if (getStringComparer(!program.useCaseSensitiveFileNames())(pathToTargetFileWithExtension, sourceFile.fileName) === 0 /* EqualTo */) return;
144169
- const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
144299
+ const newModuleSpecifier = ts_moduleSpecifiers_exports.getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
144170
144300
  const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
144171
144301
  if (newImportDeclaration) changes.insertNodeAfter(sourceFile, statement, newImportDeclaration);
144172
144302
  const ns = getNamespaceLikeImport(importNode);
@@ -147233,7 +147363,7 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
147233
147363
  if (!isJS) {
147234
147364
  let type = checker.getTypeOfSymbolAtLocation(usage.symbol, usage.node);
147235
147365
  type = checker.getBaseTypeOfLiteralType(type);
147236
- typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(checker, importAdder, type, scope, scriptTarget, 1 /* NoTruncation */);
147366
+ typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(checker, importAdder, type, scope, scriptTarget, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
147237
147367
  }
147238
147368
  const paramDecl = factory.createParameterDeclaration(
147239
147369
  /*modifiers*/
@@ -147262,7 +147392,7 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
147262
147392
  )) : void 0;
147263
147393
  if (isExpression(node) && !isJS) {
147264
147394
  const contextualType = checker.getContextualType(node);
147265
- returnType = checker.typeToTypeNode(contextualType, scope, 1 /* NoTruncation */);
147395
+ returnType = checker.typeToTypeNode(contextualType, scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
147266
147396
  }
147267
147397
  const { body, returnValueProperty } = transformFunctionBody(node, exposedVariableDeclarations, writes, substitutions, !!(range.facts & 1 /* HasReturn */));
147268
147398
  suppressLeadingAndTrailingTrivia(body);
@@ -147302,7 +147432,8 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
147302
147432
  checker.typeToTypeNode(
147303
147433
  checker.getTypeAtLocation(range.thisNode),
147304
147434
  scope,
147305
- 1 /* NoTruncation */
147435
+ 1 /* NoTruncation */,
147436
+ 8 /* AllowUnresolvedNames */
147306
147437
  ),
147307
147438
  /*initializer*/
147308
147439
  void 0
@@ -147399,7 +147530,8 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
147399
147530
  const variableType = checker.typeToTypeNode(
147400
147531
  checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(variableDeclaration)),
147401
147532
  scope,
147402
- 1 /* NoTruncation */
147533
+ 1 /* NoTruncation */,
147534
+ 8 /* AllowUnresolvedNames */
147403
147535
  );
147404
147536
  typeElements.push(factory.createPropertySignature(
147405
147537
  /*modifiers*/
@@ -147530,7 +147662,7 @@ function extractConstantInScope(node, scope, { substitutions }, rangeFacts, cont
147530
147662
  const file = scope.getSourceFile();
147531
147663
  const localNameText = getIdentifierForNode(node, scope, checker, file);
147532
147664
  const isJS = isInJSFile(scope);
147533
- let variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode(checker.getContextualType(node), scope, 1 /* NoTruncation */);
147665
+ let variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode(checker.getContextualType(node), scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
147534
147666
  let initializer = transformConstantInitializer(skipParentheses(node), substitutions);
147535
147667
  ({ variableType, initializer } = transformFunctionInitializerAndType(variableType, initializer));
147536
147668
  suppressLeadingAndTrailingTrivia(initializer);
@@ -147655,13 +147787,13 @@ function extractConstantInScope(node, scope, { substitutions }, rangeFacts, cont
147655
147787
  } else {
147656
147788
  const paramType = checker.getTypeAtLocation(p);
147657
147789
  if (paramType === checker.getAnyType()) hasAny = true;
147658
- parameters.push(factory.updateParameterDeclaration(p, p.modifiers, p.dotDotDotToken, p.name, p.questionToken, p.type || checker.typeToTypeNode(paramType, scope, 1 /* NoTruncation */), p.initializer));
147790
+ parameters.push(factory.updateParameterDeclaration(p, p.modifiers, p.dotDotDotToken, p.name, p.questionToken, p.type || checker.typeToTypeNode(paramType, scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */), p.initializer));
147659
147791
  }
147660
147792
  }
147661
147793
  if (hasAny) return { variableType: variableType2, initializer: initializer2 };
147662
147794
  variableType2 = void 0;
147663
147795
  if (isArrowFunction(initializer2)) {
147664
- initializer2 = factory.updateArrowFunction(initializer2, canHaveModifiers(node) ? getModifiers(node) : void 0, initializer2.typeParameters, parameters, initializer2.type || checker.typeToTypeNode(functionSignature.getReturnType(), scope, 1 /* NoTruncation */), initializer2.equalsGreaterThanToken, initializer2.body);
147796
+ initializer2 = factory.updateArrowFunction(initializer2, canHaveModifiers(node) ? getModifiers(node) : void 0, initializer2.typeParameters, parameters, initializer2.type || checker.typeToTypeNode(functionSignature.getReturnType(), scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */), initializer2.equalsGreaterThanToken, initializer2.body);
147665
147797
  } else {
147666
147798
  if (functionSignature && !!functionSignature.thisParameter) {
147667
147799
  const firstParameter = firstOrUndefined(parameters);
@@ -147678,7 +147810,7 @@ function extractConstantInScope(node, scope, { substitutions }, rangeFacts, cont
147678
147810
  "this",
147679
147811
  /*questionToken*/
147680
147812
  void 0,
147681
- checker.typeToTypeNode(thisType, scope, 1 /* NoTruncation */)
147813
+ checker.typeToTypeNode(thisType, scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */)
147682
147814
  )
147683
147815
  );
147684
147816
  }
@@ -148299,7 +148431,7 @@ function getInfo4(context) {
148299
148431
  if (signature) {
148300
148432
  const typePredicate = typeChecker.getTypePredicateOfSignature(signature);
148301
148433
  if (typePredicate && typePredicate.type) {
148302
- const typePredicateTypeNode = typeChecker.typePredicateToTypePredicateNode(typePredicate, declaration, 1 /* NoTruncation */);
148434
+ const typePredicateTypeNode = typeChecker.typePredicateToTypePredicateNode(typePredicate, declaration, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
148303
148435
  if (typePredicateTypeNode) {
148304
148436
  return { declaration, returnTypeNode: typePredicateTypeNode };
148305
148437
  }
@@ -148311,7 +148443,7 @@ function getInfo4(context) {
148311
148443
  if (!returnType) {
148312
148444
  return { error: getLocaleSpecificMessage(Diagnostics.Could_not_determine_function_return_type) };
148313
148445
  }
148314
- const returnTypeNode = typeChecker.typeToTypeNode(returnType, declaration, 1 /* NoTruncation */);
148446
+ const returnTypeNode = typeChecker.typeToTypeNode(returnType, declaration, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
148315
148447
  if (returnTypeNode) {
148316
148448
  return { declaration, returnTypeNode };
148317
148449
  }
@@ -154823,6 +154955,8 @@ function addMissingDeclarations(context, implementedTypeNode, sourceFile, classD
154823
154955
  classDeclaration,
154824
154956
  /*flags*/
154825
154957
  void 0,
154958
+ /*internalFlags*/
154959
+ void 0,
154826
154960
  getNoopSymbolTrackerWithResolver(context)
154827
154961
  ));
154828
154962
  }
@@ -156454,6 +156588,8 @@ function addMissingConstraint(changes, program, preferences, host, sourceFile, i
156454
156588
  scriptTarget,
156455
156589
  /*flags*/
156456
156590
  void 0,
156591
+ /*internalFlags*/
156592
+ void 0,
156457
156593
  tracker
156458
156594
  );
156459
156595
  if (typeNode) {
@@ -157561,14 +157697,15 @@ function getTypeNode2(checker, node, token) {
157561
157697
  const binaryExpression = token.parent.parent;
157562
157698
  const otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left;
157563
157699
  const widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)));
157564
- typeNode = checker.typeToTypeNode(widenedType, node, 1 /* NoTruncation */);
157700
+ typeNode = checker.typeToTypeNode(widenedType, node, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
157565
157701
  } else {
157566
157702
  const contextualType = checker.getContextualType(token.parent);
157567
157703
  typeNode = contextualType ? checker.typeToTypeNode(
157568
157704
  contextualType,
157569
157705
  /*enclosingDeclaration*/
157570
157706
  void 0,
157571
- 1 /* NoTruncation */
157707
+ 1 /* NoTruncation */,
157708
+ 8 /* AllowUnresolvedNames */
157572
157709
  ) : void 0;
157573
157710
  }
157574
157711
  return typeNode || factory.createKeywordTypeNode(133 /* AnyKeyword */);
@@ -157890,7 +158027,9 @@ function createPropertyNameFromSymbol(symbol, target, quotePreference, checker)
157890
158027
  111551 /* Value */,
157891
158028
  /*enclosingDeclaration*/
157892
158029
  void 0,
157893
- 1073741824 /* WriteComputedProps */
158030
+ /*flags*/
158031
+ void 0,
158032
+ 1 /* WriteComputedProps */
157894
158033
  );
157895
158034
  if (prop && isComputedPropertyName(prop)) return prop;
157896
158035
  }
@@ -158063,7 +158202,7 @@ function tryGetName2(node) {
158063
158202
  }
158064
158203
  }
158065
158204
  function typeToTypeNode(checker, type, enclosingDeclaration) {
158066
- return checker.typeToTypeNode(checker.getWidenedType(type), enclosingDeclaration, 1 /* NoTruncation */) ?? factory.createKeywordTypeNode(159 /* UnknownKeyword */);
158205
+ return checker.typeToTypeNode(checker.getWidenedType(type), enclosingDeclaration, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */) ?? factory.createKeywordTypeNode(159 /* UnknownKeyword */);
158067
158206
  }
158068
158207
  function doChange19(changes, program, preferences, host, declarations, newParameters) {
158069
158208
  const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
@@ -159366,7 +159505,8 @@ var canHaveTypeAnnotation = /* @__PURE__ */ new Set([
159366
159505
  206 /* ObjectBindingPattern */,
159367
159506
  207 /* ArrayBindingPattern */
159368
159507
  ]);
159369
- var declarationEmitNodeBuilderFlags2 = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */ | 1073741824 /* WriteComputedProps */;
159508
+ var declarationEmitNodeBuilderFlags2 = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
159509
+ var declarationEmitInternalNodeBuilderFlags2 = 1 /* WriteComputedProps */;
159370
159510
  registerCodeFix({
159371
159511
  errorCodes: errorCodes47,
159372
159512
  fixIds: [fixId36],
@@ -160152,7 +160292,7 @@ function withContext(context, typePrintMode, cb) {
160152
160292
  }
160153
160293
  function typeToTypeNode2(type, enclosingDeclaration, flags = 0 /* None */) {
160154
160294
  let isTruncated = false;
160155
- const result2 = typeToAutoImportableTypeNode(typeChecker, importAdder, type, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, {
160295
+ const result2 = typeToAutoImportableTypeNode(typeChecker, importAdder, type, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, declarationEmitInternalNodeBuilderFlags2, {
160156
160296
  moduleResolverHost: program,
160157
160297
  trackSymbol() {
160158
160298
  return true;
@@ -160165,7 +160305,7 @@ function withContext(context, typePrintMode, cb) {
160165
160305
  }
160166
160306
  function typePredicateToTypeNode(typePredicate, enclosingDeclaration, flags = 0 /* None */) {
160167
160307
  let isTruncated = false;
160168
- const result2 = typePredicateToAutoImportableTypeNode(typeChecker, importAdder, typePredicate, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, {
160308
+ const result2 = typePredicateToAutoImportableTypeNode(typeChecker, importAdder, typePredicate, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, declarationEmitInternalNodeBuilderFlags2, {
160169
160309
  moduleResolverHost: program,
160170
160310
  trackSymbol() {
160171
160311
  return true;
@@ -161492,7 +161632,7 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
161492
161632
  case 172 /* PropertyDeclaration */:
161493
161633
  let flags = 1 /* NoTruncation */;
161494
161634
  flags |= quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0;
161495
- let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context));
161635
+ let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
161496
161636
  if (importAdder) {
161497
161637
  const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
161498
161638
  if (importableReference) {
@@ -161517,6 +161657,8 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
161517
161657
  enclosingDeclaration,
161518
161658
  /*flags*/
161519
161659
  void 0,
161660
+ /*internalFlags*/
161661
+ void 0,
161520
161662
  getNoopSymbolTrackerWithResolver(context)
161521
161663
  );
161522
161664
  const allAccessors = getAllAccessorDeclarations(declarations, declaration);
@@ -161646,7 +161788,7 @@ function createSignatureDeclarationFromSignature(kind, context, quotePreference,
161646
161788
  const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
161647
161789
  const isJs = isInJSFile(enclosingDeclaration);
161648
161790
  const flags = 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */ | 524288 /* AllowEmptyTuple */ | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
161649
- const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context));
161791
+ const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
161650
161792
  if (!signatureDeclaration) {
161651
161793
  return void 0;
161652
161794
  }
@@ -161747,6 +161889,7 @@ function createSignatureDeclarationFromCallExpression(kind, context, importAdder
161747
161889
  contextNode,
161748
161890
  scriptTarget,
161749
161891
  1 /* NoTruncation */,
161892
+ 8 /* AllowUnresolvedNames */,
161750
161893
  tracker
161751
161894
  );
161752
161895
  const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : void 0;
@@ -161765,6 +161908,8 @@ function createSignatureDeclarationFromCallExpression(kind, context, importAdder
161765
161908
  contextNode,
161766
161909
  /*flags*/
161767
161910
  void 0,
161911
+ /*internalFlags*/
161912
+ void 0,
161768
161913
  tracker
161769
161914
  );
161770
161915
  switch (kind) {
@@ -161834,8 +161979,8 @@ function createTypeParametersForArguments(checker, argumentTypeParameters, typeA
161834
161979
  function createTypeParameterName(index) {
161835
161980
  return 84 /* T */ + index <= 90 /* Z */ ? String.fromCharCode(84 /* T */ + index) : `T${index}`;
161836
161981
  }
161837
- function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, scriptTarget, flags, tracker) {
161838
- let typeNode = checker.typeToTypeNode(type, contextNode, flags, tracker);
161982
+ function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, scriptTarget, flags, internalFlags, tracker) {
161983
+ let typeNode = checker.typeToTypeNode(type, contextNode, flags, internalFlags, tracker);
161839
161984
  if (typeNode && isImportTypeNode(typeNode)) {
161840
161985
  const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
161841
161986
  if (importableReference) {
@@ -161845,8 +161990,8 @@ function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, s
161845
161990
  }
161846
161991
  return getSynthesizedDeepClone(typeNode);
161847
161992
  }
161848
- function typePredicateToAutoImportableTypeNode(checker, importAdder, typePredicate, contextNode, scriptTarget, flags, tracker) {
161849
- let typePredicateNode = checker.typePredicateToTypePredicateNode(typePredicate, contextNode, flags, tracker);
161993
+ function typePredicateToAutoImportableTypeNode(checker, importAdder, typePredicate, contextNode, scriptTarget, flags, internalFlags, tracker) {
161994
+ let typePredicateNode = checker.typePredicateToTypePredicateNode(typePredicate, contextNode, flags, internalFlags, tracker);
161850
161995
  if ((typePredicateNode == null ? void 0 : typePredicateNode.type) && isImportTypeNode(typePredicateNode.type)) {
161851
161996
  const importableReference = tryGetAutoImportableReferenceFromTypeNode(typePredicateNode.type, scriptTarget);
161852
161997
  if (importableReference) {
@@ -161862,7 +162007,7 @@ function typeContainsTypeParameter(type) {
161862
162007
  }
161863
162008
  return type.flags & 262144 /* TypeParameter */;
161864
162009
  }
161865
- function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes, contextNode, scriptTarget, flags, tracker) {
162010
+ function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes, contextNode, scriptTarget, flags, internalFlags, tracker) {
161866
162011
  const argumentTypeNodes = [];
161867
162012
  const argumentTypeParameters = /* @__PURE__ */ new Map();
161868
162013
  for (let i = 0; i < instanceTypes.length; i += 1) {
@@ -161874,13 +162019,13 @@ function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes,
161874
162019
  continue;
161875
162020
  }
161876
162021
  const widenedInstanceType = checker.getBaseTypeOfLiteralType(instanceType);
161877
- const argumentTypeNode = typeToAutoImportableTypeNode(checker, importAdder, widenedInstanceType, contextNode, scriptTarget, flags, tracker);
162022
+ const argumentTypeNode = typeToAutoImportableTypeNode(checker, importAdder, widenedInstanceType, contextNode, scriptTarget, flags, internalFlags, tracker);
161878
162023
  if (!argumentTypeNode) {
161879
162024
  continue;
161880
162025
  }
161881
162026
  argumentTypeNodes.push(argumentTypeNode);
161882
162027
  const argumentTypeParameter = getFirstTypeParameterName(instanceType);
161883
- const instanceTypeConstraint = instanceType.isTypeParameter() && instanceType.constraint && !isAnonymousObjectConstraintType(instanceType.constraint) ? typeToAutoImportableTypeNode(checker, importAdder, instanceType.constraint, contextNode, scriptTarget, flags, tracker) : void 0;
162028
+ const instanceTypeConstraint = instanceType.isTypeParameter() && instanceType.constraint && !isAnonymousObjectConstraintType(instanceType.constraint) ? typeToAutoImportableTypeNode(checker, importAdder, instanceType.constraint, contextNode, scriptTarget, flags, internalFlags, tracker) : void 0;
161884
162029
  if (argumentTypeParameter) {
161885
162030
  argumentTypeParameters.set(argumentTypeParameter, { argumentType: instanceType, constraint: instanceTypeConstraint });
161886
162031
  }
@@ -161980,7 +162125,7 @@ function createMethodImplementingSignatures(checker, context, enclosingDeclarati
161980
162125
  function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
161981
162126
  if (length(signatures)) {
161982
162127
  const type = checker.getUnionType(map(signatures, checker.getReturnTypeOfSignature));
161983
- return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, getNoopSymbolTrackerWithResolver(context));
162128
+ return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
161984
162129
  }
161985
162130
  }
161986
162131
  function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
@@ -163266,9 +163411,9 @@ function originIsComputedPropertyName(origin) {
163266
163411
  return !!(origin && origin.kind & 512 /* ComputedPropertyName */);
163267
163412
  }
163268
163413
  function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
163269
- var _a, _b, _c;
163414
+ var _a, _b, _c, _d;
163270
163415
  const start = timestamp();
163271
- const needsFullResolution = isForImportStatementCompletion || moduleResolutionSupportsPackageJsonExportsAndImports(getEmitModuleResolutionKind(program.getCompilerOptions()));
163416
+ const needsFullResolution = isForImportStatementCompletion || getResolvePackageJsonExports(program.getCompilerOptions()) || ((_a = preferences.autoImportSpecifierExcludeRegexes) == null ? void 0 : _a.length);
163272
163417
  let skippedAny = false;
163273
163418
  let ambientCount = 0;
163274
163419
  let resolvedCount = 0;
@@ -163281,9 +163426,9 @@ function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position,
163281
163426
  resolvedBeyondLimit: () => resolvedCount > moduleSpecifierResolutionLimit
163282
163427
  });
163283
163428
  const hitRateMessage = cacheAttemptCount ? ` (${(resolvedFromCacheCount / cacheAttemptCount * 100).toFixed(1)}% hit rate)` : "";
163284
- (_a = host.log) == null ? void 0 : _a.call(host, `${logPrefix}: resolved ${resolvedCount} module specifiers, plus ${ambientCount} ambient and ${resolvedFromCacheCount} from cache${hitRateMessage}`);
163285
- (_b = host.log) == null ? void 0 : _b.call(host, `${logPrefix}: response is ${skippedAny ? "incomplete" : "complete"}`);
163286
- (_c = host.log) == null ? void 0 : _c.call(host, `${logPrefix}: ${timestamp() - start}`);
163429
+ (_b = host.log) == null ? void 0 : _b.call(host, `${logPrefix}: resolved ${resolvedCount} module specifiers, plus ${ambientCount} ambient and ${resolvedFromCacheCount} from cache${hitRateMessage}`);
163430
+ (_c = host.log) == null ? void 0 : _c.call(host, `${logPrefix}: response is ${skippedAny ? "incomplete" : "complete"}`);
163431
+ (_d = host.log) == null ? void 0 : _d.call(host, `${logPrefix}: ${timestamp() - start}`);
163287
163432
  return result;
163288
163433
  function tryResolve(exportInfo, isFromAmbientModule) {
163289
163434
  if (isFromAmbientModule) {
@@ -164555,7 +164700,14 @@ function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, pro
164555
164700
  if (signatures.length !== 1) {
164556
164701
  return void 0;
164557
164702
  }
164558
- const typeNode = checker.typeToTypeNode(effectiveType, enclosingDeclaration, builderFlags, ts_codefix_exports.getNoopSymbolTrackerWithResolver({ program, host }));
164703
+ const typeNode = checker.typeToTypeNode(
164704
+ effectiveType,
164705
+ enclosingDeclaration,
164706
+ builderFlags,
164707
+ /*internalFlags*/
164708
+ void 0,
164709
+ ts_codefix_exports.getNoopSymbolTrackerWithResolver({ program, host })
164710
+ );
164559
164711
  if (!typeNode || !isFunctionTypeNode(typeNode)) {
164560
164712
  return void 0;
164561
164713
  }
@@ -166788,7 +166940,13 @@ function getJsDocTagAtPosition(node, position) {
166788
166940
  }
166789
166941
  function getPropertiesForObjectExpression(contextualType, completionsType, obj, checker) {
166790
166942
  const hasCompletionsType = completionsType && completionsType !== contextualType;
166791
- const type = hasCompletionsType && !(completionsType.flags & 3 /* AnyOrUnknown */) ? checker.getUnionType([contextualType, completionsType]) : contextualType;
166943
+ const promiseFilteredContextualType = checker.getUnionType(
166944
+ filter(
166945
+ contextualType.flags & 1048576 /* Union */ ? contextualType.types : [contextualType],
166946
+ (t) => !checker.getPromisedTypeOfPromise(t)
166947
+ )
166948
+ );
166949
+ const type = hasCompletionsType && !(completionsType.flags & 3 /* AnyOrUnknown */) ? checker.getUnionType([promiseFilteredContextualType, completionsType]) : promiseFilteredContextualType;
166792
166950
  const properties = getApparentProperties(type, obj, checker);
166793
166951
  return type.isClass() && containsNonPublicProperties(properties) ? [] : hasCompletionsType ? filter(properties, hasDeclarationOtherThanSelf) : properties;
166794
166952
  function hasDeclarationOtherThanSelf(member) {
@@ -167659,7 +167817,7 @@ function getFilenameWithExtensionOption(name, program, extensionOptions, isExpor
167659
167817
  if (extensionOptions.referenceKind === 0 /* Filename */) {
167660
167818
  return { name, extension: tryGetExtensionFromPath2(name) };
167661
167819
  }
167662
- let allowedEndings = getModuleSpecifierPreferences(
167820
+ let allowedEndings = ts_moduleSpecifiers_exports.getModuleSpecifierPreferences(
167663
167821
  { importModuleSpecifierEnding: extensionOptions.endingPreference },
167664
167822
  program,
167665
167823
  program.getCompilerOptions(),
@@ -179235,6 +179393,7 @@ __export(ts_exports2, {
179235
179393
  InlayHintKind: () => InlayHintKind2,
179236
179394
  InlayHints: () => ts_InlayHints_exports,
179237
179395
  InternalEmitFlags: () => InternalEmitFlags,
179396
+ InternalNodeBuilderFlags: () => InternalNodeBuilderFlags,
179238
179397
  InternalSymbolName: () => InternalSymbolName,
179239
179398
  IntersectionFlags: () => IntersectionFlags,
179240
179399
  InvalidatedProjectKind: () => InvalidatedProjectKind,
@@ -180222,6 +180381,7 @@ __export(ts_exports2, {
180222
180381
  hasEffectiveModifiers: () => hasEffectiveModifiers,
180223
180382
  hasEffectiveReadonlyModifier: () => hasEffectiveReadonlyModifier,
180224
180383
  hasExtension: () => hasExtension,
180384
+ hasImplementationTSFileExtension: () => hasImplementationTSFileExtension,
180225
180385
  hasIndexSignature: () => hasIndexSignature,
180226
180386
  hasInferredType: () => hasInferredType,
180227
180387
  hasInitializer: () => hasInitializer,
@@ -193620,6 +193780,7 @@ if (typeof console !== "undefined") {
193620
193780
  InlayHintKind,
193621
193781
  InlayHints,
193622
193782
  InternalEmitFlags,
193783
+ InternalNodeBuilderFlags,
193623
193784
  InternalSymbolName,
193624
193785
  IntersectionFlags,
193625
193786
  InvalidatedProjectKind,
@@ -194607,6 +194768,7 @@ if (typeof console !== "undefined") {
194607
194768
  hasEffectiveModifiers,
194608
194769
  hasEffectiveReadonlyModifier,
194609
194770
  hasExtension,
194771
+ hasImplementationTSFileExtension,
194610
194772
  hasIndexSignature,
194611
194773
  hasInferredType,
194612
194774
  hasInitializer,