typescript 4.8.2 → 4.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +165 -137
- package/lib/tsserver.js +186 -152
- package/lib/tsserverlibrary.d.ts +0 -1
- package/lib/tsserverlibrary.js +185 -151
- package/lib/typescript.js +177 -143
- package/lib/typescriptServices.js +177 -143
- package/lib/typingsInstaller.js +176 -142
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -303,7 +303,7 @@ var ts;
|
|
|
303
303
|
// The following is baselined as a literal template type without intervention
|
|
304
304
|
/** The version of the TypeScript compiler release */
|
|
305
305
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
306
|
-
ts.version = "4.8.
|
|
306
|
+
ts.version = "4.8.4";
|
|
307
307
|
/* @internal */
|
|
308
308
|
var Comparison;
|
|
309
309
|
(function (Comparison) {
|
|
@@ -9069,7 +9069,7 @@ var ts;
|
|
|
9069
9069
|
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig."),
|
|
9070
9070
|
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add 'jquery' to the types field in your tsconfig."),
|
|
9071
9071
|
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig."),
|
|
9072
|
-
|
|
9072
|
+
This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594", "This module is declared with 'export =', and can only be used with a default import when using the '{0}' flag."),
|
|
9073
9073
|
_0_can_only_be_imported_by_using_a_default_import: diag(2595, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_default_import_2595", "'{0}' can only be imported by using a default import."),
|
|
9074
9074
|
_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import: diag(2596, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import_2596", "'{0}' can only be imported by turning on the 'esModuleInterop' flag and using a default import."),
|
|
9075
9075
|
_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import: diag(2597, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import_2597", "'{0}' can only be imported by using a 'require' call or by using a default import."),
|
|
@@ -31710,6 +31710,7 @@ var ts;
|
|
|
31710
31710
|
case 335 /* SyntaxKind.JSDocProtectedTag */:
|
|
31711
31711
|
case 336 /* SyntaxKind.JSDocReadonlyTag */:
|
|
31712
31712
|
case 331 /* SyntaxKind.JSDocDeprecatedTag */:
|
|
31713
|
+
case 337 /* SyntaxKind.JSDocOverrideTag */:
|
|
31713
31714
|
return visitNode(cbNode, node.tagName)
|
|
31714
31715
|
|| (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
|
|
31715
31716
|
case 350 /* SyntaxKind.PartiallyEmittedExpression */:
|
|
@@ -42998,7 +42999,7 @@ var ts;
|
|
|
42998
42999
|
function withPackageId(packageInfo, r) {
|
|
42999
43000
|
var packageId;
|
|
43000
43001
|
if (r && packageInfo) {
|
|
43001
|
-
var packageJsonContent = packageInfo.packageJsonContent;
|
|
43002
|
+
var packageJsonContent = packageInfo.contents.packageJsonContent;
|
|
43002
43003
|
if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") {
|
|
43003
43004
|
packageId = {
|
|
43004
43005
|
name: packageJsonContent.name,
|
|
@@ -44317,16 +44318,16 @@ var ts;
|
|
|
44317
44318
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
|
|
44318
44319
|
if (considerPackageJson === void 0) { considerPackageJson = true; }
|
|
44319
44320
|
var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined;
|
|
44320
|
-
var packageJsonContent = packageInfo && packageInfo.packageJsonContent;
|
|
44321
|
-
var versionPaths = packageInfo && packageInfo.versionPaths;
|
|
44321
|
+
var packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
|
|
44322
|
+
var versionPaths = packageInfo && packageInfo.contents.versionPaths;
|
|
44322
44323
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
44323
44324
|
}
|
|
44324
44325
|
/* @internal */
|
|
44325
44326
|
function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) {
|
|
44326
|
-
if (!resolveJs && packageJsonInfo.resolvedEntrypoints !== undefined) {
|
|
44327
|
+
if (!resolveJs && packageJsonInfo.contents.resolvedEntrypoints !== undefined) {
|
|
44327
44328
|
// Cached value excludes resolutions to JS files - those could be
|
|
44328
44329
|
// cached separately, but they're used rarely.
|
|
44329
|
-
return packageJsonInfo.resolvedEntrypoints;
|
|
44330
|
+
return packageJsonInfo.contents.resolvedEntrypoints;
|
|
44330
44331
|
}
|
|
44331
44332
|
var entrypoints;
|
|
44332
44333
|
var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
|
|
@@ -44335,13 +44336,13 @@ var ts;
|
|
|
44335
44336
|
requireState.conditions = ["node", "require", "types"];
|
|
44336
44337
|
requireState.requestContainingDirectory = packageJsonInfo.packageDirectory;
|
|
44337
44338
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
44338
|
-
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
44339
|
+
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.contents.packageJsonContent, packageJsonInfo.contents.versionPaths);
|
|
44339
44340
|
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
44340
|
-
if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) {
|
|
44341
|
+
if (features & NodeResolutionFeatures.Exports && packageJsonInfo.contents.packageJsonContent.exports) {
|
|
44341
44342
|
for (var _i = 0, _a = [["node", "import", "types"], ["node", "require", "types"]]; _i < _a.length; _i++) {
|
|
44342
44343
|
var conditions = _a[_i];
|
|
44343
44344
|
var exportState = __assign(__assign({}, requireState), { failedLookupLocations: [], conditions: conditions });
|
|
44344
|
-
var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.packageJsonContent.exports, exportState, extensions);
|
|
44345
|
+
var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.contents.packageJsonContent.exports, exportState, extensions);
|
|
44345
44346
|
if (exportResolutions) {
|
|
44346
44347
|
for (var _b = 0, exportResolutions_1 = exportResolutions; _b < exportResolutions_1.length; _b++) {
|
|
44347
44348
|
var resolution = exportResolutions_1[_b];
|
|
@@ -44350,7 +44351,7 @@ var ts;
|
|
|
44350
44351
|
}
|
|
44351
44352
|
}
|
|
44352
44353
|
}
|
|
44353
|
-
return packageJsonInfo.resolvedEntrypoints = entrypoints || false;
|
|
44354
|
+
return packageJsonInfo.contents.resolvedEntrypoints = entrypoints || false;
|
|
44354
44355
|
}
|
|
44355
44356
|
ts.getEntrypointsFromPackageJsonInfo = getEntrypointsFromPackageJsonInfo;
|
|
44356
44357
|
function loadEntrypointsFromExportMap(scope, exports, state, extensions) {
|
|
@@ -44454,7 +44455,9 @@ var ts;
|
|
|
44454
44455
|
if (traceEnabled)
|
|
44455
44456
|
trace(host, ts.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
|
|
44456
44457
|
state.affectingLocations.push(packageJsonPath);
|
|
44457
|
-
return existing
|
|
44458
|
+
return existing.packageDirectory === packageDirectory ?
|
|
44459
|
+
existing :
|
|
44460
|
+
{ packageDirectory: packageDirectory, contents: existing.contents };
|
|
44458
44461
|
}
|
|
44459
44462
|
else {
|
|
44460
44463
|
if (existing && traceEnabled)
|
|
@@ -44470,7 +44473,7 @@ var ts;
|
|
|
44470
44473
|
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
44471
44474
|
}
|
|
44472
44475
|
var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
|
|
44473
|
-
var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
44476
|
+
var result = { packageDirectory: packageDirectory, contents: { packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined } };
|
|
44474
44477
|
(_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
44475
44478
|
state.affectingLocations.push(packageJsonPath);
|
|
44476
44479
|
return result;
|
|
@@ -44595,17 +44598,16 @@ var ts;
|
|
|
44595
44598
|
}
|
|
44596
44599
|
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
44597
44600
|
var _a, _b;
|
|
44598
|
-
var
|
|
44599
|
-
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
44601
|
+
var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
44600
44602
|
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44601
|
-
if (!scope || !scope.packageJsonContent.exports) {
|
|
44603
|
+
if (!scope || !scope.contents.packageJsonContent.exports) {
|
|
44602
44604
|
return undefined;
|
|
44603
44605
|
}
|
|
44604
|
-
if (typeof scope.packageJsonContent.name !== "string") {
|
|
44606
|
+
if (typeof scope.contents.packageJsonContent.name !== "string") {
|
|
44605
44607
|
return undefined;
|
|
44606
44608
|
}
|
|
44607
44609
|
var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry
|
|
44608
|
-
var nameParts = ts.getPathComponents(scope.packageJsonContent.name);
|
|
44610
|
+
var nameParts = ts.getPathComponents(scope.contents.packageJsonContent.name);
|
|
44609
44611
|
if (!ts.every(nameParts, function (p, i) { return parts[i] === p; })) {
|
|
44610
44612
|
return undefined;
|
|
44611
44613
|
}
|
|
@@ -44613,30 +44615,30 @@ var ts;
|
|
|
44613
44615
|
return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : ".".concat(ts.directorySeparator).concat(trailingParts.join(ts.directorySeparator)), state, cache, redirectedReference);
|
|
44614
44616
|
}
|
|
44615
44617
|
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
44616
|
-
if (!scope.packageJsonContent.exports) {
|
|
44618
|
+
if (!scope.contents.packageJsonContent.exports) {
|
|
44617
44619
|
return undefined;
|
|
44618
44620
|
}
|
|
44619
44621
|
if (subpath === ".") {
|
|
44620
44622
|
var mainExport = void 0;
|
|
44621
|
-
if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) {
|
|
44622
|
-
mainExport = scope.packageJsonContent.exports;
|
|
44623
|
+
if (typeof scope.contents.packageJsonContent.exports === "string" || Array.isArray(scope.contents.packageJsonContent.exports) || (typeof scope.contents.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.contents.packageJsonContent.exports))) {
|
|
44624
|
+
mainExport = scope.contents.packageJsonContent.exports;
|
|
44623
44625
|
}
|
|
44624
|
-
else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) {
|
|
44625
|
-
mainExport = scope.packageJsonContent.exports["."];
|
|
44626
|
+
else if (ts.hasProperty(scope.contents.packageJsonContent.exports, ".")) {
|
|
44627
|
+
mainExport = scope.contents.packageJsonContent.exports["."];
|
|
44626
44628
|
}
|
|
44627
44629
|
if (mainExport) {
|
|
44628
44630
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false);
|
|
44629
44631
|
return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false);
|
|
44630
44632
|
}
|
|
44631
44633
|
}
|
|
44632
|
-
else if (allKeysStartWithDot(scope.packageJsonContent.exports)) {
|
|
44633
|
-
if (typeof scope.packageJsonContent.exports !== "object") {
|
|
44634
|
+
else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) {
|
|
44635
|
+
if (typeof scope.contents.packageJsonContent.exports !== "object") {
|
|
44634
44636
|
if (state.traceEnabled) {
|
|
44635
44637
|
trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory);
|
|
44636
44638
|
}
|
|
44637
44639
|
return toSearchResult(/*value*/ undefined);
|
|
44638
44640
|
}
|
|
44639
|
-
var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, /*isImports*/ false);
|
|
44641
|
+
var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.contents.packageJsonContent.exports, scope, /*isImports*/ false);
|
|
44640
44642
|
if (result) {
|
|
44641
44643
|
return result;
|
|
44642
44644
|
}
|
|
@@ -44654,8 +44656,7 @@ var ts;
|
|
|
44654
44656
|
}
|
|
44655
44657
|
return toSearchResult(/*value*/ undefined);
|
|
44656
44658
|
}
|
|
44657
|
-
var
|
|
44658
|
-
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
44659
|
+
var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
44659
44660
|
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44660
44661
|
if (!scope) {
|
|
44661
44662
|
if (state.traceEnabled) {
|
|
@@ -44663,13 +44664,13 @@ var ts;
|
|
|
44663
44664
|
}
|
|
44664
44665
|
return toSearchResult(/*value*/ undefined);
|
|
44665
44666
|
}
|
|
44666
|
-
if (!scope.packageJsonContent.imports) {
|
|
44667
|
+
if (!scope.contents.packageJsonContent.imports) {
|
|
44667
44668
|
if (state.traceEnabled) {
|
|
44668
44669
|
trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory);
|
|
44669
44670
|
}
|
|
44670
44671
|
return toSearchResult(/*value*/ undefined);
|
|
44671
44672
|
}
|
|
44672
|
-
var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, /*isImports*/ true);
|
|
44673
|
+
var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.contents.packageJsonContent.imports, scope, /*isImports*/ true);
|
|
44673
44674
|
if (result) {
|
|
44674
44675
|
return result;
|
|
44675
44676
|
}
|
|
@@ -44830,7 +44831,7 @@ var ts;
|
|
|
44830
44831
|
var _a, _b;
|
|
44831
44832
|
if (path === undefined)
|
|
44832
44833
|
return path;
|
|
44833
|
-
return ts.
|
|
44834
|
+
return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
44834
44835
|
}
|
|
44835
44836
|
function combineDirectoryPath(root, dir) {
|
|
44836
44837
|
return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
|
|
@@ -44850,7 +44851,7 @@ var ts;
|
|
|
44850
44851
|
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
|
44851
44852
|
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
|
44852
44853
|
&& finalPath.indexOf("/node_modules/") === -1
|
|
44853
|
-
&& (state.compilerOptions.configFile ? ts.
|
|
44854
|
+
&& (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
|
|
44854
44855
|
// So that all means we'll only try these guesses for files outside `node_modules` in a directory where the `package.json` and `tsconfig.json` are siblings.
|
|
44855
44856
|
// Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
|
|
44856
44857
|
// `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
|
|
@@ -44906,7 +44907,7 @@ var ts;
|
|
|
44906
44907
|
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
44907
44908
|
for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
|
|
44908
44909
|
var candidateDir = candidateDirectories_1[_e];
|
|
44909
|
-
if (ts.
|
|
44910
|
+
if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
|
|
44910
44911
|
// The matched export is looking up something in either the out declaration or js dir, now map the written path back into the source dir and source extension
|
|
44911
44912
|
var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
|
|
44912
44913
|
var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
|
|
@@ -45014,7 +45015,7 @@ var ts;
|
|
|
45014
45015
|
if (fromFile) {
|
|
45015
45016
|
return noPackageId(fromFile);
|
|
45016
45017
|
}
|
|
45017
|
-
var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
|
|
45018
|
+
var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.contents.packageJsonContent, packageInfo.contents.versionPaths);
|
|
45018
45019
|
return withPackageId(packageInfo, fromDirectory);
|
|
45019
45020
|
}
|
|
45020
45021
|
}
|
|
@@ -45022,14 +45023,14 @@ var ts;
|
|
|
45022
45023
|
var loader = function (extensions, candidate, onlyRecordFailures, state) {
|
|
45023
45024
|
var _a;
|
|
45024
45025
|
// package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them)
|
|
45025
|
-
if (packageInfo && packageInfo.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
|
|
45026
|
+
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
|
|
45026
45027
|
return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
|
|
45027
45028
|
}
|
|
45028
45029
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
45029
|
-
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
45030
|
+
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths);
|
|
45030
45031
|
if (!pathAndExtension && packageInfo
|
|
45031
45032
|
// eslint-disable-next-line no-null/no-null
|
|
45032
|
-
&& (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
|
|
45033
|
+
&& (packageInfo.contents.packageJsonContent.exports === undefined || packageInfo.contents.packageJsonContent.exports === null)
|
|
45033
45034
|
&& state.features & NodeResolutionFeatures.EsmMode) {
|
|
45034
45035
|
// EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
|
|
45035
45036
|
// a default `index.js` entrypoint if no `main` or `exports` are present
|
|
@@ -45041,12 +45042,12 @@ var ts;
|
|
|
45041
45042
|
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
|
|
45042
45043
|
// Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings.
|
|
45043
45044
|
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
45044
|
-
if (packageInfo && packageInfo.versionPaths) {
|
|
45045
|
+
if (packageInfo && packageInfo.contents.versionPaths) {
|
|
45045
45046
|
if (state.traceEnabled) {
|
|
45046
|
-
trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.versionPaths.version, ts.version, rest);
|
|
45047
|
+
trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest);
|
|
45047
45048
|
}
|
|
45048
45049
|
var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
|
|
45049
|
-
var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state);
|
|
45050
|
+
var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state);
|
|
45050
45051
|
if (fromPaths) {
|
|
45051
45052
|
return fromPaths.value;
|
|
45052
45053
|
}
|
|
@@ -49347,6 +49348,7 @@ var ts;
|
|
|
49347
49348
|
var wildcardType = createIntrinsicType(1 /* TypeFlags.Any */, "any");
|
|
49348
49349
|
var errorType = createIntrinsicType(1 /* TypeFlags.Any */, "error");
|
|
49349
49350
|
var unresolvedType = createIntrinsicType(1 /* TypeFlags.Any */, "unresolved");
|
|
49351
|
+
var nonInferrableAnyType = createIntrinsicType(1 /* TypeFlags.Any */, "any", 65536 /* ObjectFlags.ContainsWideningType */);
|
|
49350
49352
|
var intrinsicMarkerType = createIntrinsicType(1 /* TypeFlags.Any */, "intrinsic");
|
|
49351
49353
|
var unknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
|
|
49352
49354
|
var nonNullUnknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
|
|
@@ -51188,41 +51190,61 @@ var ts;
|
|
|
51188
51190
|
return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
|
|
51189
51191
|
}
|
|
51190
51192
|
function getTargetOfImportClause(node, dontResolveAlias) {
|
|
51191
|
-
var _a;
|
|
51192
51193
|
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
|
|
51193
51194
|
if (moduleSymbol) {
|
|
51194
|
-
|
|
51195
|
-
|
|
51196
|
-
|
|
51197
|
-
|
|
51198
|
-
|
|
51199
|
-
|
|
51200
|
-
|
|
51201
|
-
|
|
51202
|
-
|
|
51203
|
-
|
|
51204
|
-
|
|
51205
|
-
|
|
51206
|
-
|
|
51207
|
-
|
|
51208
|
-
|
|
51209
|
-
|
|
51210
|
-
|
|
51211
|
-
|
|
51212
|
-
|
|
51213
|
-
|
|
51214
|
-
|
|
51215
|
-
|
|
51195
|
+
return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias);
|
|
51196
|
+
}
|
|
51197
|
+
}
|
|
51198
|
+
function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) {
|
|
51199
|
+
var _a;
|
|
51200
|
+
var exportDefaultSymbol;
|
|
51201
|
+
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
|
51202
|
+
exportDefaultSymbol = moduleSymbol;
|
|
51203
|
+
}
|
|
51204
|
+
else {
|
|
51205
|
+
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* InternalSymbolName.Default */, node, dontResolveAlias);
|
|
51206
|
+
}
|
|
51207
|
+
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
51208
|
+
var specifier = getModuleSpecifierForImportOrExport(node);
|
|
51209
|
+
if (!specifier) {
|
|
51210
|
+
return exportDefaultSymbol;
|
|
51211
|
+
}
|
|
51212
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
51213
|
+
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
51214
|
+
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
51215
|
+
if (hasExportAssignmentSymbol(moduleSymbol)) {
|
|
51216
|
+
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
51217
|
+
var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* InternalSymbolName.ExportEquals */);
|
|
51218
|
+
var exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
51219
|
+
var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
51220
|
+
if (exportAssignment) {
|
|
51221
|
+
ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
|
|
51216
51222
|
}
|
|
51217
51223
|
}
|
|
51218
|
-
else if (
|
|
51219
|
-
|
|
51220
|
-
var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
51221
|
-
markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
|
|
51222
|
-
return resolved;
|
|
51224
|
+
else if (ts.isImportClause(node)) {
|
|
51225
|
+
reportNonDefaultExport(moduleSymbol, node);
|
|
51223
51226
|
}
|
|
51224
|
-
|
|
51225
|
-
|
|
51227
|
+
else {
|
|
51228
|
+
errorNoModuleMemberSymbol(moduleSymbol, moduleSymbol, node, ts.isImportOrExportSpecifier(node) && node.propertyName || node.name);
|
|
51229
|
+
}
|
|
51230
|
+
}
|
|
51231
|
+
else if (hasSyntheticDefault || hasDefaultOnly) {
|
|
51232
|
+
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
|
|
51233
|
+
var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
51234
|
+
markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
|
|
51235
|
+
return resolved;
|
|
51236
|
+
}
|
|
51237
|
+
markSymbolOfAliasDeclarationIfTypeOnly(node, exportDefaultSymbol, /*finalTarget*/ undefined, /*overwriteTypeOnly*/ false);
|
|
51238
|
+
return exportDefaultSymbol;
|
|
51239
|
+
}
|
|
51240
|
+
function getModuleSpecifierForImportOrExport(node) {
|
|
51241
|
+
switch (node.kind) {
|
|
51242
|
+
case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier;
|
|
51243
|
+
case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined;
|
|
51244
|
+
case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier;
|
|
51245
|
+
case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier;
|
|
51246
|
+
case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier;
|
|
51247
|
+
default: return ts.Debug.assertNever(node);
|
|
51226
51248
|
}
|
|
51227
51249
|
}
|
|
51228
51250
|
function reportNonDefaultExport(moduleSymbol, node) {
|
|
@@ -51312,7 +51334,7 @@ var ts;
|
|
|
51312
51334
|
}
|
|
51313
51335
|
}
|
|
51314
51336
|
function getExternalModuleMember(node, specifier, dontResolveAlias) {
|
|
51315
|
-
var _a
|
|
51337
|
+
var _a;
|
|
51316
51338
|
if (dontResolveAlias === void 0) { dontResolveAlias = false; }
|
|
51317
51339
|
var moduleSpecifier = ts.getExternalModuleRequireArgument(node) || node.moduleSpecifier;
|
|
51318
51340
|
var moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); // TODO: GH#18217
|
|
@@ -51348,29 +51370,33 @@ var ts;
|
|
|
51348
51370
|
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
|
|
51349
51371
|
symbolFromModule || symbolFromVariable;
|
|
51350
51372
|
if (!symbol) {
|
|
51351
|
-
|
|
51352
|
-
var declarationName = ts.declarationNameToString(name);
|
|
51353
|
-
var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
51354
|
-
if (suggestion !== undefined) {
|
|
51355
|
-
var suggestionName = symbolToString(suggestion);
|
|
51356
|
-
var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
51357
|
-
if (suggestion.valueDeclaration) {
|
|
51358
|
-
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
|
51359
|
-
}
|
|
51360
|
-
}
|
|
51361
|
-
else {
|
|
51362
|
-
if ((_b = moduleSymbol.exports) === null || _b === void 0 ? void 0 : _b.has("default" /* InternalSymbolName.Default */)) {
|
|
51363
|
-
error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
|
|
51364
|
-
}
|
|
51365
|
-
else {
|
|
51366
|
-
reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
|
|
51367
|
-
}
|
|
51368
|
-
}
|
|
51373
|
+
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name);
|
|
51369
51374
|
}
|
|
51370
51375
|
return symbol;
|
|
51371
51376
|
}
|
|
51372
51377
|
}
|
|
51373
51378
|
}
|
|
51379
|
+
function errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name) {
|
|
51380
|
+
var _a;
|
|
51381
|
+
var moduleName = getFullyQualifiedName(moduleSymbol, node);
|
|
51382
|
+
var declarationName = ts.declarationNameToString(name);
|
|
51383
|
+
var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
51384
|
+
if (suggestion !== undefined) {
|
|
51385
|
+
var suggestionName = symbolToString(suggestion);
|
|
51386
|
+
var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
51387
|
+
if (suggestion.valueDeclaration) {
|
|
51388
|
+
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
|
51389
|
+
}
|
|
51390
|
+
}
|
|
51391
|
+
else {
|
|
51392
|
+
if ((_a = moduleSymbol.exports) === null || _a === void 0 ? void 0 : _a.has("default" /* InternalSymbolName.Default */)) {
|
|
51393
|
+
error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
|
|
51394
|
+
}
|
|
51395
|
+
else {
|
|
51396
|
+
reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
|
|
51397
|
+
}
|
|
51398
|
+
}
|
|
51399
|
+
}
|
|
51374
51400
|
function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
|
|
51375
51401
|
var _a, _b;
|
|
51376
51402
|
var localSymbol = (_b = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals) === null || _b === void 0 ? void 0 : _b.get(name.escapedText);
|
|
@@ -51416,6 +51442,13 @@ var ts;
|
|
|
51416
51442
|
}
|
|
51417
51443
|
}
|
|
51418
51444
|
function getTargetOfImportSpecifier(node, dontResolveAlias) {
|
|
51445
|
+
if (ts.isImportSpecifier(node) && ts.idText(node.propertyName || node.name) === "default" /* InternalSymbolName.Default */) {
|
|
51446
|
+
var specifier = getModuleSpecifierForImportOrExport(node);
|
|
51447
|
+
var moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
|
|
51448
|
+
if (moduleSymbol) {
|
|
51449
|
+
return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias);
|
|
51450
|
+
}
|
|
51451
|
+
}
|
|
51419
51452
|
var root = ts.isBindingElement(node) ? ts.getRootDeclaration(node) : node.parent.parent.parent;
|
|
51420
51453
|
var commonJSPropertyAccess = getCommonJSPropertyAccess(root);
|
|
51421
51454
|
var resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias);
|
|
@@ -51437,6 +51470,13 @@ var ts;
|
|
|
51437
51470
|
return resolved;
|
|
51438
51471
|
}
|
|
51439
51472
|
function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
|
|
51473
|
+
if (ts.idText(node.propertyName || node.name) === "default" /* InternalSymbolName.Default */) {
|
|
51474
|
+
var specifier = getModuleSpecifierForImportOrExport(node);
|
|
51475
|
+
var moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
|
|
51476
|
+
if (moduleSymbol) {
|
|
51477
|
+
return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);
|
|
51478
|
+
}
|
|
51479
|
+
}
|
|
51440
51480
|
var resolved = node.parent.parent.moduleSpecifier ?
|
|
51441
51481
|
getExternalModuleMember(node.parent.parent, node, dontResolveAlias) :
|
|
51442
51482
|
resolveEntityName(node.propertyName || node.name, meaning, /*ignoreErrors*/ false, dontResolveAlias);
|
|
@@ -51910,7 +51950,7 @@ var ts;
|
|
|
51910
51950
|
if (ext === ".ts" /* Extension.Ts */ || ext === ".js" /* Extension.Js */ || ext === ".tsx" /* Extension.Tsx */ || ext === ".jsx" /* Extension.Jsx */) {
|
|
51911
51951
|
var scope = currentSourceFile.packageJsonScope;
|
|
51912
51952
|
var targetExt = ext === ".ts" /* Extension.Ts */ ? ".mts" /* Extension.Mts */ : ext === ".js" /* Extension.Js */ ? ".mjs" /* Extension.Mjs */ : undefined;
|
|
51913
|
-
if (scope && !scope.packageJsonContent.type) {
|
|
51953
|
+
if (scope && !scope.contents.packageJsonContent.type) {
|
|
51914
51954
|
if (targetExt) {
|
|
51915
51955
|
diagnosticDetails = ts.chainDiagnosticMessages(
|
|
51916
51956
|
/*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json"));
|
|
@@ -54138,22 +54178,15 @@ var ts;
|
|
|
54138
54178
|
context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
|
|
54139
54179
|
return parameterNode;
|
|
54140
54180
|
function cloneBindingName(node) {
|
|
54141
|
-
return
|
|
54142
|
-
function
|
|
54181
|
+
return elideInitializerAndSetEmitFlags(node);
|
|
54182
|
+
function elideInitializerAndSetEmitFlags(node) {
|
|
54143
54183
|
if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) {
|
|
54144
54184
|
trackComputedName(node.expression, context.enclosingDeclaration, context);
|
|
54145
54185
|
}
|
|
54146
|
-
var visited = ts.visitEachChild(node,
|
|
54186
|
+
var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
|
|
54147
54187
|
if (ts.isBindingElement(visited)) {
|
|
54148
|
-
|
|
54149
|
-
|
|
54150
|
-
/* propertyName*/ undefined, visited.propertyName,
|
|
54151
|
-
/*initializer*/ undefined);
|
|
54152
|
-
}
|
|
54153
|
-
else {
|
|
54154
|
-
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
54155
|
-
/*initializer*/ undefined);
|
|
54156
|
-
}
|
|
54188
|
+
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
54189
|
+
/*initializer*/ undefined);
|
|
54157
54190
|
}
|
|
54158
54191
|
if (!ts.nodeIsSynthesized(visited)) {
|
|
54159
54192
|
visited = ts.factory.cloneNode(visited);
|
|
@@ -57148,7 +57181,11 @@ var ts;
|
|
|
57148
57181
|
if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
|
|
57149
57182
|
reportImplicitAny(element, anyType);
|
|
57150
57183
|
}
|
|
57151
|
-
|
|
57184
|
+
// When we're including the pattern in the type (an indication we're obtaining a contextual type), we
|
|
57185
|
+
// use a non-inferrable any type. Inference will never directly infer this type, but it is possible
|
|
57186
|
+
// to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases,
|
|
57187
|
+
// widening of the binding pattern type substitutes a regular any for the non-inferrable any.
|
|
57188
|
+
return includePatternInType ? nonInferrableAnyType : anyType;
|
|
57152
57189
|
}
|
|
57153
57190
|
// Return the type implied by an object binding pattern
|
|
57154
57191
|
function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
|
|
@@ -59249,6 +59286,12 @@ var ts;
|
|
|
59249
59286
|
return mapType(type, getLowerBoundOfKeyType);
|
|
59250
59287
|
}
|
|
59251
59288
|
if (type.flags & 2097152 /* TypeFlags.Intersection */) {
|
|
59289
|
+
// Similarly to getTypeFromIntersectionTypeNode, we preserve the special string & {}, number & {},
|
|
59290
|
+
// and bigint & {} intersections that are used to prevent subtype reduction in union types.
|
|
59291
|
+
var types = type.types;
|
|
59292
|
+
if (types.length === 2 && !!(types[0].flags & (4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) && types[1] === emptyTypeLiteralType) {
|
|
59293
|
+
return type;
|
|
59294
|
+
}
|
|
59252
59295
|
return getIntersectionType(ts.sameMap(type.types, getLowerBoundOfKeyType));
|
|
59253
59296
|
}
|
|
59254
59297
|
return type;
|
|
@@ -62387,7 +62430,7 @@ var ts;
|
|
|
62387
62430
|
return includes & 8388608 /* TypeFlags.IncludesWildcard */ ? wildcardType : anyType;
|
|
62388
62431
|
}
|
|
62389
62432
|
if (!strictNullChecks && includes & 98304 /* TypeFlags.Nullable */) {
|
|
62390
|
-
return includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
|
|
62433
|
+
return includes & 16777216 /* TypeFlags.IncludesEmptyObject */ ? neverType : includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
|
|
62391
62434
|
}
|
|
62392
62435
|
if (includes & 4 /* TypeFlags.String */ && includes & (128 /* TypeFlags.StringLiteral */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */) ||
|
|
62393
62436
|
includes & 8 /* TypeFlags.Number */ && includes & 256 /* TypeFlags.NumberLiteral */ ||
|
|
@@ -63077,7 +63120,7 @@ var ts;
|
|
|
63077
63120
|
// (T | U)[K] -> T[K] | U[K] (reading)
|
|
63078
63121
|
// (T | U)[K] -> T[K] & U[K] (writing)
|
|
63079
63122
|
// (T & U)[K] -> T[K] & U[K]
|
|
63080
|
-
if (objectType.flags &
|
|
63123
|
+
if (objectType.flags & 1048576 /* TypeFlags.Union */ || objectType.flags & 2097152 /* TypeFlags.Intersection */ && !shouldDeferIndexType(objectType)) {
|
|
63081
63124
|
var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
|
|
63082
63125
|
return objectType.flags & 2097152 /* TypeFlags.Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
|
|
63083
63126
|
}
|
|
@@ -65485,7 +65528,7 @@ var ts;
|
|
|
65485
65528
|
if (reduced !== type) {
|
|
65486
65529
|
return reduced;
|
|
65487
65530
|
}
|
|
65488
|
-
if (type.flags & 2097152 /* TypeFlags.Intersection */) {
|
|
65531
|
+
if (type.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(type.types, isEmptyAnonymousObjectType)) {
|
|
65489
65532
|
var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
|
|
65490
65533
|
if (normalizedTypes !== type.types) {
|
|
65491
65534
|
return getIntersectionType(normalizedTypes);
|
|
@@ -66656,7 +66699,7 @@ var ts;
|
|
|
66656
66699
|
// create a new chain for the constraint error
|
|
66657
66700
|
resetErrorInfo(saveErrorInfo);
|
|
66658
66701
|
}
|
|
66659
|
-
if (result = isRelatedTo(source, constraint, 2 /* RecursionFlags.Target */, reportErrors)) {
|
|
66702
|
+
if (result = isRelatedTo(source, constraint, 2 /* RecursionFlags.Target */, reportErrors, /* headMessage */ undefined, intersectionState)) {
|
|
66660
66703
|
return result;
|
|
66661
66704
|
}
|
|
66662
66705
|
// prefer the shorter chain of the constraint comparison chain, and the direct comparison chain
|
|
@@ -66748,8 +66791,8 @@ var ts;
|
|
|
66748
66791
|
var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
66749
66792
|
var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
66750
66793
|
// TODO: Find a nice way to include potential conditional type breakdowns in error output, if they seem good (they usually don't)
|
|
66751
|
-
if (result = skipTrue ? -1 /* Ternary.True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false)) {
|
|
66752
|
-
result &= skipFalse ? -1 /* Ternary.True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false);
|
|
66794
|
+
if (result = skipTrue ? -1 /* Ternary.True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
66795
|
+
result &= skipFalse ? -1 /* Ternary.True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
|
|
66753
66796
|
if (result) {
|
|
66754
66797
|
return result;
|
|
66755
66798
|
}
|
|
@@ -69436,7 +69479,10 @@ var ts;
|
|
|
69436
69479
|
//
|
|
69437
69480
|
// This flag is infectious; if we produce Box<never> (where never is silentNeverType), Box<never> is
|
|
69438
69481
|
// also non-inferrable.
|
|
69439
|
-
|
|
69482
|
+
//
|
|
69483
|
+
// As a special case, also ignore nonInferrableAnyType, which is a special form of the any type
|
|
69484
|
+
// used as a stand-in for binding elements when they are being inferred.
|
|
69485
|
+
if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */ || source === nonInferrableAnyType) {
|
|
69440
69486
|
return;
|
|
69441
69487
|
}
|
|
69442
69488
|
if (!inference.isFixed) {
|
|
@@ -71778,7 +71824,7 @@ var ts;
|
|
|
71778
71824
|
var narrowedPropType = narrowType(propType);
|
|
71779
71825
|
return filterType(type, function (t) {
|
|
71780
71826
|
var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
|
71781
|
-
return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) &&
|
|
71827
|
+
return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType);
|
|
71782
71828
|
});
|
|
71783
71829
|
}
|
|
71784
71830
|
function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
|
|
@@ -71827,7 +71873,7 @@ var ts;
|
|
|
71827
71873
|
}
|
|
71828
71874
|
function narrowByInKeyword(type, name, assumeTrue) {
|
|
71829
71875
|
if (type.flags & 1048576 /* TypeFlags.Union */
|
|
71830
|
-
|| type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type
|
|
71876
|
+
|| type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
|
|
71831
71877
|
|| ts.isThisTypeParameter(type)
|
|
71832
71878
|
|| type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
|
|
71833
71879
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
@@ -71960,14 +72006,18 @@ var ts;
|
|
|
71960
72006
|
assumeTrue = !assumeTrue;
|
|
71961
72007
|
}
|
|
71962
72008
|
var valueType = getTypeOfExpression(value);
|
|
71963
|
-
if ((type.flags & 2 /* TypeFlags.Unknown */)
|
|
72009
|
+
if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) &&
|
|
72010
|
+
assumeTrue &&
|
|
72011
|
+
(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
|
|
71964
72012
|
if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) {
|
|
71965
72013
|
return valueType;
|
|
71966
72014
|
}
|
|
71967
72015
|
if (valueType.flags & 524288 /* TypeFlags.Object */) {
|
|
71968
72016
|
return nonPrimitiveType;
|
|
71969
72017
|
}
|
|
71970
|
-
|
|
72018
|
+
if (type.flags & 2 /* TypeFlags.Unknown */) {
|
|
72019
|
+
return type;
|
|
72020
|
+
}
|
|
71971
72021
|
}
|
|
71972
72022
|
if (valueType.flags & 98304 /* TypeFlags.Nullable */) {
|
|
71973
72023
|
if (!strictNullChecks) {
|
|
@@ -72426,7 +72476,9 @@ var ts;
|
|
|
72426
72476
|
!!(type.flags & 465829888 /* TypeFlags.Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* TypeFlags.Nullable */ | 1048576 /* TypeFlags.Union */));
|
|
72427
72477
|
}
|
|
72428
72478
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
72429
|
-
return
|
|
72479
|
+
return type.flags & 2097152 /* TypeFlags.Intersection */ ?
|
|
72480
|
+
ts.some(type.types, isGenericTypeWithoutNullableConstraint) :
|
|
72481
|
+
!!(type.flags & 465829888 /* TypeFlags.Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* TypeFlags.Nullable */));
|
|
72430
72482
|
}
|
|
72431
72483
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
72432
72484
|
// Computing the contextual type for a child of a JSX element involves resolving the type of the
|
|
@@ -81596,7 +81648,7 @@ var ts;
|
|
|
81596
81648
|
checkDecorators(node);
|
|
81597
81649
|
}
|
|
81598
81650
|
function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) {
|
|
81599
|
-
if (index <
|
|
81651
|
+
if (node.typeArguments && index < node.typeArguments.length) {
|
|
81600
81652
|
return getTypeFromTypeNode(node.typeArguments[index]);
|
|
81601
81653
|
}
|
|
81602
81654
|
return getEffectiveTypeArguments(node, typeParameters)[index];
|
|
@@ -90375,7 +90427,7 @@ var ts;
|
|
|
90375
90427
|
return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
|
|
90376
90428
|
}
|
|
90377
90429
|
var nodeArguments = node.arguments;
|
|
90378
|
-
if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
|
|
90430
|
+
if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) {
|
|
90379
90431
|
// We are allowed trailing comma after proposal-import-assertions.
|
|
90380
90432
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
90381
90433
|
if (nodeArguments.length > 1) {
|
|
@@ -118022,7 +118074,7 @@ var ts;
|
|
|
118022
118074
|
state.failedLookupLocations = packageJsonLocations;
|
|
118023
118075
|
state.affectingLocations = packageJsonLocations;
|
|
118024
118076
|
var packageJsonScope = ts.getPackageScopeForPath(fileName, state);
|
|
118025
|
-
var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
118077
|
+
var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
118026
118078
|
return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope };
|
|
118027
118079
|
}
|
|
118028
118080
|
}
|
|
@@ -119753,7 +119805,7 @@ var ts;
|
|
|
119753
119805
|
// It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache
|
|
119754
119806
|
// and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way
|
|
119755
119807
|
// to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront.
|
|
119756
|
-
var result = getImpliedNodeFormatForFileWorker(
|
|
119808
|
+
var result = getImpliedNodeFormatForFileWorker(ts.getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
119757
119809
|
var languageVersion = ts.getEmitScriptTarget(options);
|
|
119758
119810
|
var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options);
|
|
119759
119811
|
return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) :
|
|
@@ -124414,7 +124466,7 @@ var ts;
|
|
|
124414
124466
|
var maybeBlockedByTypesVersions = false;
|
|
124415
124467
|
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
124416
124468
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
124417
|
-
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
124469
|
+
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
124418
124470
|
var importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
124419
124471
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
124420
124472
|
var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"];
|
|
@@ -124776,7 +124828,7 @@ var ts;
|
|
|
124776
124828
|
case ts.ModuleKind.CommonJS:
|
|
124777
124829
|
if (file.packageJsonScope) {
|
|
124778
124830
|
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124779
|
-
/*details*/ undefined, file.packageJsonScope.packageJsonContent.type ?
|
|
124831
|
+
/*details*/ undefined, file.packageJsonScope.contents.packageJsonContent.type ?
|
|
124780
124832
|
ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module :
|
|
124781
124833
|
ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
|
|
124782
124834
|
}
|
|
@@ -127123,9 +127175,7 @@ var ts;
|
|
|
127123
127175
|
}
|
|
127124
127176
|
}
|
|
127125
127177
|
}
|
|
127126
|
-
var seenRefs = buildInfoPath ? new ts.Set() : undefined;
|
|
127127
127178
|
var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
|
|
127128
|
-
seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
|
|
127129
127179
|
/** Inputs are up-to-date, just need either timestamp update or bundle prepend manipulation to make it look up-to-date */
|
|
127130
127180
|
var pseudoUpToDate = false;
|
|
127131
127181
|
var usesPrepend = false;
|
|
@@ -127140,7 +127190,7 @@ var ts;
|
|
|
127140
127190
|
continue;
|
|
127141
127191
|
}
|
|
127142
127192
|
// Check if tsbuildinfo path is shared, then we need to rebuild
|
|
127143
|
-
if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry,
|
|
127193
|
+
if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath)) {
|
|
127144
127194
|
return {
|
|
127145
127195
|
type: ts.UpToDateStatusType.OutOfDateWithUpstream,
|
|
127146
127196
|
outOfDateOutputFileName: buildInfoPath,
|
|
@@ -127198,25 +127248,9 @@ var ts;
|
|
|
127198
127248
|
oldestOutputFileName: oldestOutputFileName
|
|
127199
127249
|
};
|
|
127200
127250
|
}
|
|
127201
|
-
function hasSameBuildInfo(state, buildInfoCacheEntry,
|
|
127202
|
-
if (seenRefs.has(resolvedRefPath))
|
|
127203
|
-
return false;
|
|
127204
|
-
seenRefs.add(resolvedRefPath);
|
|
127251
|
+
function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) {
|
|
127205
127252
|
var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
|
|
127206
|
-
|
|
127207
|
-
return true;
|
|
127208
|
-
if (resolvedConfig.projectReferences) {
|
|
127209
|
-
// Check references
|
|
127210
|
-
for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
|
|
127211
|
-
var ref = _a[_i];
|
|
127212
|
-
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
127213
|
-
var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
|
|
127214
|
-
var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
|
|
127215
|
-
if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
|
|
127216
|
-
return true;
|
|
127217
|
-
}
|
|
127218
|
-
}
|
|
127219
|
-
return false;
|
|
127253
|
+
return refBuildInfo.path === buildInfoCacheEntry.path;
|
|
127220
127254
|
}
|
|
127221
127255
|
function getUpToDateStatus(state, project, resolvedPath) {
|
|
127222
127256
|
if (project === undefined) {
|
|
@@ -141949,7 +141983,7 @@ var ts;
|
|
|
141949
141983
|
}
|
|
141950
141984
|
var parent = node.parent;
|
|
141951
141985
|
var typeChecker = program.getTypeChecker();
|
|
141952
|
-
if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.
|
|
141986
|
+
if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) {
|
|
141953
141987
|
return getDefinitionFromOverriddenMember(typeChecker, node) || ts.emptyArray;
|
|
141954
141988
|
}
|
|
141955
141989
|
// Labels
|
|
@@ -171808,13 +171842,13 @@ var ts;
|
|
|
171808
171842
|
return __generator(this, function (_a) {
|
|
171809
171843
|
switch (_a.label) {
|
|
171810
171844
|
case 0:
|
|
171811
|
-
ts.Debug.assertIsDefined(host.
|
|
171845
|
+
ts.Debug.assertIsDefined(host.importPlugin);
|
|
171812
171846
|
resolvedPath = ts.combinePaths(initialDir, "node_modules");
|
|
171813
171847
|
log("Dynamically importing ".concat(moduleName, " from ").concat(initialDir, " (resolved to ").concat(resolvedPath, ")"));
|
|
171814
171848
|
_a.label = 1;
|
|
171815
171849
|
case 1:
|
|
171816
171850
|
_a.trys.push([1, 3, , 4]);
|
|
171817
|
-
return [4 /*yield*/, host.
|
|
171851
|
+
return [4 /*yield*/, host.importPlugin(resolvedPath, moduleName)];
|
|
171818
171852
|
case 2:
|
|
171819
171853
|
result = _a.sent();
|
|
171820
171854
|
return [3 /*break*/, 4];
|
|
@@ -172893,7 +172927,7 @@ var ts;
|
|
|
172893
172927
|
};
|
|
172894
172928
|
Project.prototype.enableGlobalPlugins = function (options, pluginConfigOverrides) {
|
|
172895
172929
|
var host = this.projectService.host;
|
|
172896
|
-
if (!host.require && !host.
|
|
172930
|
+
if (!host.require && !host.importPlugin) {
|
|
172897
172931
|
this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
|
|
172898
172932
|
return;
|
|
172899
172933
|
}
|
|
@@ -172950,7 +172984,7 @@ var ts;
|
|
|
172950
172984
|
return __generator(this, function (_a) {
|
|
172951
172985
|
switch (_a.label) {
|
|
172952
172986
|
case 0:
|
|
172953
|
-
ts.Debug.assertIsDefined(this.projectService.host.
|
|
172987
|
+
ts.Debug.assertIsDefined(this.projectService.host.importPlugin);
|
|
172954
172988
|
log = function (message) { return _this.projectService.logger.info(message); };
|
|
172955
172989
|
logError = function (message) {
|
|
172956
172990
|
(errorLogs !== null && errorLogs !== void 0 ? errorLogs : (errorLogs = [])).push(message);
|
|
@@ -173651,7 +173685,7 @@ var ts;
|
|
|
173651
173685
|
/*@internal*/
|
|
173652
173686
|
ConfiguredProject.prototype.enablePluginsWithOptions = function (options, pluginConfigOverrides) {
|
|
173653
173687
|
var host = this.projectService.host;
|
|
173654
|
-
if (!host.require && !host.
|
|
173688
|
+
if (!host.require && !host.importPlugin) {
|
|
173655
173689
|
this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
|
|
173656
173690
|
return;
|
|
173657
173691
|
}
|
|
@@ -177095,7 +177129,7 @@ var ts;
|
|
|
177095
177129
|
/*@internal*/
|
|
177096
177130
|
ProjectService.prototype.requestEnablePlugin = function (project, pluginConfigEntry, searchPaths, pluginConfigOverrides) {
|
|
177097
177131
|
var _a;
|
|
177098
|
-
if (!this.host.
|
|
177132
|
+
if (!this.host.importPlugin && !this.host.require) {
|
|
177099
177133
|
this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
|
|
177100
177134
|
return;
|
|
177101
177135
|
}
|
|
@@ -177105,7 +177139,7 @@ var ts;
|
|
|
177105
177139
|
return;
|
|
177106
177140
|
}
|
|
177107
177141
|
// If the host supports dynamic import, begin enabling the plugin asynchronously.
|
|
177108
|
-
if (this.host.
|
|
177142
|
+
if (this.host.importPlugin) {
|
|
177109
177143
|
var importPromise = project.beginEnablePluginAsync(pluginConfigEntry, searchPaths, pluginConfigOverrides);
|
|
177110
177144
|
(_a = this.pendingPluginEnablements) !== null && _a !== void 0 ? _a : (this.pendingPluginEnablements = new ts.Map());
|
|
177111
177145
|
var promises = this.pendingPluginEnablements.get(project);
|
|
@@ -179010,7 +179044,7 @@ var ts;
|
|
|
179010
179044
|
var packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
179011
179045
|
var packageJsonCache = (_a = project.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache();
|
|
179012
179046
|
var compilerOptions = project.getCompilationSettings();
|
|
179013
|
-
var packageJson = ts.getPackageScopeForPath(
|
|
179047
|
+
var packageJson = ts.getPackageScopeForPath(ts.getNormalizedAbsolutePath(packageDirectory + "/package.json", project.getCurrentDirectory()), ts.getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions));
|
|
179014
179048
|
if (!packageJson)
|
|
179015
179049
|
return undefined;
|
|
179016
179050
|
// Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext -
|