typescript 4.8.3 → 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 +55 -54
- package/lib/tsserver.js +67 -59
- package/lib/tsserverlibrary.js +67 -59
- package/lib/typescript.js +66 -58
- package/lib/typescriptServices.js +66 -58
- package/lib/typingsInstaller.js +65 -57
- 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) {
|
|
@@ -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
|
}
|
|
@@ -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");
|
|
@@ -51948,7 +51950,7 @@ var ts;
|
|
|
51948
51950
|
if (ext === ".ts" /* Extension.Ts */ || ext === ".js" /* Extension.Js */ || ext === ".tsx" /* Extension.Tsx */ || ext === ".jsx" /* Extension.Jsx */) {
|
|
51949
51951
|
var scope = currentSourceFile.packageJsonScope;
|
|
51950
51952
|
var targetExt = ext === ".ts" /* Extension.Ts */ ? ".mts" /* Extension.Mts */ : ext === ".js" /* Extension.Js */ ? ".mjs" /* Extension.Mjs */ : undefined;
|
|
51951
|
-
if (scope && !scope.packageJsonContent.type) {
|
|
51953
|
+
if (scope && !scope.contents.packageJsonContent.type) {
|
|
51952
51954
|
if (targetExt) {
|
|
51953
51955
|
diagnosticDetails = ts.chainDiagnosticMessages(
|
|
51954
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"));
|
|
@@ -54176,22 +54178,15 @@ var ts;
|
|
|
54176
54178
|
context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
|
|
54177
54179
|
return parameterNode;
|
|
54178
54180
|
function cloneBindingName(node) {
|
|
54179
|
-
return
|
|
54180
|
-
function
|
|
54181
|
+
return elideInitializerAndSetEmitFlags(node);
|
|
54182
|
+
function elideInitializerAndSetEmitFlags(node) {
|
|
54181
54183
|
if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) {
|
|
54182
54184
|
trackComputedName(node.expression, context.enclosingDeclaration, context);
|
|
54183
54185
|
}
|
|
54184
|
-
var visited = ts.visitEachChild(node,
|
|
54186
|
+
var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
|
|
54185
54187
|
if (ts.isBindingElement(visited)) {
|
|
54186
|
-
|
|
54187
|
-
|
|
54188
|
-
/* propertyName*/ undefined, visited.propertyName,
|
|
54189
|
-
/*initializer*/ undefined);
|
|
54190
|
-
}
|
|
54191
|
-
else {
|
|
54192
|
-
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
54193
|
-
/*initializer*/ undefined);
|
|
54194
|
-
}
|
|
54188
|
+
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
54189
|
+
/*initializer*/ undefined);
|
|
54195
54190
|
}
|
|
54196
54191
|
if (!ts.nodeIsSynthesized(visited)) {
|
|
54197
54192
|
visited = ts.factory.cloneNode(visited);
|
|
@@ -57186,7 +57181,11 @@ var ts;
|
|
|
57186
57181
|
if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
|
|
57187
57182
|
reportImplicitAny(element, anyType);
|
|
57188
57183
|
}
|
|
57189
|
-
|
|
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;
|
|
57190
57189
|
}
|
|
57191
57190
|
// Return the type implied by an object binding pattern
|
|
57192
57191
|
function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
|
|
@@ -59287,6 +59286,12 @@ var ts;
|
|
|
59287
59286
|
return mapType(type, getLowerBoundOfKeyType);
|
|
59288
59287
|
}
|
|
59289
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
|
+
}
|
|
59290
59295
|
return getIntersectionType(ts.sameMap(type.types, getLowerBoundOfKeyType));
|
|
59291
59296
|
}
|
|
59292
59297
|
return type;
|
|
@@ -69474,7 +69479,10 @@ var ts;
|
|
|
69474
69479
|
//
|
|
69475
69480
|
// This flag is infectious; if we produce Box<never> (where never is silentNeverType), Box<never> is
|
|
69476
69481
|
// also non-inferrable.
|
|
69477
|
-
|
|
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) {
|
|
69478
69486
|
return;
|
|
69479
69487
|
}
|
|
69480
69488
|
if (!inference.isFixed) {
|
|
@@ -81640,7 +81648,7 @@ var ts;
|
|
|
81640
81648
|
checkDecorators(node);
|
|
81641
81649
|
}
|
|
81642
81650
|
function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) {
|
|
81643
|
-
if (index <
|
|
81651
|
+
if (node.typeArguments && index < node.typeArguments.length) {
|
|
81644
81652
|
return getTypeFromTypeNode(node.typeArguments[index]);
|
|
81645
81653
|
}
|
|
81646
81654
|
return getEffectiveTypeArguments(node, typeParameters)[index];
|
|
@@ -90419,7 +90427,7 @@ var ts;
|
|
|
90419
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);
|
|
90420
90428
|
}
|
|
90421
90429
|
var nodeArguments = node.arguments;
|
|
90422
|
-
if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
|
|
90430
|
+
if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) {
|
|
90423
90431
|
// We are allowed trailing comma after proposal-import-assertions.
|
|
90424
90432
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
90425
90433
|
if (nodeArguments.length > 1) {
|
|
@@ -118066,7 +118074,7 @@ var ts;
|
|
|
118066
118074
|
state.failedLookupLocations = packageJsonLocations;
|
|
118067
118075
|
state.affectingLocations = packageJsonLocations;
|
|
118068
118076
|
var packageJsonScope = ts.getPackageScopeForPath(fileName, state);
|
|
118069
|
-
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;
|
|
118070
118078
|
return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope };
|
|
118071
118079
|
}
|
|
118072
118080
|
}
|
|
@@ -119797,7 +119805,7 @@ var ts;
|
|
|
119797
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
|
|
119798
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
|
|
119799
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.
|
|
119800
|
-
var result = getImpliedNodeFormatForFileWorker(
|
|
119808
|
+
var result = getImpliedNodeFormatForFileWorker(ts.getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
119801
119809
|
var languageVersion = ts.getEmitScriptTarget(options);
|
|
119802
119810
|
var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options);
|
|
119803
119811
|
return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) :
|
|
@@ -124458,7 +124466,7 @@ var ts;
|
|
|
124458
124466
|
var maybeBlockedByTypesVersions = false;
|
|
124459
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);
|
|
124460
124468
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
124461
|
-
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));
|
|
124462
124470
|
var importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
124463
124471
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
124464
124472
|
var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"];
|
|
@@ -124820,7 +124828,7 @@ var ts;
|
|
|
124820
124828
|
case ts.ModuleKind.CommonJS:
|
|
124821
124829
|
if (file.packageJsonScope) {
|
|
124822
124830
|
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124823
|
-
/*details*/ undefined, file.packageJsonScope.packageJsonContent.type ?
|
|
124831
|
+
/*details*/ undefined, file.packageJsonScope.contents.packageJsonContent.type ?
|
|
124824
124832
|
ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module :
|
|
124825
124833
|
ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
|
|
124826
124834
|
}
|
|
@@ -141975,7 +141983,7 @@ var ts;
|
|
|
141975
141983
|
}
|
|
141976
141984
|
var parent = node.parent;
|
|
141977
141985
|
var typeChecker = program.getTypeChecker();
|
|
141978
|
-
if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.
|
|
141986
|
+
if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) {
|
|
141979
141987
|
return getDefinitionFromOverriddenMember(typeChecker, node) || ts.emptyArray;
|
|
141980
141988
|
}
|
|
141981
141989
|
// Labels
|
|
@@ -179036,7 +179044,7 @@ var ts;
|
|
|
179036
179044
|
var packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
179037
179045
|
var packageJsonCache = (_a = project.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache();
|
|
179038
179046
|
var compilerOptions = project.getCompilationSettings();
|
|
179039
|
-
var packageJson = ts.getPackageScopeForPath(
|
|
179047
|
+
var packageJson = ts.getPackageScopeForPath(ts.getNormalizedAbsolutePath(packageDirectory + "/package.json", project.getCurrentDirectory()), ts.getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions));
|
|
179040
179048
|
if (!packageJson)
|
|
179041
179049
|
return undefined;
|
|
179042
179050
|
// Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext -
|