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/tsc.js +241 -110
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +313 -151
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240810`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -5527,6 +5527,13 @@ function changeAnyExtension(path, ext, extensions, ignoreCase) {
|
|
|
5527
5527
|
const pathext = extensions !== void 0 && ignoreCase !== void 0 ? getAnyExtensionFromPath(path, extensions, ignoreCase) : getAnyExtensionFromPath(path);
|
|
5528
5528
|
return pathext ? path.slice(0, path.length - pathext.length) + (startsWith(ext, ".") ? ext : "." + ext) : path;
|
|
5529
5529
|
}
|
|
5530
|
+
function changeFullExtension(path, newExtension) {
|
|
5531
|
+
const declarationExtension = getDeclarationFileExtension(path);
|
|
5532
|
+
if (declarationExtension) {
|
|
5533
|
+
return path.slice(0, path.length - declarationExtension.length) + (startsWith(newExtension, ".") ? newExtension : "." + newExtension);
|
|
5534
|
+
}
|
|
5535
|
+
return changeAnyExtension(path, newExtension);
|
|
5536
|
+
}
|
|
5530
5537
|
var relativePathSegmentRegExp = /(?:\/\/)|(?:^|\/)\.\.?(?:$|\/)/;
|
|
5531
5538
|
function comparePathsWorker(a, b, componentComparer) {
|
|
5532
5539
|
if (a === b) return 0 /* EqualTo */;
|
|
@@ -18255,6 +18262,9 @@ function hasJSFileExtension(fileName) {
|
|
|
18255
18262
|
function hasTSFileExtension(fileName) {
|
|
18256
18263
|
return some(supportedTSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
|
|
18257
18264
|
}
|
|
18265
|
+
function hasImplementationTSFileExtension(fileName) {
|
|
18266
|
+
return some(supportedTSImplementationExtensions, (extension) => fileExtensionIs(fileName, extension)) && !isDeclarationFileName(fileName);
|
|
18267
|
+
}
|
|
18258
18268
|
function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtension, hasTSFileExtension)) {
|
|
18259
18269
|
return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
|
|
18260
18270
|
}
|
|
@@ -21271,7 +21281,11 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
21271
21281
|
node.modifiers = asNodeArray(modifiers);
|
|
21272
21282
|
node.parameters = createNodeArray(parameters);
|
|
21273
21283
|
node.body = body;
|
|
21274
|
-
|
|
21284
|
+
if (!node.body) {
|
|
21285
|
+
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
21286
|
+
} else {
|
|
21287
|
+
node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildrenFlags(node.parameters) | propagateChildFlags(node.body) & ~67108864 /* ContainsPossibleTopLevelAwait */ | 1024 /* ContainsES2015 */;
|
|
21288
|
+
}
|
|
21275
21289
|
node.typeParameters = void 0;
|
|
21276
21290
|
node.type = void 0;
|
|
21277
21291
|
node.typeArguments = void 0;
|
|
@@ -25405,7 +25419,7 @@ var asyncGeneratorHelper = {
|
|
|
25405
25419
|
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
25406
25420
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
25407
25421
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
25408
|
-
return i =
|
|
25422
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
25409
25423
|
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
25410
25424
|
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]); } }
|
|
25411
25425
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
@@ -25587,8 +25601,8 @@ var generatorHelper = {
|
|
|
25587
25601
|
priority: 6,
|
|
25588
25602
|
text: `
|
|
25589
25603
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
25590
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
25591
|
-
return g =
|
|
25604
|
+
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);
|
|
25605
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25592
25606
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25593
25607
|
function step(op) {
|
|
25594
25608
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -44339,9 +44353,32 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
44339
44353
|
}
|
|
44340
44354
|
|
|
44341
44355
|
// src/compiler/moduleSpecifiers.ts
|
|
44342
|
-
|
|
44356
|
+
var stringToRegex = memoizeOne((pattern) => {
|
|
44357
|
+
try {
|
|
44358
|
+
let slash = pattern.indexOf("/");
|
|
44359
|
+
if (slash !== 0) {
|
|
44360
|
+
return new RegExp(pattern);
|
|
44361
|
+
}
|
|
44362
|
+
const lastSlash = pattern.lastIndexOf("/");
|
|
44363
|
+
if (slash === lastSlash) {
|
|
44364
|
+
return new RegExp(pattern);
|
|
44365
|
+
}
|
|
44366
|
+
while ((slash = pattern.indexOf("/", slash + 1)) !== lastSlash) {
|
|
44367
|
+
if (pattern[slash - 1] !== "\\") {
|
|
44368
|
+
return new RegExp(pattern);
|
|
44369
|
+
}
|
|
44370
|
+
}
|
|
44371
|
+
const flags = pattern.substring(lastSlash + 1).replace(/[^iu]/g, "");
|
|
44372
|
+
pattern = pattern.substring(1, lastSlash);
|
|
44373
|
+
return new RegExp(pattern, flags);
|
|
44374
|
+
} catch {
|
|
44375
|
+
return void 0;
|
|
44376
|
+
}
|
|
44377
|
+
});
|
|
44378
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding, autoImportSpecifierExcludeRegexes }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
44343
44379
|
const filePreferredEnding = getPreferredEnding();
|
|
44344
44380
|
return {
|
|
44381
|
+
excludeRegexes: autoImportSpecifierExcludeRegexes,
|
|
44345
44382
|
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 */,
|
|
44346
44383
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
44347
44384
|
const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
|
|
@@ -44410,7 +44447,13 @@ function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSo
|
|
|
44410
44447
|
function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
44411
44448
|
let computedWithoutCache = false;
|
|
44412
44449
|
const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
|
|
44413
|
-
if (ambient)
|
|
44450
|
+
if (ambient) {
|
|
44451
|
+
return {
|
|
44452
|
+
kind: "ambient",
|
|
44453
|
+
moduleSpecifiers: !(forAutoImport && isExcludedByRegex(ambient, userPreferences.autoImportSpecifierExcludeRegexes)) ? [ambient] : emptyArray,
|
|
44454
|
+
computedWithoutCache
|
|
44455
|
+
};
|
|
44456
|
+
}
|
|
44414
44457
|
let [kind, specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
|
|
44415
44458
|
moduleSymbol,
|
|
44416
44459
|
importingSourceFile,
|
|
@@ -44470,9 +44513,11 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
44470
44513
|
void 0,
|
|
44471
44514
|
options.overrideImportMode
|
|
44472
44515
|
) : void 0;
|
|
44473
|
-
|
|
44474
|
-
|
|
44475
|
-
|
|
44516
|
+
if (specifier && !(forAutoImport && isExcludedByRegex(specifier, preferences.excludeRegexes))) {
|
|
44517
|
+
nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
|
|
44518
|
+
if (modulePath.isRedirect) {
|
|
44519
|
+
return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
|
|
44520
|
+
}
|
|
44476
44521
|
}
|
|
44477
44522
|
if (!specifier) {
|
|
44478
44523
|
const local = getLocalModuleSpecifier(
|
|
@@ -44485,7 +44530,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
44485
44530
|
/*pathsOnly*/
|
|
44486
44531
|
modulePath.isRedirect
|
|
44487
44532
|
);
|
|
44488
|
-
if (!local) {
|
|
44533
|
+
if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
|
|
44489
44534
|
continue;
|
|
44490
44535
|
}
|
|
44491
44536
|
if (modulePath.isRedirect) {
|
|
@@ -44501,7 +44546,13 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
44501
44546
|
}
|
|
44502
44547
|
}
|
|
44503
44548
|
}
|
|
44504
|
-
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:
|
|
44549
|
+
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 };
|
|
44550
|
+
}
|
|
44551
|
+
function isExcludedByRegex(moduleSpecifier, excludeRegexes) {
|
|
44552
|
+
return some(excludeRegexes, (pattern) => {
|
|
44553
|
+
var _a;
|
|
44554
|
+
return !!((_a = stringToRegex(pattern)) == null ? void 0 : _a.test(moduleSpecifier));
|
|
44555
|
+
});
|
|
44505
44556
|
}
|
|
44506
44557
|
function getInfo(importingSourceFileName, host) {
|
|
44507
44558
|
importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
|
|
@@ -44514,7 +44565,7 @@ function getInfo(importingSourceFileName, host) {
|
|
|
44514
44565
|
canonicalSourceDirectory: getCanonicalFileName(sourceDirectory)
|
|
44515
44566
|
};
|
|
44516
44567
|
}
|
|
44517
|
-
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference }, pathsOnly) {
|
|
44568
|
+
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference, excludeRegexes }, pathsOnly) {
|
|
44518
44569
|
const { baseUrl, paths, rootDirs } = compilerOptions;
|
|
44519
44570
|
if (pathsOnly && !paths) {
|
|
44520
44571
|
return void 0;
|
|
@@ -44530,7 +44581,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
44530
44581
|
if (!relativeToBaseUrl) {
|
|
44531
44582
|
return pathsOnly ? void 0 : relativePath;
|
|
44532
44583
|
}
|
|
44533
|
-
const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(
|
|
44584
|
+
const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(
|
|
44585
|
+
moduleFileName,
|
|
44586
|
+
sourceDirectory,
|
|
44587
|
+
compilerOptions,
|
|
44588
|
+
host,
|
|
44589
|
+
importMode,
|
|
44590
|
+
prefersTsExtension(allowedEndings)
|
|
44591
|
+
);
|
|
44534
44592
|
const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
|
|
44535
44593
|
if (pathsOnly) {
|
|
44536
44594
|
return fromPaths;
|
|
@@ -44539,6 +44597,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
44539
44597
|
if (!maybeNonRelative) {
|
|
44540
44598
|
return relativePath;
|
|
44541
44599
|
}
|
|
44600
|
+
const relativeIsExcluded = isExcludedByRegex(relativePath, excludeRegexes);
|
|
44601
|
+
const nonRelativeIsExcluded = isExcludedByRegex(maybeNonRelative, excludeRegexes);
|
|
44602
|
+
if (!relativeIsExcluded && nonRelativeIsExcluded) {
|
|
44603
|
+
return relativePath;
|
|
44604
|
+
}
|
|
44605
|
+
if (relativeIsExcluded && !nonRelativeIsExcluded) {
|
|
44606
|
+
return maybeNonRelative;
|
|
44607
|
+
}
|
|
44542
44608
|
if (relativePreference === 1 /* NonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
44543
44609
|
return maybeNonRelative;
|
|
44544
44610
|
}
|
|
@@ -44763,7 +44829,7 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
|
|
|
44763
44829
|
return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
|
|
44764
44830
|
}
|
|
44765
44831
|
}
|
|
44766
|
-
function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports) {
|
|
44832
|
+
function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports, preferTsExtension) {
|
|
44767
44833
|
if (typeof exports2 === "string") {
|
|
44768
44834
|
const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
|
|
44769
44835
|
const getCommonSourceDirectory2 = () => host.getCommonSourceDirectory();
|
|
@@ -44775,6 +44841,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44775
44841
|
void 0
|
|
44776
44842
|
);
|
|
44777
44843
|
const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
|
|
44844
|
+
const canTryTsExtension = preferTsExtension && hasImplementationTSFileExtension(targetFilePath);
|
|
44778
44845
|
switch (mode) {
|
|
44779
44846
|
case 0 /* Exact */:
|
|
44780
44847
|
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 */) {
|
|
@@ -44782,6 +44849,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44782
44849
|
}
|
|
44783
44850
|
break;
|
|
44784
44851
|
case 1 /* Directory */:
|
|
44852
|
+
if (canTryTsExtension && containsPath(targetFilePath, pathOrPattern, ignoreCase)) {
|
|
44853
|
+
const fragment = getRelativePathFromDirectory(
|
|
44854
|
+
pathOrPattern,
|
|
44855
|
+
targetFilePath,
|
|
44856
|
+
/*ignoreCase*/
|
|
44857
|
+
false
|
|
44858
|
+
);
|
|
44859
|
+
return { moduleFileToTry: getNormalizedAbsolutePath(
|
|
44860
|
+
combinePaths(combinePaths(packageName, exports2), fragment),
|
|
44861
|
+
/*currentDirectory*/
|
|
44862
|
+
void 0
|
|
44863
|
+
) };
|
|
44864
|
+
}
|
|
44785
44865
|
if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget, ignoreCase)) {
|
|
44786
44866
|
const fragment = getRelativePathFromDirectory(
|
|
44787
44867
|
pathOrPattern,
|
|
@@ -44795,7 +44875,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44795
44875
|
void 0
|
|
44796
44876
|
) };
|
|
44797
44877
|
}
|
|
44798
|
-
if (containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
|
|
44878
|
+
if (!canTryTsExtension && containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
|
|
44799
44879
|
const fragment = getRelativePathFromDirectory(
|
|
44800
44880
|
pathOrPattern,
|
|
44801
44881
|
targetFilePath,
|
|
@@ -44818,12 +44898,12 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44818
44898
|
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
44819
44899
|
}
|
|
44820
44900
|
if (declarationFile && containsPath(pathOrPattern, declarationFile, ignoreCase)) {
|
|
44821
|
-
const fragment = getRelativePathFromDirectory(
|
|
44901
|
+
const fragment = changeFullExtension(getRelativePathFromDirectory(
|
|
44822
44902
|
pathOrPattern,
|
|
44823
44903
|
declarationFile,
|
|
44824
44904
|
/*ignoreCase*/
|
|
44825
44905
|
false
|
|
44826
|
-
);
|
|
44906
|
+
), getJSExtensionForFile(declarationFile, options));
|
|
44827
44907
|
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
44828
44908
|
}
|
|
44829
44909
|
break;
|
|
@@ -44831,11 +44911,15 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44831
44911
|
const starPos = pathOrPattern.indexOf("*");
|
|
44832
44912
|
const leadingSlice = pathOrPattern.slice(0, starPos);
|
|
44833
44913
|
const trailingSlice = pathOrPattern.slice(starPos + 1);
|
|
44914
|
+
if (canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
|
|
44915
|
+
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
44916
|
+
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
44917
|
+
}
|
|
44834
44918
|
if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice, ignoreCase) && endsWith(extensionSwappedTarget, trailingSlice, ignoreCase)) {
|
|
44835
44919
|
const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
|
|
44836
44920
|
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
44837
44921
|
}
|
|
44838
|
-
if (startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
|
|
44922
|
+
if (!canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
|
|
44839
44923
|
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
44840
44924
|
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
44841
44925
|
}
|
|
@@ -44845,17 +44929,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44845
44929
|
}
|
|
44846
44930
|
if (declarationFile && startsWith(declarationFile, leadingSlice, ignoreCase) && endsWith(declarationFile, trailingSlice, ignoreCase)) {
|
|
44847
44931
|
const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
|
|
44848
|
-
|
|
44932
|
+
const substituted = replaceFirstStar(packageName, starReplacement);
|
|
44933
|
+
const jsExtension = tryGetJSExtensionForFile(declarationFile, options);
|
|
44934
|
+
return jsExtension ? { moduleFileToTry: changeFullExtension(substituted, jsExtension) } : void 0;
|
|
44849
44935
|
}
|
|
44850
44936
|
break;
|
|
44851
44937
|
}
|
|
44852
44938
|
} else if (Array.isArray(exports2)) {
|
|
44853
|
-
return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
|
|
44939
|
+
return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports, preferTsExtension));
|
|
44854
44940
|
} else if (typeof exports2 === "object" && exports2 !== null) {
|
|
44855
44941
|
for (const key of getOwnKeys(exports2)) {
|
|
44856
44942
|
if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
|
|
44857
44943
|
const subTarget = exports2[key];
|
|
44858
|
-
const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
|
|
44944
|
+
const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports, preferTsExtension);
|
|
44859
44945
|
if (result) {
|
|
44860
44946
|
return result;
|
|
44861
44947
|
}
|
|
@@ -44883,6 +44969,8 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
|
|
|
44883
44969
|
conditions,
|
|
44884
44970
|
mode,
|
|
44885
44971
|
/*isImports*/
|
|
44972
|
+
false,
|
|
44973
|
+
/*preferTsExtension*/
|
|
44886
44974
|
false
|
|
44887
44975
|
);
|
|
44888
44976
|
});
|
|
@@ -44897,10 +44985,12 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
|
|
|
44897
44985
|
conditions,
|
|
44898
44986
|
0 /* Exact */,
|
|
44899
44987
|
/*isImports*/
|
|
44988
|
+
false,
|
|
44989
|
+
/*preferTsExtension*/
|
|
44900
44990
|
false
|
|
44901
44991
|
);
|
|
44902
44992
|
}
|
|
44903
|
-
function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
|
|
44993
|
+
function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode, preferTsExtension) {
|
|
44904
44994
|
var _a, _b, _c;
|
|
44905
44995
|
if (!host.readFile || !getResolvePackageJsonImports(options)) {
|
|
44906
44996
|
return void 0;
|
|
@@ -44933,7 +45023,8 @@ function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory,
|
|
|
44933
45023
|
conditions,
|
|
44934
45024
|
mode,
|
|
44935
45025
|
/*isImports*/
|
|
44936
|
-
true
|
|
45026
|
+
true,
|
|
45027
|
+
preferTsExtension
|
|
44937
45028
|
);
|
|
44938
45029
|
})) == null ? void 0 : _c.moduleFileToTry;
|
|
44939
45030
|
}
|
|
@@ -45015,7 +45106,15 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
45015
45106
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
45016
45107
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
45017
45108
|
const conditions = getConditions(options, importMode);
|
|
45018
|
-
const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(
|
|
45109
|
+
const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(
|
|
45110
|
+
options,
|
|
45111
|
+
host,
|
|
45112
|
+
path,
|
|
45113
|
+
packageRootPath,
|
|
45114
|
+
packageName2,
|
|
45115
|
+
packageJsonContent.exports,
|
|
45116
|
+
conditions
|
|
45117
|
+
) : void 0;
|
|
45019
45118
|
if (fromExports) {
|
|
45020
45119
|
return { ...fromExports, verbatimFromExports: true };
|
|
45021
45120
|
}
|
|
@@ -45163,6 +45262,10 @@ function isPathRelativeToParent(path) {
|
|
|
45163
45262
|
function getDefaultResolutionModeForFile(file, host, compilerOptions) {
|
|
45164
45263
|
return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
|
|
45165
45264
|
}
|
|
45265
|
+
function prefersTsExtension(allowedEndings) {
|
|
45266
|
+
const tsPriority = allowedEndings.indexOf(3 /* TsExtension */);
|
|
45267
|
+
return tsPriority > -1 && tsPriority < allowedEndings.indexOf(2 /* JsExtension */);
|
|
45268
|
+
}
|
|
45166
45269
|
|
|
45167
45270
|
// src/compiler/checker.ts
|
|
45168
45271
|
var ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -49357,6 +49460,7 @@ function createTypeChecker(host) {
|
|
|
49357
49460
|
}
|
|
49358
49461
|
function symbolToString(symbol, enclosingDeclaration, meaning, flags = 4 /* AllowAnyNodeKind */, writer) {
|
|
49359
49462
|
let nodeFlags = 70221824 /* IgnoreErrors */;
|
|
49463
|
+
let internalNodeFlags = 0 /* None */;
|
|
49360
49464
|
if (flags & 2 /* UseOnlyExternalAliasing */) {
|
|
49361
49465
|
nodeFlags |= 128 /* UseOnlyExternalAliasing */;
|
|
49362
49466
|
}
|
|
@@ -49367,15 +49471,15 @@ function createTypeChecker(host) {
|
|
|
49367
49471
|
nodeFlags |= 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
49368
49472
|
}
|
|
49369
49473
|
if (flags & 32 /* DoNotIncludeSymbolChain */) {
|
|
49370
|
-
|
|
49474
|
+
internalNodeFlags |= 4 /* DoNotIncludeSymbolChain */;
|
|
49371
49475
|
}
|
|
49372
49476
|
if (flags & 16 /* WriteComputedProps */) {
|
|
49373
|
-
|
|
49477
|
+
internalNodeFlags |= 1 /* WriteComputedProps */;
|
|
49374
49478
|
}
|
|
49375
49479
|
const builder = flags & 4 /* AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName;
|
|
49376
49480
|
return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
|
|
49377
49481
|
function symbolToStringWorker(writer2) {
|
|
49378
|
-
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
|
|
49482
|
+
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags, internalNodeFlags);
|
|
49379
49483
|
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 307 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
|
|
49380
49484
|
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
|
49381
49485
|
printer.writeNode(
|
|
@@ -49412,7 +49516,13 @@ function createTypeChecker(host) {
|
|
|
49412
49516
|
}
|
|
49413
49517
|
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")) {
|
|
49414
49518
|
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
|
|
49415
|
-
const typeNode = nodeBuilder.typeToTypeNode(
|
|
49519
|
+
const typeNode = nodeBuilder.typeToTypeNode(
|
|
49520
|
+
type,
|
|
49521
|
+
enclosingDeclaration,
|
|
49522
|
+
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0 /* None */),
|
|
49523
|
+
/*internalFlags*/
|
|
49524
|
+
void 0
|
|
49525
|
+
);
|
|
49416
49526
|
if (typeNode === void 0) return Debug.fail("should always get typenode");
|
|
49417
49527
|
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
|
|
49418
49528
|
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
|
@@ -49461,31 +49571,31 @@ function createTypeChecker(host) {
|
|
|
49461
49571
|
}
|
|
49462
49572
|
function createNodeBuilder() {
|
|
49463
49573
|
return {
|
|
49464
|
-
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
49465
|
-
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
49466
|
-
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
49467
|
-
serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
|
|
49468
|
-
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
49469
|
-
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
49574
|
+
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
49575
|
+
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
49576
|
+
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
49577
|
+
serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
|
|
49578
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
49579
|
+
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
49470
49580
|
indexInfo,
|
|
49471
49581
|
context,
|
|
49472
49582
|
/*typeNode*/
|
|
49473
49583
|
void 0
|
|
49474
49584
|
)),
|
|
49475
|
-
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
|
|
49476
|
-
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToName(
|
|
49585
|
+
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
|
|
49586
|
+
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToName(
|
|
49477
49587
|
symbol,
|
|
49478
49588
|
context,
|
|
49479
49589
|
meaning,
|
|
49480
49590
|
/*expectsIdentifier*/
|
|
49481
49591
|
false
|
|
49482
49592
|
)),
|
|
49483
|
-
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
|
|
49484
|
-
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
49485
|
-
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
49486
|
-
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
49487
|
-
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
49488
|
-
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
49593
|
+
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
|
|
49594
|
+
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
49595
|
+
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
49596
|
+
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
49597
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
49598
|
+
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
49489
49599
|
};
|
|
49490
49600
|
function getTypeFromTypeNode2(context, node, noMappedTypes) {
|
|
49491
49601
|
const type = getTypeFromTypeNodeWithoutContext(node);
|
|
@@ -49507,13 +49617,13 @@ function createTypeChecker(host) {
|
|
|
49507
49617
|
return setTextRange(setOriginalNode(range, location), location);
|
|
49508
49618
|
}
|
|
49509
49619
|
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
49510
|
-
const
|
|
49511
|
-
if (expr && !(context.
|
|
49620
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
49621
|
+
if (expr && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
49512
49622
|
syntacticNodeBuilder.serializeTypeOfExpression(expr, context, addUndefined);
|
|
49513
49623
|
}
|
|
49514
|
-
context.
|
|
49624
|
+
context.internalFlags |= 2 /* NoSyntacticPrinter */;
|
|
49515
49625
|
const result = expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined);
|
|
49516
|
-
|
|
49626
|
+
restoreFlags();
|
|
49517
49627
|
return result;
|
|
49518
49628
|
}
|
|
49519
49629
|
function expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined) {
|
|
@@ -49566,7 +49676,7 @@ function createTypeChecker(host) {
|
|
|
49566
49676
|
return void 0;
|
|
49567
49677
|
}
|
|
49568
49678
|
function symbolToNode(symbol, context, meaning) {
|
|
49569
|
-
if (context.
|
|
49679
|
+
if (context.internalFlags & 1 /* WriteComputedProps */) {
|
|
49570
49680
|
if (symbol.valueDeclaration) {
|
|
49571
49681
|
const name = getNameOfDeclaration(symbol.valueDeclaration);
|
|
49572
49682
|
if (name && isComputedPropertyName(name)) return name;
|
|
@@ -49579,12 +49689,13 @@ function createTypeChecker(host) {
|
|
|
49579
49689
|
}
|
|
49580
49690
|
return symbolToExpression(symbol, context, meaning);
|
|
49581
49691
|
}
|
|
49582
|
-
function withContext(enclosingDeclaration, flags, tracker, cb) {
|
|
49583
|
-
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost :
|
|
49692
|
+
function withContext(enclosingDeclaration, flags, internalFlags, tracker, cb) {
|
|
49693
|
+
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
|
49584
49694
|
const context = {
|
|
49585
49695
|
enclosingDeclaration,
|
|
49586
49696
|
enclosingFile: enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration),
|
|
49587
49697
|
flags: flags || 0 /* None */,
|
|
49698
|
+
internalFlags: internalFlags || 0 /* None */,
|
|
49588
49699
|
tracker: void 0,
|
|
49589
49700
|
encounteredError: false,
|
|
49590
49701
|
reportedDiagnostic: false,
|
|
@@ -49614,14 +49725,23 @@ function createTypeChecker(host) {
|
|
|
49614
49725
|
}
|
|
49615
49726
|
return context.encounteredError ? void 0 : resultingNode;
|
|
49616
49727
|
}
|
|
49728
|
+
function saveRestoreFlags(context) {
|
|
49729
|
+
const flags = context.flags;
|
|
49730
|
+
const internalFlags = context.internalFlags;
|
|
49731
|
+
return restore;
|
|
49732
|
+
function restore() {
|
|
49733
|
+
context.flags = flags;
|
|
49734
|
+
context.internalFlags = internalFlags;
|
|
49735
|
+
}
|
|
49736
|
+
}
|
|
49617
49737
|
function checkTruncationLength(context) {
|
|
49618
49738
|
if (context.truncating) return context.truncating;
|
|
49619
49739
|
return context.truncating = context.approximateLength > (context.flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
|
|
49620
49740
|
}
|
|
49621
49741
|
function typeToTypeNodeHelper(type, context) {
|
|
49622
|
-
const
|
|
49742
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
49623
49743
|
const typeNode = typeToTypeNodeWorker(type, context);
|
|
49624
|
-
|
|
49744
|
+
restoreFlags();
|
|
49625
49745
|
return typeNode;
|
|
49626
49746
|
}
|
|
49627
49747
|
function typeToTypeNodeWorker(type, context) {
|
|
@@ -50075,7 +50195,7 @@ function createTypeChecker(host) {
|
|
|
50075
50195
|
context.symbolDepth = /* @__PURE__ */ new Map();
|
|
50076
50196
|
}
|
|
50077
50197
|
const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
|
50078
|
-
const key = `${getTypeId(type2)}|${context.flags}`;
|
|
50198
|
+
const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`;
|
|
50079
50199
|
if (links) {
|
|
50080
50200
|
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
|
|
50081
50201
|
}
|
|
@@ -50181,10 +50301,10 @@ function createTypeChecker(host) {
|
|
|
50181
50301
|
}
|
|
50182
50302
|
return typeToTypeNodeHelper(getIntersectionType(types), context);
|
|
50183
50303
|
}
|
|
50184
|
-
const
|
|
50304
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50185
50305
|
context.flags |= 4194304 /* InObjectTypeLiteral */;
|
|
50186
50306
|
const members = createTypeNodesFromResolvedType(resolved);
|
|
50187
|
-
|
|
50307
|
+
restoreFlags();
|
|
50188
50308
|
const typeLiteralNode = factory.createTypeLiteralNode(members);
|
|
50189
50309
|
context.approximateLength += 2;
|
|
50190
50310
|
setEmitFlags(typeLiteralNode, context.flags & 1024 /* MultilineObjectLiterals */ ? 0 : 1 /* SingleLine */);
|
|
@@ -50247,10 +50367,10 @@ function createTypeChecker(host) {
|
|
|
50247
50367
|
} while (i < length2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent);
|
|
50248
50368
|
if (!rangeEquals(outerTypeParameters, typeArguments, start, i)) {
|
|
50249
50369
|
const typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
|
|
50250
|
-
const
|
|
50370
|
+
const restoreFlags2 = saveRestoreFlags(context);
|
|
50251
50371
|
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
|
|
50252
50372
|
const ref = symbolToTypeNode(parent, context, 788968 /* Type */, typeArgumentSlice);
|
|
50253
|
-
|
|
50373
|
+
restoreFlags2();
|
|
50254
50374
|
resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
|
|
50255
50375
|
}
|
|
50256
50376
|
}
|
|
@@ -50288,10 +50408,10 @@ function createTypeChecker(host) {
|
|
|
50288
50408
|
}
|
|
50289
50409
|
typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
|
|
50290
50410
|
}
|
|
50291
|
-
const
|
|
50411
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50292
50412
|
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
|
|
50293
50413
|
const finalRef = symbolToTypeNode(type2.symbol, context, 788968 /* Type */, typeArgumentNodes);
|
|
50294
|
-
|
|
50414
|
+
restoreFlags();
|
|
50295
50415
|
return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
|
|
50296
50416
|
}
|
|
50297
50417
|
}
|
|
@@ -50603,7 +50723,7 @@ function createTypeChecker(host) {
|
|
|
50603
50723
|
}
|
|
50604
50724
|
}
|
|
50605
50725
|
if (seenNames) {
|
|
50606
|
-
const
|
|
50726
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50607
50727
|
context.flags |= 64 /* UseFullyQualifiedType */;
|
|
50608
50728
|
seenNames.forEach((types2) => {
|
|
50609
50729
|
if (!arrayIsHomogeneous(types2, ([a], [b]) => typesAreSameReference(a, b))) {
|
|
@@ -50612,7 +50732,7 @@ function createTypeChecker(host) {
|
|
|
50612
50732
|
}
|
|
50613
50733
|
}
|
|
50614
50734
|
});
|
|
50615
|
-
|
|
50735
|
+
restoreFlags();
|
|
50616
50736
|
}
|
|
50617
50737
|
return result;
|
|
50618
50738
|
}
|
|
@@ -50664,19 +50784,19 @@ function createTypeChecker(host) {
|
|
|
50664
50784
|
} else {
|
|
50665
50785
|
typeParameters = signature.typeParameters && signature.typeParameters.map((parameter) => typeParameterToDeclaration(parameter, context));
|
|
50666
50786
|
}
|
|
50667
|
-
const
|
|
50787
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50668
50788
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
50669
50789
|
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 */));
|
|
50670
50790
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
50671
50791
|
if (thisParameter) {
|
|
50672
50792
|
parameters.unshift(thisParameter);
|
|
50673
50793
|
}
|
|
50674
|
-
|
|
50794
|
+
restoreFlags();
|
|
50675
50795
|
const returnTypeNode = serializeReturnTypeForSignature(context, signature);
|
|
50676
50796
|
let modifiers = options == null ? void 0 : options.modifiers;
|
|
50677
50797
|
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
|
|
50678
|
-
const
|
|
50679
|
-
modifiers = factory.createModifiersFromModifierFlags(
|
|
50798
|
+
const flags = modifiersToFlags(modifiers);
|
|
50799
|
+
modifiers = factory.createModifiersFromModifierFlags(flags | 64 /* Abstract */);
|
|
50680
50800
|
}
|
|
50681
50801
|
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(
|
|
50682
50802
|
modifiers,
|
|
@@ -50896,13 +51016,13 @@ function createTypeChecker(host) {
|
|
|
50896
51016
|
}
|
|
50897
51017
|
}
|
|
50898
51018
|
function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
|
|
50899
|
-
const
|
|
51019
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50900
51020
|
context.flags &= ~512 /* WriteTypeParametersInQualifiedName */;
|
|
50901
51021
|
const modifiers = factory.createModifiersFromModifierFlags(getTypeParameterModifiers(type));
|
|
50902
51022
|
const name = typeParameterToName(type, context);
|
|
50903
51023
|
const defaultParameter = getDefaultFromTypeParameter(type);
|
|
50904
51024
|
const defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context);
|
|
50905
|
-
|
|
51025
|
+
restoreFlags();
|
|
50906
51026
|
return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
|
|
50907
51027
|
}
|
|
50908
51028
|
function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
|
|
@@ -51006,7 +51126,7 @@ function createTypeChecker(host) {
|
|
|
51006
51126
|
function lookupSymbolChainWorker(symbol, context, meaning, yieldModuleSymbol) {
|
|
51007
51127
|
let chain;
|
|
51008
51128
|
const isTypeParameter = symbol.flags & 262144 /* TypeParameter */;
|
|
51009
|
-
if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64 /* UseFullyQualifiedType */) && !(context.
|
|
51129
|
+
if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64 /* UseFullyQualifiedType */) && !(context.internalFlags & 4 /* DoNotIncludeSymbolChain */)) {
|
|
51010
51130
|
chain = Debug.checkDefined(getSymbolChain(
|
|
51011
51131
|
symbol,
|
|
51012
51132
|
meaning,
|
|
@@ -51532,19 +51652,19 @@ function createTypeChecker(host) {
|
|
|
51532
51652
|
var _a, _b;
|
|
51533
51653
|
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
51534
51654
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
51535
|
-
const
|
|
51536
|
-
if (declaration && hasInferredType(declaration) && !(context.
|
|
51655
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
51656
|
+
if (declaration && hasInferredType(declaration) && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
51537
51657
|
syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, context);
|
|
51538
51658
|
}
|
|
51539
|
-
context.
|
|
51540
|
-
if (enclosingDeclaration && (!isErrorType(type) || context.
|
|
51659
|
+
context.internalFlags |= 2 /* NoSyntacticPrinter */;
|
|
51660
|
+
if (enclosingDeclaration && (!isErrorType(type) || context.internalFlags & 8 /* AllowUnresolvedNames */)) {
|
|
51541
51661
|
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
|
|
51542
51662
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
51543
51663
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
51544
51664
|
const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
|
|
51545
51665
|
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
51546
51666
|
if (result2) {
|
|
51547
|
-
|
|
51667
|
+
restoreFlags();
|
|
51548
51668
|
return result2;
|
|
51549
51669
|
}
|
|
51550
51670
|
}
|
|
@@ -51555,7 +51675,7 @@ function createTypeChecker(host) {
|
|
|
51555
51675
|
const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
|
|
51556
51676
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
51557
51677
|
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
|
|
51558
|
-
|
|
51678
|
+
restoreFlags();
|
|
51559
51679
|
return result;
|
|
51560
51680
|
}
|
|
51561
51681
|
function typeNodeIsEquivalentToType(annotatedDeclaration, type, typeFromTypeNode) {
|
|
@@ -51569,26 +51689,26 @@ function createTypeChecker(host) {
|
|
|
51569
51689
|
}
|
|
51570
51690
|
function serializeReturnTypeForSignature(context, signature) {
|
|
51571
51691
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
51572
|
-
const
|
|
51692
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
51573
51693
|
if (suppressAny) context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
51574
51694
|
let returnTypeNode;
|
|
51575
51695
|
const returnType = getReturnTypeOfSignature(signature);
|
|
51576
51696
|
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
51577
|
-
if (signature.declaration && !(context.
|
|
51697
|
+
if (signature.declaration && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
51578
51698
|
syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, context);
|
|
51579
51699
|
}
|
|
51580
|
-
context.
|
|
51700
|
+
context.internalFlags |= 2 /* NoSyntacticPrinter */;
|
|
51581
51701
|
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
|
|
51582
51702
|
} else if (!suppressAny) {
|
|
51583
51703
|
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
51584
51704
|
}
|
|
51585
|
-
|
|
51705
|
+
restoreFlags();
|
|
51586
51706
|
return returnTypeNode;
|
|
51587
51707
|
}
|
|
51588
51708
|
function serializeReturnTypeForSignatureWorker(context, signature) {
|
|
51589
51709
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
51590
51710
|
const type = getReturnTypeOfSignature(signature);
|
|
51591
|
-
if (context.enclosingDeclaration && (!isErrorType(type) || context.
|
|
51711
|
+
if (context.enclosingDeclaration && (!isErrorType(type) || context.internalFlags & 8 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
51592
51712
|
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
51593
51713
|
if (annotation) {
|
|
51594
51714
|
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
|
|
@@ -52090,7 +52210,7 @@ function createTypeChecker(host) {
|
|
|
52090
52210
|
if (!hasDynamicName(node)) {
|
|
52091
52211
|
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
52092
52212
|
}
|
|
52093
|
-
if (!(context.
|
|
52213
|
+
if (!(context.internalFlags & 8 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
|
|
52094
52214
|
return void 0;
|
|
52095
52215
|
}
|
|
52096
52216
|
}
|
|
@@ -52742,7 +52862,7 @@ function createTypeChecker(host) {
|
|
|
52742
52862
|
const typeParamDecls = map(typeParams, (p) => typeParameterToDeclaration(p, context));
|
|
52743
52863
|
const jsdocAliasDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isJSDocTypeAlias);
|
|
52744
52864
|
const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0);
|
|
52745
|
-
const
|
|
52865
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
52746
52866
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
52747
52867
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
52748
52868
|
context.enclosingDeclaration = jsdocAliasDecl;
|
|
@@ -52766,7 +52886,7 @@ function createTypeChecker(host) {
|
|
|
52766
52886
|
),
|
|
52767
52887
|
modifierFlags
|
|
52768
52888
|
);
|
|
52769
|
-
|
|
52889
|
+
restoreFlags();
|
|
52770
52890
|
context.enclosingDeclaration = oldEnclosingDecl;
|
|
52771
52891
|
}
|
|
52772
52892
|
function serializeInterface(symbol, symbolName2, modifierFlags) {
|
|
@@ -53775,10 +53895,10 @@ function createTypeChecker(host) {
|
|
|
53775
53895
|
}
|
|
53776
53896
|
function getNameCandidateWorker(symbol, localName) {
|
|
53777
53897
|
if (localName === "default" /* Default */ || localName === "__class" /* Class */ || localName === "__function" /* Function */) {
|
|
53778
|
-
const
|
|
53898
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
53779
53899
|
context.flags |= 16777216 /* InInitialEntityName */;
|
|
53780
53900
|
const nameCandidate = getNameOfSymbolAsWritten(symbol, context);
|
|
53781
|
-
|
|
53901
|
+
restoreFlags();
|
|
53782
53902
|
localName = nameCandidate.length > 0 && isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? stripQuotes(nameCandidate) : nameCandidate;
|
|
53783
53903
|
}
|
|
53784
53904
|
if (localName === "default" /* Default */) {
|
|
@@ -55361,7 +55481,8 @@ function createTypeChecker(host) {
|
|
|
55361
55481
|
if (!node) {
|
|
55362
55482
|
return void 0;
|
|
55363
55483
|
}
|
|
55364
|
-
|
|
55484
|
+
const kind = node.kind;
|
|
55485
|
+
switch (kind) {
|
|
55365
55486
|
case 263 /* ClassDeclaration */:
|
|
55366
55487
|
case 231 /* ClassExpression */:
|
|
55367
55488
|
case 264 /* InterfaceDeclaration */:
|
|
@@ -55383,13 +55504,19 @@ function createTypeChecker(host) {
|
|
|
55383
55504
|
case 200 /* MappedType */:
|
|
55384
55505
|
case 194 /* ConditionalType */: {
|
|
55385
55506
|
const outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
|
|
55386
|
-
if (
|
|
55507
|
+
if ((kind === 218 /* FunctionExpression */ || kind === 219 /* ArrowFunction */ || isObjectLiteralMethod(node)) && isContextSensitive(node)) {
|
|
55508
|
+
const signature = firstOrUndefined(getSignaturesOfType(getTypeOfSymbol(getSymbolOfDeclaration(node)), 0 /* Call */));
|
|
55509
|
+
if (signature && signature.typeParameters) {
|
|
55510
|
+
return [...outerTypeParameters || emptyArray, ...signature.typeParameters];
|
|
55511
|
+
}
|
|
55512
|
+
}
|
|
55513
|
+
if (kind === 200 /* MappedType */) {
|
|
55387
55514
|
return append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter)));
|
|
55388
|
-
} else if (
|
|
55515
|
+
} else if (kind === 194 /* ConditionalType */) {
|
|
55389
55516
|
return concatenate(outerTypeParameters, getInferTypeParameters(node));
|
|
55390
55517
|
}
|
|
55391
55518
|
const outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, getEffectiveTypeParameterDeclarations(node));
|
|
55392
|
-
const thisType = includeThisTypes && (
|
|
55519
|
+
const thisType = includeThisTypes && (kind === 263 /* ClassDeclaration */ || kind === 231 /* ClassExpression */ || kind === 264 /* InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node)).thisType;
|
|
55393
55520
|
return thisType ? append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
|
|
55394
55521
|
}
|
|
55395
55522
|
case 341 /* JSDocParameterTag */:
|
|
@@ -58201,8 +58328,11 @@ function createTypeChecker(host) {
|
|
|
58201
58328
|
true
|
|
58202
58329
|
);
|
|
58203
58330
|
}
|
|
58331
|
+
function getTypeParametersForMapper(signature) {
|
|
58332
|
+
return sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp);
|
|
58333
|
+
}
|
|
58204
58334
|
function createSignatureTypeMapper(signature, typeArguments) {
|
|
58205
|
-
return createTypeMapper(
|
|
58335
|
+
return createTypeMapper(getTypeParametersForMapper(signature), typeArguments);
|
|
58206
58336
|
}
|
|
58207
58337
|
function getErasedSignature(signature) {
|
|
58208
58338
|
return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
|
|
@@ -71216,7 +71346,7 @@ function createTypeChecker(host) {
|
|
|
71216
71346
|
type,
|
|
71217
71347
|
(t) => {
|
|
71218
71348
|
var _a;
|
|
71219
|
-
if (isGenericMappedType(t) &&
|
|
71349
|
+
if (isGenericMappedType(t) && getMappedTypeNameTypeKind(t) !== 2 /* Remapping */) {
|
|
71220
71350
|
const constraint = getConstraintTypeFromMappedType(t);
|
|
71221
71351
|
const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
71222
71352
|
const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
|
|
@@ -73902,7 +74032,7 @@ function createTypeChecker(host) {
|
|
|
73902
74032
|
return void 0;
|
|
73903
74033
|
}
|
|
73904
74034
|
function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) {
|
|
73905
|
-
const context = createInferenceContext(signature
|
|
74035
|
+
const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0 /* None */, compareTypes);
|
|
73906
74036
|
const restType = getEffectiveRestType(contextualSignature);
|
|
73907
74037
|
const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
|
|
73908
74038
|
const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
|
|
@@ -85939,14 +86069,14 @@ function createTypeChecker(host) {
|
|
|
85939
86069
|
return 11 /* ObjectType */;
|
|
85940
86070
|
}
|
|
85941
86071
|
}
|
|
85942
|
-
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker) {
|
|
86072
|
+
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, internalFlags, tracker) {
|
|
85943
86073
|
const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor);
|
|
85944
86074
|
if (!declaration) {
|
|
85945
86075
|
return factory.createToken(133 /* AnyKeyword */);
|
|
85946
86076
|
}
|
|
85947
86077
|
const symbol = getSymbolOfDeclaration(declaration);
|
|
85948
86078
|
const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
|
|
85949
|
-
return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
86079
|
+
return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, internalFlags, tracker);
|
|
85950
86080
|
}
|
|
85951
86081
|
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
85952
86082
|
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
@@ -85989,14 +86119,14 @@ function createTypeChecker(host) {
|
|
|
85989
86119
|
}
|
|
85990
86120
|
return candidateExpr;
|
|
85991
86121
|
}
|
|
85992
|
-
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
|
|
86122
|
+
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, internalFlags, tracker) {
|
|
85993
86123
|
const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
|
|
85994
86124
|
if (!signatureDeclaration) {
|
|
85995
86125
|
return factory.createToken(133 /* AnyKeyword */);
|
|
85996
86126
|
}
|
|
85997
|
-
return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
86127
|
+
return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, internalFlags, tracker);
|
|
85998
86128
|
}
|
|
85999
|
-
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
86129
|
+
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, internalFlags, tracker) {
|
|
86000
86130
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
86001
86131
|
if (!expr) {
|
|
86002
86132
|
return factory.createToken(133 /* AnyKeyword */);
|
|
@@ -86009,6 +86139,7 @@ function createTypeChecker(host) {
|
|
|
86009
86139
|
void 0,
|
|
86010
86140
|
enclosingDeclaration,
|
|
86011
86141
|
flags | 1024 /* MultilineObjectLiterals */,
|
|
86142
|
+
internalFlags,
|
|
86012
86143
|
tracker
|
|
86013
86144
|
);
|
|
86014
86145
|
}
|
|
@@ -86114,6 +86245,8 @@ function createTypeChecker(host) {
|
|
|
86114
86245
|
enclosing,
|
|
86115
86246
|
/*flags*/
|
|
86116
86247
|
void 0,
|
|
86248
|
+
/*internalFlags*/
|
|
86249
|
+
void 0,
|
|
86117
86250
|
tracker
|
|
86118
86251
|
) : type === trueType ? factory.createTrue() : type === falseType && factory.createFalse();
|
|
86119
86252
|
if (enumResult) return enumResult;
|
|
@@ -86242,15 +86375,15 @@ function createTypeChecker(host) {
|
|
|
86242
86375
|
const parseDecl = getParseTreeNode(decl);
|
|
86243
86376
|
return !!parseNode && !!parseDecl && (isVariableDeclaration(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl);
|
|
86244
86377
|
},
|
|
86245
|
-
getDeclarationStatementsForSourceFile: (node, flags, tracker) => {
|
|
86378
|
+
getDeclarationStatementsForSourceFile: (node, flags, internalFlags, tracker) => {
|
|
86246
86379
|
const n = getParseTreeNode(node);
|
|
86247
86380
|
Debug.assert(n && n.kind === 307 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile");
|
|
86248
86381
|
const sym = getSymbolOfDeclaration(node);
|
|
86249
86382
|
if (!sym) {
|
|
86250
|
-
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker);
|
|
86383
|
+
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, internalFlags, tracker);
|
|
86251
86384
|
}
|
|
86252
86385
|
resolveExternalModuleSymbol(sym);
|
|
86253
|
-
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
|
|
86386
|
+
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, internalFlags, tracker);
|
|
86254
86387
|
},
|
|
86255
86388
|
isImportRequiredByAugmentation,
|
|
86256
86389
|
isDefinitelyReferenceToGlobalSymbolObject
|
|
@@ -91222,7 +91355,6 @@ function transformTypeScript(context) {
|
|
|
91222
91355
|
let currentNamespaceContainerName;
|
|
91223
91356
|
let currentLexicalScope;
|
|
91224
91357
|
let currentScopeFirstDeclarationsOfName;
|
|
91225
|
-
let currentClassHasParameterProperties;
|
|
91226
91358
|
let enabledSubstitutions;
|
|
91227
91359
|
let applicableSubstitutions;
|
|
91228
91360
|
return transformSourceFileOrBundle;
|
|
@@ -91250,14 +91382,12 @@ function transformTypeScript(context) {
|
|
|
91250
91382
|
function saveStateAndInvoke(node, f) {
|
|
91251
91383
|
const savedCurrentScope = currentLexicalScope;
|
|
91252
91384
|
const savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
|
|
91253
|
-
const savedCurrentClassHasParameterProperties = currentClassHasParameterProperties;
|
|
91254
91385
|
onBeforeVisitNode(node);
|
|
91255
91386
|
const visited = f(node);
|
|
91256
91387
|
if (currentLexicalScope !== savedCurrentScope) {
|
|
91257
91388
|
currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
|
|
91258
91389
|
}
|
|
91259
91390
|
currentLexicalScope = savedCurrentScope;
|
|
91260
|
-
currentClassHasParameterProperties = savedCurrentClassHasParameterProperties;
|
|
91261
91391
|
return visited;
|
|
91262
91392
|
}
|
|
91263
91393
|
function onBeforeVisitNode(node) {
|
|
@@ -91890,7 +92020,7 @@ function transformTypeScript(context) {
|
|
|
91890
92020
|
}
|
|
91891
92021
|
function visitPropertyNameOfClassElement(member) {
|
|
91892
92022
|
const name = member.name;
|
|
91893
|
-
if (
|
|
92023
|
+
if (legacyDecorators && isComputedPropertyName(name) && hasDecorators(member)) {
|
|
91894
92024
|
const expression = visitNode(name.expression, visitor, isExpression);
|
|
91895
92025
|
Debug.assert(expression);
|
|
91896
92026
|
const innerExpression = skipPartiallyEmittedExpressions(expression);
|
|
@@ -111353,7 +111483,8 @@ function getDeclarationDiagnostics(host, resolver, file) {
|
|
|
111353
111483
|
false
|
|
111354
111484
|
).diagnostics : void 0;
|
|
111355
111485
|
}
|
|
111356
|
-
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ |
|
|
111486
|
+
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
|
|
111487
|
+
var declarationEmitInternalNodeBuilderFlags = 8 /* AllowUnresolvedNames */;
|
|
111357
111488
|
function transformDeclarations(context) {
|
|
111358
111489
|
const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
|
|
111359
111490
|
let getSymbolAccessibilityDiagnostic = throwDiagnostic;
|
|
@@ -111509,7 +111640,7 @@ function transformDeclarations(context) {
|
|
|
111509
111640
|
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,
|
|
111510
111641
|
errorNode: s.errorNode || sourceFile
|
|
111511
111642
|
};
|
|
111512
|
-
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
111643
|
+
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
111513
111644
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
111514
111645
|
return result;
|
|
111515
111646
|
}
|
|
@@ -111779,7 +111910,7 @@ function transformDeclarations(context) {
|
|
|
111779
111910
|
case 172 /* PropertyDeclaration */:
|
|
111780
111911
|
case 208 /* BindingElement */:
|
|
111781
111912
|
case 260 /* VariableDeclaration */:
|
|
111782
|
-
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
111913
|
+
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
111783
111914
|
break;
|
|
111784
111915
|
case 262 /* FunctionDeclaration */:
|
|
111785
111916
|
case 180 /* ConstructSignature */:
|
|
@@ -111787,7 +111918,7 @@ function transformDeclarations(context) {
|
|
|
111787
111918
|
case 174 /* MethodDeclaration */:
|
|
111788
111919
|
case 177 /* GetAccessor */:
|
|
111789
111920
|
case 179 /* CallSignature */:
|
|
111790
|
-
typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
111921
|
+
typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
111791
111922
|
break;
|
|
111792
111923
|
default:
|
|
111793
111924
|
Debug.assertNever(node);
|
|
@@ -112388,7 +112519,7 @@ function transformDeclarations(context) {
|
|
|
112388
112519
|
newId,
|
|
112389
112520
|
/*exclamationToken*/
|
|
112390
112521
|
void 0,
|
|
112391
|
-
resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
|
|
112522
|
+
resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker),
|
|
112392
112523
|
/*initializer*/
|
|
112393
112524
|
void 0
|
|
112394
112525
|
);
|
|
@@ -112514,7 +112645,7 @@ function transformDeclarations(context) {
|
|
|
112514
112645
|
return void 0;
|
|
112515
112646
|
}
|
|
112516
112647
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
|
|
112517
|
-
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags |
|
|
112648
|
+
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags | 2 /* NoSyntacticPrinter */, symbolTracker);
|
|
112518
112649
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
112519
112650
|
const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
|
|
112520
112651
|
const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
|
|
@@ -112717,7 +112848,7 @@ function transformDeclarations(context) {
|
|
|
112717
112848
|
newId,
|
|
112718
112849
|
/*exclamationToken*/
|
|
112719
112850
|
void 0,
|
|
112720
|
-
resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
|
|
112851
|
+
resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker),
|
|
112721
112852
|
/*initializer*/
|
|
112722
112853
|
void 0
|
|
112723
112854
|
);
|