typescript 5.0.0-dev.20221219 → 5.0.0-dev.20221221
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 +18 -7
- package/lib/tsserver.js +71 -32
- package/lib/tsserverlibrary.js +70 -32
- package/lib/typescript.js +69 -32
- package/lib/typingsInstaller.js +8 -4
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20221221`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -33016,7 +33016,7 @@ function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiag
|
|
|
33016
33016
|
}
|
|
33017
33017
|
return extendedConfigPath;
|
|
33018
33018
|
}
|
|
33019
|
-
const resolved =
|
|
33019
|
+
const resolved = nodeNextJsonConfigResolver(extendedConfig, combinePaths(basePath, "tsconfig.json"), host);
|
|
33020
33020
|
if (resolved.resolvedModule) {
|
|
33021
33021
|
return resolved.resolvedModule.resolvedFileName;
|
|
33022
33022
|
}
|
|
@@ -34398,6 +34398,9 @@ function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, hos
|
|
|
34398
34398
|
}
|
|
34399
34399
|
return nodeModuleNameResolverWorker(0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference);
|
|
34400
34400
|
}
|
|
34401
|
+
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
34402
|
+
return nodeModuleNameResolverWorker(8 /* Exports */, moduleName, getDirectoryPath(containingFile), { moduleResolution: 99 /* NodeNext */ }, host, void 0, 8 /* Json */, true, void 0);
|
|
34403
|
+
}
|
|
34401
34404
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference) {
|
|
34402
34405
|
var _a2, _b;
|
|
34403
34406
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -34573,11 +34576,15 @@ function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecor
|
|
|
34573
34576
|
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
34574
34577
|
}
|
|
34575
34578
|
}
|
|
34576
|
-
function
|
|
34579
|
+
function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
|
|
34577
34580
|
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
34578
34581
|
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
34579
34582
|
return result !== void 0 ? { path: candidate, ext: tryExtractTSExtension(candidate), resolvedUsingTsExtension: void 0 } : void 0;
|
|
34580
34583
|
}
|
|
34584
|
+
if (state.isConfigLookup && extensions === 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */)) {
|
|
34585
|
+
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
34586
|
+
return result !== void 0 ? { path: candidate, ext: ".json" /* Json */, resolvedUsingTsExtension: void 0 } : void 0;
|
|
34587
|
+
}
|
|
34581
34588
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
34582
34589
|
}
|
|
34583
34590
|
function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecordFailures, state) {
|
|
@@ -34988,7 +34995,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
34988
34995
|
const inputLink = tryLoadInputFileForPath(finalPath, subpath, combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
34989
34996
|
if (inputLink)
|
|
34990
34997
|
return inputLink;
|
|
34991
|
-
return toSearchResult(withPackageId(scope,
|
|
34998
|
+
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(extensions, finalPath, false, state)));
|
|
34992
34999
|
} else if (typeof target === "object" && target !== null) {
|
|
34993
35000
|
if (!Array.isArray(target)) {
|
|
34994
35001
|
for (const condition of getOwnKeys(target)) {
|
|
@@ -35083,7 +35090,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
35083
35090
|
continue;
|
|
35084
35091
|
const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
35085
35092
|
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
35086
|
-
return toSearchResult(withPackageId(scope,
|
|
35093
|
+
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(extensions, possibleInputWithInputExtension, false, state)));
|
|
35087
35094
|
}
|
|
35088
35095
|
}
|
|
35089
35096
|
}
|
|
@@ -70350,7 +70357,7 @@ function createTypeChecker(host) {
|
|
|
70350
70357
|
} else {
|
|
70351
70358
|
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) {
|
|
70352
70359
|
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
70353
|
-
} else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
70360
|
+
} else if (!(node.flags & 16777216 /* Ambient */) && getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
70354
70361
|
grammarErrorOnNode(node, Diagnostics.Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
70355
70362
|
}
|
|
70356
70363
|
}
|
|
@@ -72537,6 +72544,8 @@ function createTypeChecker(host) {
|
|
|
72537
72544
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly");
|
|
72538
72545
|
} else if (node.kind !== 169 /* PropertyDeclaration */ && node.kind !== 168 /* PropertySignature */ && node.kind !== 178 /* IndexSignature */ && node.kind !== 166 /* Parameter */) {
|
|
72539
72546
|
return grammarErrorOnNode(modifier, Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
|
|
72547
|
+
} else if (flags & 128 /* Accessor */) {
|
|
72548
|
+
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "readonly", "accessor");
|
|
72540
72549
|
}
|
|
72541
72550
|
flags |= 64 /* Readonly */;
|
|
72542
72551
|
break;
|
|
@@ -72580,6 +72589,8 @@ function createTypeChecker(host) {
|
|
|
72580
72589
|
return grammarErrorOnNode(modifier, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
|
|
72581
72590
|
} else if (isPrivateIdentifierClassElementDeclaration(node)) {
|
|
72582
72591
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare");
|
|
72592
|
+
} else if (flags & 128 /* Accessor */) {
|
|
72593
|
+
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "declare", "accessor");
|
|
72583
72594
|
}
|
|
72584
72595
|
flags |= 2 /* Ambient */;
|
|
72585
72596
|
lastDeclare = modifier;
|
|
@@ -103876,7 +103887,7 @@ function getPlainDiagnosticFollowingNewLines(diagnostic, newLine) {
|
|
|
103876
103887
|
return contains(screenStartingMessageCodes, diagnostic.code) ? newLine + newLine : newLine;
|
|
103877
103888
|
}
|
|
103878
103889
|
function getLocaleTimeString(system) {
|
|
103879
|
-
return !system.now ? new Date().toLocaleTimeString() : system.now().toLocaleTimeString("en-US", { timeZone: "UTC" });
|
|
103890
|
+
return !system.now ? new Date().toLocaleTimeString() : system.now().toLocaleTimeString("en-US", { timeZone: "UTC" }).replace("\u202F", " ");
|
|
103880
103891
|
}
|
|
103881
103892
|
function createWatchStatusReporter(system, pretty) {
|
|
103882
103893
|
return pretty ? (diagnostic, newLine, options) => {
|
package/lib/tsserver.js
CHANGED
|
@@ -2040,6 +2040,7 @@ __export(server_exports, {
|
|
|
2040
2040
|
nodeIsSynthesized: () => nodeIsSynthesized,
|
|
2041
2041
|
nodeModuleNameResolver: () => nodeModuleNameResolver,
|
|
2042
2042
|
nodeModulesPathPart: () => nodeModulesPathPart,
|
|
2043
|
+
nodeNextJsonConfigResolver: () => nodeNextJsonConfigResolver,
|
|
2043
2044
|
nodeOrChildIsDecorated: () => nodeOrChildIsDecorated,
|
|
2044
2045
|
nodeOverlapsWithStartEnd: () => nodeOverlapsWithStartEnd,
|
|
2045
2046
|
nodePosToString: () => nodePosToString,
|
|
@@ -2669,7 +2670,7 @@ __export(ts_server_exports3, {
|
|
|
2669
2670
|
|
|
2670
2671
|
// src/compiler/corePublic.ts
|
|
2671
2672
|
var versionMajorMinor = "5.0";
|
|
2672
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2673
|
+
var version = `${versionMajorMinor}.0-dev.20221221`;
|
|
2673
2674
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2674
2675
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2675
2676
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6736,13 +6737,13 @@ var UnionReduction = /* @__PURE__ */ ((UnionReduction2) => {
|
|
|
6736
6737
|
UnionReduction2[UnionReduction2["Subtype"] = 2] = "Subtype";
|
|
6737
6738
|
return UnionReduction2;
|
|
6738
6739
|
})(UnionReduction || {});
|
|
6739
|
-
var ContextFlags = /* @__PURE__ */ ((
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
return
|
|
6740
|
+
var ContextFlags = /* @__PURE__ */ ((ContextFlags3) => {
|
|
6741
|
+
ContextFlags3[ContextFlags3["None"] = 0] = "None";
|
|
6742
|
+
ContextFlags3[ContextFlags3["Signature"] = 1] = "Signature";
|
|
6743
|
+
ContextFlags3[ContextFlags3["NoConstraints"] = 2] = "NoConstraints";
|
|
6744
|
+
ContextFlags3[ContextFlags3["Completions"] = 4] = "Completions";
|
|
6745
|
+
ContextFlags3[ContextFlags3["SkipBindingPatterns"] = 8] = "SkipBindingPatterns";
|
|
6746
|
+
return ContextFlags3;
|
|
6746
6747
|
})(ContextFlags || {});
|
|
6747
6748
|
var NodeBuilderFlags = /* @__PURE__ */ ((NodeBuilderFlags2) => {
|
|
6748
6749
|
NodeBuilderFlags2[NodeBuilderFlags2["None"] = 0] = "None";
|
|
@@ -37802,7 +37803,7 @@ function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiag
|
|
|
37802
37803
|
}
|
|
37803
37804
|
return extendedConfigPath;
|
|
37804
37805
|
}
|
|
37805
|
-
const resolved =
|
|
37806
|
+
const resolved = nodeNextJsonConfigResolver(extendedConfig, combinePaths(basePath, "tsconfig.json"), host);
|
|
37806
37807
|
if (resolved.resolvedModule) {
|
|
37807
37808
|
return resolved.resolvedModule.resolvedFileName;
|
|
37808
37809
|
}
|
|
@@ -39244,6 +39245,9 @@ function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, hos
|
|
|
39244
39245
|
}
|
|
39245
39246
|
return nodeModuleNameResolverWorker(0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference);
|
|
39246
39247
|
}
|
|
39248
|
+
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
39249
|
+
return nodeModuleNameResolverWorker(8 /* Exports */, moduleName, getDirectoryPath(containingFile), { moduleResolution: 99 /* NodeNext */ }, host, void 0, 8 /* Json */, true, void 0);
|
|
39250
|
+
}
|
|
39247
39251
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference) {
|
|
39248
39252
|
var _a2, _b;
|
|
39249
39253
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -39419,11 +39423,15 @@ function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecor
|
|
|
39419
39423
|
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
39420
39424
|
}
|
|
39421
39425
|
}
|
|
39422
|
-
function
|
|
39426
|
+
function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
|
|
39423
39427
|
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
39424
39428
|
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
39425
39429
|
return result !== void 0 ? { path: candidate, ext: tryExtractTSExtension(candidate), resolvedUsingTsExtension: void 0 } : void 0;
|
|
39426
39430
|
}
|
|
39431
|
+
if (state.isConfigLookup && extensions === 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */)) {
|
|
39432
|
+
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
39433
|
+
return result !== void 0 ? { path: candidate, ext: ".json" /* Json */, resolvedUsingTsExtension: void 0 } : void 0;
|
|
39434
|
+
}
|
|
39427
39435
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
39428
39436
|
}
|
|
39429
39437
|
function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecordFailures, state) {
|
|
@@ -39566,7 +39574,7 @@ function loadEntrypointsFromExportMap(scope, exports, state, extensions) {
|
|
|
39566
39574
|
}
|
|
39567
39575
|
const resolvedTarget = combinePaths(scope.packageDirectory, target);
|
|
39568
39576
|
const finalPath = getNormalizedAbsolutePath(resolvedTarget, (_b = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a2));
|
|
39569
|
-
const result =
|
|
39577
|
+
const result = loadFileNameFromPackageJsonField(extensions, finalPath, false, state);
|
|
39570
39578
|
if (result) {
|
|
39571
39579
|
entrypoints = appendIfUnique(entrypoints, result, (a, b) => a.path === b.path);
|
|
39572
39580
|
return true;
|
|
@@ -39920,7 +39928,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
39920
39928
|
const inputLink = tryLoadInputFileForPath(finalPath, subpath, combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
39921
39929
|
if (inputLink)
|
|
39922
39930
|
return inputLink;
|
|
39923
|
-
return toSearchResult(withPackageId(scope,
|
|
39931
|
+
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(extensions, finalPath, false, state)));
|
|
39924
39932
|
} else if (typeof target === "object" && target !== null) {
|
|
39925
39933
|
if (!Array.isArray(target)) {
|
|
39926
39934
|
for (const condition of getOwnKeys(target)) {
|
|
@@ -40015,7 +40023,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
40015
40023
|
continue;
|
|
40016
40024
|
const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
40017
40025
|
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
40018
|
-
return toSearchResult(withPackageId(scope,
|
|
40026
|
+
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(extensions, possibleInputWithInputExtension, false, state)));
|
|
40019
40027
|
}
|
|
40020
40028
|
}
|
|
40021
40029
|
}
|
|
@@ -75325,7 +75333,7 @@ function createTypeChecker(host) {
|
|
|
75325
75333
|
} else {
|
|
75326
75334
|
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) {
|
|
75327
75335
|
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
75328
|
-
} else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
75336
|
+
} else if (!(node.flags & 16777216 /* Ambient */) && getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
75329
75337
|
grammarErrorOnNode(node, Diagnostics.Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
75330
75338
|
}
|
|
75331
75339
|
}
|
|
@@ -77512,6 +77520,8 @@ function createTypeChecker(host) {
|
|
|
77512
77520
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly");
|
|
77513
77521
|
} else if (node.kind !== 169 /* PropertyDeclaration */ && node.kind !== 168 /* PropertySignature */ && node.kind !== 178 /* IndexSignature */ && node.kind !== 166 /* Parameter */) {
|
|
77514
77522
|
return grammarErrorOnNode(modifier, Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
|
|
77523
|
+
} else if (flags & 128 /* Accessor */) {
|
|
77524
|
+
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "readonly", "accessor");
|
|
77515
77525
|
}
|
|
77516
77526
|
flags |= 64 /* Readonly */;
|
|
77517
77527
|
break;
|
|
@@ -77555,6 +77565,8 @@ function createTypeChecker(host) {
|
|
|
77555
77565
|
return grammarErrorOnNode(modifier, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
|
|
77556
77566
|
} else if (isPrivateIdentifierClassElementDeclaration(node)) {
|
|
77557
77567
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare");
|
|
77568
|
+
} else if (flags & 128 /* Accessor */) {
|
|
77569
|
+
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "declare", "accessor");
|
|
77558
77570
|
}
|
|
77559
77571
|
flags |= 2 /* Ambient */;
|
|
77560
77572
|
lastDeclare = modifier;
|
|
@@ -109113,7 +109125,7 @@ function getPlainDiagnosticFollowingNewLines(diagnostic, newLine) {
|
|
|
109113
109125
|
return contains(screenStartingMessageCodes, diagnostic.code) ? newLine + newLine : newLine;
|
|
109114
109126
|
}
|
|
109115
109127
|
function getLocaleTimeString(system) {
|
|
109116
|
-
return !system.now ? new Date().toLocaleTimeString() : system.now().toLocaleTimeString("en-US", { timeZone: "UTC" });
|
|
109128
|
+
return !system.now ? new Date().toLocaleTimeString() : system.now().toLocaleTimeString("en-US", { timeZone: "UTC" }).replace("\u202F", " ");
|
|
109117
109129
|
}
|
|
109118
109130
|
function createWatchStatusReporter(system, pretty) {
|
|
109119
109131
|
return pretty ? (diagnostic, newLine, options) => {
|
|
@@ -114703,6 +114715,7 @@ __export(ts_exports3, {
|
|
|
114703
114715
|
nodeIsSynthesized: () => nodeIsSynthesized,
|
|
114704
114716
|
nodeModuleNameResolver: () => nodeModuleNameResolver,
|
|
114705
114717
|
nodeModulesPathPart: () => nodeModulesPathPart,
|
|
114718
|
+
nodeNextJsonConfigResolver: () => nodeNextJsonConfigResolver,
|
|
114706
114719
|
nodeOrChildIsDecorated: () => nodeOrChildIsDecorated,
|
|
114707
114720
|
nodeOverlapsWithStartEnd: () => nodeOverlapsWithStartEnd,
|
|
114708
114721
|
nodePosToString: () => nodePosToString,
|
|
@@ -117539,19 +117552,19 @@ function indexInTextChange(change, name) {
|
|
|
117539
117552
|
function needsParentheses(expression) {
|
|
117540
117553
|
return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
|
|
117541
117554
|
}
|
|
117542
|
-
function getContextualTypeFromParent(node, checker) {
|
|
117555
|
+
function getContextualTypeFromParent(node, checker, contextFlags) {
|
|
117543
117556
|
const { parent: parent2 } = node;
|
|
117544
117557
|
switch (parent2.kind) {
|
|
117545
117558
|
case 211 /* NewExpression */:
|
|
117546
|
-
return checker.getContextualType(parent2);
|
|
117559
|
+
return checker.getContextualType(parent2, contextFlags);
|
|
117547
117560
|
case 223 /* BinaryExpression */: {
|
|
117548
117561
|
const { left, operatorToken, right } = parent2;
|
|
117549
|
-
return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node);
|
|
117562
|
+
return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags);
|
|
117550
117563
|
}
|
|
117551
117564
|
case 292 /* CaseClause */:
|
|
117552
117565
|
return parent2.expression === node ? getSwitchedType(parent2, checker) : void 0;
|
|
117553
117566
|
default:
|
|
117554
|
-
return checker.getContextualType(node);
|
|
117567
|
+
return checker.getContextualType(node, contextFlags);
|
|
117555
117568
|
}
|
|
117556
117569
|
}
|
|
117557
117570
|
function quote(sourceFile, preferences, text) {
|
|
@@ -134926,7 +134939,7 @@ function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options,
|
|
|
134926
134939
|
elements.push(factory.createNumericLiteral(type.value));
|
|
134927
134940
|
break;
|
|
134928
134941
|
case "string":
|
|
134929
|
-
elements.push(factory.createStringLiteral(type.value));
|
|
134942
|
+
elements.push(factory.createStringLiteral(type.value, quotePreference === 0 /* Single */));
|
|
134930
134943
|
break;
|
|
134931
134944
|
}
|
|
134932
134945
|
}
|
|
@@ -137970,7 +137983,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
|
|
|
137970
137983
|
return fromContextualType();
|
|
137971
137984
|
}
|
|
137972
137985
|
function fromContextualType() {
|
|
137973
|
-
return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker)), isNewIdentifier: false };
|
|
137986
|
+
return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, 4 /* Completions */)), isNewIdentifier: false };
|
|
137974
137987
|
}
|
|
137975
137988
|
}
|
|
137976
137989
|
function walkUpParentheses(node) {
|
|
@@ -138874,7 +138887,7 @@ function getImportOrExportSymbol(node, symbol, checker, comingFromExport) {
|
|
|
138874
138887
|
return getSpecialPropertyExport(parent2, true);
|
|
138875
138888
|
} else if (isBinaryExpression(grandparent)) {
|
|
138876
138889
|
return getSpecialPropertyExport(grandparent, true);
|
|
138877
|
-
} else if (isJSDocTypedefTag(parent2)) {
|
|
138890
|
+
} else if (isJSDocTypedefTag(parent2) || isJSDocCallbackTag(parent2)) {
|
|
138878
138891
|
return exportInfo(symbol, 0 /* Named */);
|
|
138879
138892
|
}
|
|
138880
138893
|
}
|
|
@@ -140741,6 +140754,16 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
|
140741
140754
|
const functionDeclaration = findAncestor(node.parent, (n) => isClassStaticBlockDeclaration(n) ? "quit" : isFunctionLikeDeclaration(n));
|
|
140742
140755
|
return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
|
140743
140756
|
}
|
|
140757
|
+
if (node.kind === 133 /* AwaitKeyword */) {
|
|
140758
|
+
const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n));
|
|
140759
|
+
const isAsyncFunction2 = functionDeclaration && some(functionDeclaration.modifiers, (node2) => node2.kind === 132 /* AsyncKeyword */);
|
|
140760
|
+
return isAsyncFunction2 ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
|
140761
|
+
}
|
|
140762
|
+
if (node.kind === 125 /* YieldKeyword */) {
|
|
140763
|
+
const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n));
|
|
140764
|
+
const isGeneratorFunction = functionDeclaration && functionDeclaration.asteriskToken;
|
|
140765
|
+
return isGeneratorFunction ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
|
140766
|
+
}
|
|
140744
140767
|
if (isStaticModifier(node) && isClassStaticBlockDeclaration(node.parent)) {
|
|
140745
140768
|
const classDecl = node.parent.parent;
|
|
140746
140769
|
const { symbol: symbol2, failedAliasResolution: failedAliasResolution2 } = getSymbol(classDecl, typeChecker, stopAtAlias);
|
|
@@ -142225,14 +142248,14 @@ function addNodeOutliningSpans(sourceFile, cancellationToken, out) {
|
|
|
142225
142248
|
const n = statements.length;
|
|
142226
142249
|
while (current < n) {
|
|
142227
142250
|
while (current < n && !isAnyImportSyntax(statements[current])) {
|
|
142228
|
-
|
|
142251
|
+
visitNode3(statements[current]);
|
|
142229
142252
|
current++;
|
|
142230
142253
|
}
|
|
142231
142254
|
if (current === n)
|
|
142232
142255
|
break;
|
|
142233
142256
|
const firstImport = current;
|
|
142234
142257
|
while (current < n && isAnyImportSyntax(statements[current])) {
|
|
142235
|
-
|
|
142258
|
+
visitNode3(statements[current]);
|
|
142236
142259
|
current++;
|
|
142237
142260
|
}
|
|
142238
142261
|
const lastImport = current - 1;
|
|
@@ -142240,7 +142263,7 @@ function addNodeOutliningSpans(sourceFile, cancellationToken, out) {
|
|
|
142240
142263
|
out.push(createOutliningSpanFromBounds(findChildOfKind(statements[firstImport], 100 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */));
|
|
142241
142264
|
}
|
|
142242
142265
|
}
|
|
142243
|
-
function
|
|
142266
|
+
function visitNode3(n2) {
|
|
142244
142267
|
var _a2;
|
|
142245
142268
|
if (depthRemaining === 0)
|
|
142246
142269
|
return;
|
|
@@ -142263,18 +142286,18 @@ function addNodeOutliningSpans(sourceFile, cancellationToken, out) {
|
|
|
142263
142286
|
depthRemaining--;
|
|
142264
142287
|
if (isCallExpression(n2)) {
|
|
142265
142288
|
depthRemaining++;
|
|
142266
|
-
|
|
142289
|
+
visitNode3(n2.expression);
|
|
142267
142290
|
depthRemaining--;
|
|
142268
|
-
n2.arguments.forEach(
|
|
142269
|
-
(_a2 = n2.typeArguments) == null ? void 0 : _a2.forEach(
|
|
142291
|
+
n2.arguments.forEach(visitNode3);
|
|
142292
|
+
(_a2 = n2.typeArguments) == null ? void 0 : _a2.forEach(visitNode3);
|
|
142270
142293
|
} else if (isIfStatement(n2) && n2.elseStatement && isIfStatement(n2.elseStatement)) {
|
|
142271
|
-
|
|
142272
|
-
|
|
142294
|
+
visitNode3(n2.expression);
|
|
142295
|
+
visitNode3(n2.thenStatement);
|
|
142273
142296
|
depthRemaining++;
|
|
142274
|
-
|
|
142297
|
+
visitNode3(n2.elseStatement);
|
|
142275
142298
|
depthRemaining--;
|
|
142276
142299
|
} else {
|
|
142277
|
-
n2.forEachChild(
|
|
142300
|
+
n2.forEachChild(visitNode3);
|
|
142278
142301
|
}
|
|
142279
142302
|
depthRemaining++;
|
|
142280
142303
|
}
|
|
@@ -142424,6 +142447,21 @@ function getOutliningSpanForNode(n, sourceFile) {
|
|
|
142424
142447
|
return spanForCallExpression(n);
|
|
142425
142448
|
case 214 /* ParenthesizedExpression */:
|
|
142426
142449
|
return spanForParenthesizedExpression(n);
|
|
142450
|
+
case 272 /* NamedImports */:
|
|
142451
|
+
case 276 /* NamedExports */:
|
|
142452
|
+
case 296 /* AssertClause */:
|
|
142453
|
+
return spanForNamedImportsOrExportsOrAssertClause(n);
|
|
142454
|
+
}
|
|
142455
|
+
function spanForNamedImportsOrExportsOrAssertClause(node) {
|
|
142456
|
+
if (!node.elements.length) {
|
|
142457
|
+
return void 0;
|
|
142458
|
+
}
|
|
142459
|
+
const openToken = findChildOfKind(node, 18 /* OpenBraceToken */, sourceFile);
|
|
142460
|
+
const closeToken = findChildOfKind(node, 19 /* CloseBraceToken */, sourceFile);
|
|
142461
|
+
if (!openToken || !closeToken || positionsAreOnSameLine(openToken.pos, closeToken.pos, sourceFile)) {
|
|
142462
|
+
return void 0;
|
|
142463
|
+
}
|
|
142464
|
+
return spanBetweenTokens(openToken, closeToken, node, sourceFile, false, false);
|
|
142427
142465
|
}
|
|
142428
142466
|
function spanForCallExpression(node) {
|
|
142429
142467
|
if (!node.arguments.length) {
|
|
@@ -165487,6 +165525,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
165487
165525
|
nodeIsSynthesized,
|
|
165488
165526
|
nodeModuleNameResolver,
|
|
165489
165527
|
nodeModulesPathPart,
|
|
165528
|
+
nodeNextJsonConfigResolver,
|
|
165490
165529
|
nodeOrChildIsDecorated,
|
|
165491
165530
|
nodeOverlapsWithStartEnd,
|
|
165492
165531
|
nodePosToString,
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts = (() => {
|
|
|
42
42
|
"src/compiler/corePublic.ts"() {
|
|
43
43
|
"use strict";
|
|
44
44
|
versionMajorMinor = "5.0";
|
|
45
|
-
version = `${versionMajorMinor}.0-dev.
|
|
45
|
+
version = `${versionMajorMinor}.0-dev.20221221`;
|
|
46
46
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
47
47
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
48
48
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4167,13 +4167,13 @@ ${lanes.join("\n")}
|
|
|
4167
4167
|
UnionReduction2[UnionReduction2["Subtype"] = 2] = "Subtype";
|
|
4168
4168
|
return UnionReduction2;
|
|
4169
4169
|
})(UnionReduction || {});
|
|
4170
|
-
ContextFlags = /* @__PURE__ */ ((
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
return
|
|
4170
|
+
ContextFlags = /* @__PURE__ */ ((ContextFlags3) => {
|
|
4171
|
+
ContextFlags3[ContextFlags3["None"] = 0] = "None";
|
|
4172
|
+
ContextFlags3[ContextFlags3["Signature"] = 1] = "Signature";
|
|
4173
|
+
ContextFlags3[ContextFlags3["NoConstraints"] = 2] = "NoConstraints";
|
|
4174
|
+
ContextFlags3[ContextFlags3["Completions"] = 4] = "Completions";
|
|
4175
|
+
ContextFlags3[ContextFlags3["SkipBindingPatterns"] = 8] = "SkipBindingPatterns";
|
|
4176
|
+
return ContextFlags3;
|
|
4177
4177
|
})(ContextFlags || {});
|
|
4178
4178
|
NodeBuilderFlags = /* @__PURE__ */ ((NodeBuilderFlags2) => {
|
|
4179
4179
|
NodeBuilderFlags2[NodeBuilderFlags2["None"] = 0] = "None";
|
|
@@ -33869,7 +33869,7 @@ ${lanes.join("\n")}
|
|
|
33869
33869
|
}
|
|
33870
33870
|
return extendedConfigPath;
|
|
33871
33871
|
}
|
|
33872
|
-
const resolved =
|
|
33872
|
+
const resolved = nodeNextJsonConfigResolver(extendedConfig, combinePaths(basePath, "tsconfig.json"), host);
|
|
33873
33873
|
if (resolved.resolvedModule) {
|
|
33874
33874
|
return resolved.resolvedModule.resolvedFileName;
|
|
33875
33875
|
}
|
|
@@ -36756,6 +36756,9 @@ ${lanes.join("\n")}
|
|
|
36756
36756
|
}
|
|
36757
36757
|
return nodeModuleNameResolverWorker(0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference);
|
|
36758
36758
|
}
|
|
36759
|
+
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
36760
|
+
return nodeModuleNameResolverWorker(8 /* Exports */, moduleName, getDirectoryPath(containingFile), { moduleResolution: 99 /* NodeNext */ }, host, void 0, 8 /* Json */, true, void 0);
|
|
36761
|
+
}
|
|
36759
36762
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference) {
|
|
36760
36763
|
var _a2, _b;
|
|
36761
36764
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -36930,11 +36933,15 @@ ${lanes.join("\n")}
|
|
|
36930
36933
|
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
36931
36934
|
}
|
|
36932
36935
|
}
|
|
36933
|
-
function
|
|
36936
|
+
function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
|
|
36934
36937
|
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
36935
36938
|
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
36936
36939
|
return result !== void 0 ? { path: candidate, ext: tryExtractTSExtension(candidate), resolvedUsingTsExtension: void 0 } : void 0;
|
|
36937
36940
|
}
|
|
36941
|
+
if (state.isConfigLookup && extensions === 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */)) {
|
|
36942
|
+
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
36943
|
+
return result !== void 0 ? { path: candidate, ext: ".json" /* Json */, resolvedUsingTsExtension: void 0 } : void 0;
|
|
36944
|
+
}
|
|
36938
36945
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
36939
36946
|
}
|
|
36940
36947
|
function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecordFailures, state) {
|
|
@@ -37077,7 +37084,7 @@ ${lanes.join("\n")}
|
|
|
37077
37084
|
}
|
|
37078
37085
|
const resolvedTarget = combinePaths(scope.packageDirectory, target);
|
|
37079
37086
|
const finalPath = getNormalizedAbsolutePath(resolvedTarget, (_b = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a2));
|
|
37080
|
-
const result =
|
|
37087
|
+
const result = loadFileNameFromPackageJsonField(extensions, finalPath, false, state);
|
|
37081
37088
|
if (result) {
|
|
37082
37089
|
entrypoints = appendIfUnique(entrypoints, result, (a, b) => a.path === b.path);
|
|
37083
37090
|
return true;
|
|
@@ -37431,7 +37438,7 @@ ${lanes.join("\n")}
|
|
|
37431
37438
|
const inputLink = tryLoadInputFileForPath(finalPath, subpath, combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
37432
37439
|
if (inputLink)
|
|
37433
37440
|
return inputLink;
|
|
37434
|
-
return toSearchResult(withPackageId(scope,
|
|
37441
|
+
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(extensions, finalPath, false, state)));
|
|
37435
37442
|
} else if (typeof target === "object" && target !== null) {
|
|
37436
37443
|
if (!Array.isArray(target)) {
|
|
37437
37444
|
for (const condition of getOwnKeys(target)) {
|
|
@@ -37526,7 +37533,7 @@ ${lanes.join("\n")}
|
|
|
37526
37533
|
continue;
|
|
37527
37534
|
const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
37528
37535
|
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
37529
|
-
return toSearchResult(withPackageId(scope,
|
|
37536
|
+
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(extensions, possibleInputWithInputExtension, false, state)));
|
|
37530
37537
|
}
|
|
37531
37538
|
}
|
|
37532
37539
|
}
|
|
@@ -72760,7 +72767,7 @@ ${lanes.join("\n")}
|
|
|
72760
72767
|
} else {
|
|
72761
72768
|
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) {
|
|
72762
72769
|
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
72763
|
-
} else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
72770
|
+
} else if (!(node.flags & 16777216 /* Ambient */) && getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
72764
72771
|
grammarErrorOnNode(node, Diagnostics.Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
72765
72772
|
}
|
|
72766
72773
|
}
|
|
@@ -74947,6 +74954,8 @@ ${lanes.join("\n")}
|
|
|
74947
74954
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly");
|
|
74948
74955
|
} else if (node.kind !== 169 /* PropertyDeclaration */ && node.kind !== 168 /* PropertySignature */ && node.kind !== 178 /* IndexSignature */ && node.kind !== 166 /* Parameter */) {
|
|
74949
74956
|
return grammarErrorOnNode(modifier, Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
|
|
74957
|
+
} else if (flags & 128 /* Accessor */) {
|
|
74958
|
+
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "readonly", "accessor");
|
|
74950
74959
|
}
|
|
74951
74960
|
flags |= 64 /* Readonly */;
|
|
74952
74961
|
break;
|
|
@@ -74990,6 +74999,8 @@ ${lanes.join("\n")}
|
|
|
74990
74999
|
return grammarErrorOnNode(modifier, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
|
|
74991
75000
|
} else if (isPrivateIdentifierClassElementDeclaration(node)) {
|
|
74992
75001
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare");
|
|
75002
|
+
} else if (flags & 128 /* Accessor */) {
|
|
75003
|
+
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "declare", "accessor");
|
|
74993
75004
|
}
|
|
74994
75005
|
flags |= 2 /* Ambient */;
|
|
74995
75006
|
lastDeclare = modifier;
|
|
@@ -106907,7 +106918,7 @@ ${lanes.join("\n")}
|
|
|
106907
106918
|
return contains(screenStartingMessageCodes, diagnostic.code) ? newLine + newLine : newLine;
|
|
106908
106919
|
}
|
|
106909
106920
|
function getLocaleTimeString(system) {
|
|
106910
|
-
return !system.now ? new Date().toLocaleTimeString() : system.now().toLocaleTimeString("en-US", { timeZone: "UTC" });
|
|
106921
|
+
return !system.now ? new Date().toLocaleTimeString() : system.now().toLocaleTimeString("en-US", { timeZone: "UTC" }).replace("\u202F", " ");
|
|
106911
106922
|
}
|
|
106912
106923
|
function createWatchStatusReporter(system, pretty) {
|
|
106913
106924
|
return pretty ? (diagnostic, newLine, options) => {
|
|
@@ -112830,19 +112841,19 @@ ${lanes.join("\n")}
|
|
|
112830
112841
|
function needsParentheses(expression) {
|
|
112831
112842
|
return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
|
|
112832
112843
|
}
|
|
112833
|
-
function getContextualTypeFromParent(node, checker) {
|
|
112844
|
+
function getContextualTypeFromParent(node, checker, contextFlags) {
|
|
112834
112845
|
const { parent: parent2 } = node;
|
|
112835
112846
|
switch (parent2.kind) {
|
|
112836
112847
|
case 211 /* NewExpression */:
|
|
112837
|
-
return checker.getContextualType(parent2);
|
|
112848
|
+
return checker.getContextualType(parent2, contextFlags);
|
|
112838
112849
|
case 223 /* BinaryExpression */: {
|
|
112839
112850
|
const { left, operatorToken, right } = parent2;
|
|
112840
|
-
return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node);
|
|
112851
|
+
return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags);
|
|
112841
112852
|
}
|
|
112842
112853
|
case 292 /* CaseClause */:
|
|
112843
112854
|
return parent2.expression === node ? getSwitchedType(parent2, checker) : void 0;
|
|
112844
112855
|
default:
|
|
112845
|
-
return checker.getContextualType(node);
|
|
112856
|
+
return checker.getContextualType(node, contextFlags);
|
|
112846
112857
|
}
|
|
112847
112858
|
}
|
|
112848
112859
|
function quote(sourceFile, preferences, text) {
|
|
@@ -130980,7 +130991,7 @@ ${lanes.join("\n")}
|
|
|
130980
130991
|
elements.push(factory.createNumericLiteral(type.value));
|
|
130981
130992
|
break;
|
|
130982
130993
|
case "string":
|
|
130983
|
-
elements.push(factory.createStringLiteral(type.value));
|
|
130994
|
+
elements.push(factory.createStringLiteral(type.value, quotePreference === 0 /* Single */));
|
|
130984
130995
|
break;
|
|
130985
130996
|
}
|
|
130986
130997
|
}
|
|
@@ -134058,7 +134069,7 @@ ${lanes.join("\n")}
|
|
|
134058
134069
|
return fromContextualType();
|
|
134059
134070
|
}
|
|
134060
134071
|
function fromContextualType() {
|
|
134061
|
-
return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker)), isNewIdentifier: false };
|
|
134072
|
+
return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, 4 /* Completions */)), isNewIdentifier: false };
|
|
134062
134073
|
}
|
|
134063
134074
|
}
|
|
134064
134075
|
function walkUpParentheses(node) {
|
|
@@ -134981,7 +134992,7 @@ ${lanes.join("\n")}
|
|
|
134981
134992
|
return getSpecialPropertyExport(parent2, true);
|
|
134982
134993
|
} else if (isBinaryExpression(grandparent)) {
|
|
134983
134994
|
return getSpecialPropertyExport(grandparent, true);
|
|
134984
|
-
} else if (isJSDocTypedefTag(parent2)) {
|
|
134995
|
+
} else if (isJSDocTypedefTag(parent2) || isJSDocCallbackTag(parent2)) {
|
|
134985
134996
|
return exportInfo(symbol, 0 /* Named */);
|
|
134986
134997
|
}
|
|
134987
134998
|
}
|
|
@@ -136897,6 +136908,16 @@ ${lanes.join("\n")}
|
|
|
136897
136908
|
const functionDeclaration = findAncestor(node.parent, (n) => isClassStaticBlockDeclaration(n) ? "quit" : isFunctionLikeDeclaration(n));
|
|
136898
136909
|
return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
|
136899
136910
|
}
|
|
136911
|
+
if (node.kind === 133 /* AwaitKeyword */) {
|
|
136912
|
+
const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n));
|
|
136913
|
+
const isAsyncFunction2 = functionDeclaration && some(functionDeclaration.modifiers, (node2) => node2.kind === 132 /* AsyncKeyword */);
|
|
136914
|
+
return isAsyncFunction2 ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
|
136915
|
+
}
|
|
136916
|
+
if (node.kind === 125 /* YieldKeyword */) {
|
|
136917
|
+
const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n));
|
|
136918
|
+
const isGeneratorFunction = functionDeclaration && functionDeclaration.asteriskToken;
|
|
136919
|
+
return isGeneratorFunction ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
|
136920
|
+
}
|
|
136900
136921
|
if (isStaticModifier(node) && isClassStaticBlockDeclaration(node.parent)) {
|
|
136901
136922
|
const classDecl = node.parent.parent;
|
|
136902
136923
|
const { symbol: symbol2, failedAliasResolution: failedAliasResolution2 } = getSymbol(classDecl, typeChecker, stopAtAlias);
|
|
@@ -138435,14 +138456,14 @@ ${lanes.join("\n")}
|
|
|
138435
138456
|
const n = statements.length;
|
|
138436
138457
|
while (current < n) {
|
|
138437
138458
|
while (current < n && !isAnyImportSyntax(statements[current])) {
|
|
138438
|
-
|
|
138459
|
+
visitNode3(statements[current]);
|
|
138439
138460
|
current++;
|
|
138440
138461
|
}
|
|
138441
138462
|
if (current === n)
|
|
138442
138463
|
break;
|
|
138443
138464
|
const firstImport = current;
|
|
138444
138465
|
while (current < n && isAnyImportSyntax(statements[current])) {
|
|
138445
|
-
|
|
138466
|
+
visitNode3(statements[current]);
|
|
138446
138467
|
current++;
|
|
138447
138468
|
}
|
|
138448
138469
|
const lastImport = current - 1;
|
|
@@ -138450,7 +138471,7 @@ ${lanes.join("\n")}
|
|
|
138450
138471
|
out.push(createOutliningSpanFromBounds(findChildOfKind(statements[firstImport], 100 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */));
|
|
138451
138472
|
}
|
|
138452
138473
|
}
|
|
138453
|
-
function
|
|
138474
|
+
function visitNode3(n2) {
|
|
138454
138475
|
var _a2;
|
|
138455
138476
|
if (depthRemaining === 0)
|
|
138456
138477
|
return;
|
|
@@ -138473,18 +138494,18 @@ ${lanes.join("\n")}
|
|
|
138473
138494
|
depthRemaining--;
|
|
138474
138495
|
if (isCallExpression(n2)) {
|
|
138475
138496
|
depthRemaining++;
|
|
138476
|
-
|
|
138497
|
+
visitNode3(n2.expression);
|
|
138477
138498
|
depthRemaining--;
|
|
138478
|
-
n2.arguments.forEach(
|
|
138479
|
-
(_a2 = n2.typeArguments) == null ? void 0 : _a2.forEach(
|
|
138499
|
+
n2.arguments.forEach(visitNode3);
|
|
138500
|
+
(_a2 = n2.typeArguments) == null ? void 0 : _a2.forEach(visitNode3);
|
|
138480
138501
|
} else if (isIfStatement(n2) && n2.elseStatement && isIfStatement(n2.elseStatement)) {
|
|
138481
|
-
|
|
138482
|
-
|
|
138502
|
+
visitNode3(n2.expression);
|
|
138503
|
+
visitNode3(n2.thenStatement);
|
|
138483
138504
|
depthRemaining++;
|
|
138484
|
-
|
|
138505
|
+
visitNode3(n2.elseStatement);
|
|
138485
138506
|
depthRemaining--;
|
|
138486
138507
|
} else {
|
|
138487
|
-
n2.forEachChild(
|
|
138508
|
+
n2.forEachChild(visitNode3);
|
|
138488
138509
|
}
|
|
138489
138510
|
depthRemaining++;
|
|
138490
138511
|
}
|
|
@@ -138633,6 +138654,21 @@ ${lanes.join("\n")}
|
|
|
138633
138654
|
return spanForCallExpression(n);
|
|
138634
138655
|
case 214 /* ParenthesizedExpression */:
|
|
138635
138656
|
return spanForParenthesizedExpression(n);
|
|
138657
|
+
case 272 /* NamedImports */:
|
|
138658
|
+
case 276 /* NamedExports */:
|
|
138659
|
+
case 296 /* AssertClause */:
|
|
138660
|
+
return spanForNamedImportsOrExportsOrAssertClause(n);
|
|
138661
|
+
}
|
|
138662
|
+
function spanForNamedImportsOrExportsOrAssertClause(node) {
|
|
138663
|
+
if (!node.elements.length) {
|
|
138664
|
+
return void 0;
|
|
138665
|
+
}
|
|
138666
|
+
const openToken = findChildOfKind(node, 18 /* OpenBraceToken */, sourceFile);
|
|
138667
|
+
const closeToken = findChildOfKind(node, 19 /* CloseBraceToken */, sourceFile);
|
|
138668
|
+
if (!openToken || !closeToken || positionsAreOnSameLine(openToken.pos, closeToken.pos, sourceFile)) {
|
|
138669
|
+
return void 0;
|
|
138670
|
+
}
|
|
138671
|
+
return spanBetweenTokens(openToken, closeToken, node, sourceFile, false, false);
|
|
138636
138672
|
}
|
|
138637
138673
|
function spanForCallExpression(node) {
|
|
138638
138674
|
if (!node.arguments.length) {
|
|
@@ -161620,6 +161656,7 @@ ${e.message}`;
|
|
|
161620
161656
|
nodeIsSynthesized: () => nodeIsSynthesized,
|
|
161621
161657
|
nodeModuleNameResolver: () => nodeModuleNameResolver,
|
|
161622
161658
|
nodeModulesPathPart: () => nodeModulesPathPart,
|
|
161659
|
+
nodeNextJsonConfigResolver: () => nodeNextJsonConfigResolver,
|
|
161623
161660
|
nodeOrChildIsDecorated: () => nodeOrChildIsDecorated,
|
|
161624
161661
|
nodeOverlapsWithStartEnd: () => nodeOverlapsWithStartEnd,
|
|
161625
161662
|
nodePosToString: () => nodePosToString,
|
|
@@ -164268,6 +164305,7 @@ ${e.message}`;
|
|
|
164268
164305
|
nodeIsSynthesized: () => nodeIsSynthesized,
|
|
164269
164306
|
nodeModuleNameResolver: () => nodeModuleNameResolver,
|
|
164270
164307
|
nodeModulesPathPart: () => nodeModulesPathPart,
|
|
164308
|
+
nodeNextJsonConfigResolver: () => nodeNextJsonConfigResolver,
|
|
164271
164309
|
nodeOrChildIsDecorated: () => nodeOrChildIsDecorated,
|
|
164272
164310
|
nodeOverlapsWithStartEnd: () => nodeOverlapsWithStartEnd,
|
|
164273
164311
|
nodePosToString: () => nodePosToString,
|
package/lib/typescript.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts = (() => {
|
|
|
42
42
|
"src/compiler/corePublic.ts"() {
|
|
43
43
|
"use strict";
|
|
44
44
|
versionMajorMinor = "5.0";
|
|
45
|
-
version = `${versionMajorMinor}.0-dev.
|
|
45
|
+
version = `${versionMajorMinor}.0-dev.20221221`;
|
|
46
46
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
47
47
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
48
48
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4167,13 +4167,13 @@ ${lanes.join("\n")}
|
|
|
4167
4167
|
UnionReduction2[UnionReduction2["Subtype"] = 2] = "Subtype";
|
|
4168
4168
|
return UnionReduction2;
|
|
4169
4169
|
})(UnionReduction || {});
|
|
4170
|
-
ContextFlags = /* @__PURE__ */ ((
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
return
|
|
4170
|
+
ContextFlags = /* @__PURE__ */ ((ContextFlags3) => {
|
|
4171
|
+
ContextFlags3[ContextFlags3["None"] = 0] = "None";
|
|
4172
|
+
ContextFlags3[ContextFlags3["Signature"] = 1] = "Signature";
|
|
4173
|
+
ContextFlags3[ContextFlags3["NoConstraints"] = 2] = "NoConstraints";
|
|
4174
|
+
ContextFlags3[ContextFlags3["Completions"] = 4] = "Completions";
|
|
4175
|
+
ContextFlags3[ContextFlags3["SkipBindingPatterns"] = 8] = "SkipBindingPatterns";
|
|
4176
|
+
return ContextFlags3;
|
|
4177
4177
|
})(ContextFlags || {});
|
|
4178
4178
|
NodeBuilderFlags = /* @__PURE__ */ ((NodeBuilderFlags2) => {
|
|
4179
4179
|
NodeBuilderFlags2[NodeBuilderFlags2["None"] = 0] = "None";
|
|
@@ -33869,7 +33869,7 @@ ${lanes.join("\n")}
|
|
|
33869
33869
|
}
|
|
33870
33870
|
return extendedConfigPath;
|
|
33871
33871
|
}
|
|
33872
|
-
const resolved =
|
|
33872
|
+
const resolved = nodeNextJsonConfigResolver(extendedConfig, combinePaths(basePath, "tsconfig.json"), host);
|
|
33873
33873
|
if (resolved.resolvedModule) {
|
|
33874
33874
|
return resolved.resolvedModule.resolvedFileName;
|
|
33875
33875
|
}
|
|
@@ -36756,6 +36756,9 @@ ${lanes.join("\n")}
|
|
|
36756
36756
|
}
|
|
36757
36757
|
return nodeModuleNameResolverWorker(0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference);
|
|
36758
36758
|
}
|
|
36759
|
+
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
36760
|
+
return nodeModuleNameResolverWorker(8 /* Exports */, moduleName, getDirectoryPath(containingFile), { moduleResolution: 99 /* NodeNext */ }, host, void 0, 8 /* Json */, true, void 0);
|
|
36761
|
+
}
|
|
36759
36762
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference) {
|
|
36760
36763
|
var _a2, _b;
|
|
36761
36764
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -36930,11 +36933,15 @@ ${lanes.join("\n")}
|
|
|
36930
36933
|
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
36931
36934
|
}
|
|
36932
36935
|
}
|
|
36933
|
-
function
|
|
36936
|
+
function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
|
|
36934
36937
|
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
36935
36938
|
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
36936
36939
|
return result !== void 0 ? { path: candidate, ext: tryExtractTSExtension(candidate), resolvedUsingTsExtension: void 0 } : void 0;
|
|
36937
36940
|
}
|
|
36941
|
+
if (state.isConfigLookup && extensions === 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */)) {
|
|
36942
|
+
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
36943
|
+
return result !== void 0 ? { path: candidate, ext: ".json" /* Json */, resolvedUsingTsExtension: void 0 } : void 0;
|
|
36944
|
+
}
|
|
36938
36945
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
36939
36946
|
}
|
|
36940
36947
|
function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecordFailures, state) {
|
|
@@ -37077,7 +37084,7 @@ ${lanes.join("\n")}
|
|
|
37077
37084
|
}
|
|
37078
37085
|
const resolvedTarget = combinePaths(scope.packageDirectory, target);
|
|
37079
37086
|
const finalPath = getNormalizedAbsolutePath(resolvedTarget, (_b = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a2));
|
|
37080
|
-
const result =
|
|
37087
|
+
const result = loadFileNameFromPackageJsonField(extensions, finalPath, false, state);
|
|
37081
37088
|
if (result) {
|
|
37082
37089
|
entrypoints = appendIfUnique(entrypoints, result, (a, b) => a.path === b.path);
|
|
37083
37090
|
return true;
|
|
@@ -37431,7 +37438,7 @@ ${lanes.join("\n")}
|
|
|
37431
37438
|
const inputLink = tryLoadInputFileForPath(finalPath, subpath, combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
37432
37439
|
if (inputLink)
|
|
37433
37440
|
return inputLink;
|
|
37434
|
-
return toSearchResult(withPackageId(scope,
|
|
37441
|
+
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(extensions, finalPath, false, state)));
|
|
37435
37442
|
} else if (typeof target === "object" && target !== null) {
|
|
37436
37443
|
if (!Array.isArray(target)) {
|
|
37437
37444
|
for (const condition of getOwnKeys(target)) {
|
|
@@ -37526,7 +37533,7 @@ ${lanes.join("\n")}
|
|
|
37526
37533
|
continue;
|
|
37527
37534
|
const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
37528
37535
|
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
37529
|
-
return toSearchResult(withPackageId(scope,
|
|
37536
|
+
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(extensions, possibleInputWithInputExtension, false, state)));
|
|
37530
37537
|
}
|
|
37531
37538
|
}
|
|
37532
37539
|
}
|
|
@@ -72760,7 +72767,7 @@ ${lanes.join("\n")}
|
|
|
72760
72767
|
} else {
|
|
72761
72768
|
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) {
|
|
72762
72769
|
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
72763
|
-
} else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
72770
|
+
} else if (!(node.flags & 16777216 /* Ambient */) && getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
72764
72771
|
grammarErrorOnNode(node, Diagnostics.Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
72765
72772
|
}
|
|
72766
72773
|
}
|
|
@@ -74947,6 +74954,8 @@ ${lanes.join("\n")}
|
|
|
74947
74954
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly");
|
|
74948
74955
|
} else if (node.kind !== 169 /* PropertyDeclaration */ && node.kind !== 168 /* PropertySignature */ && node.kind !== 178 /* IndexSignature */ && node.kind !== 166 /* Parameter */) {
|
|
74949
74956
|
return grammarErrorOnNode(modifier, Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
|
|
74957
|
+
} else if (flags & 128 /* Accessor */) {
|
|
74958
|
+
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "readonly", "accessor");
|
|
74950
74959
|
}
|
|
74951
74960
|
flags |= 64 /* Readonly */;
|
|
74952
74961
|
break;
|
|
@@ -74990,6 +74999,8 @@ ${lanes.join("\n")}
|
|
|
74990
74999
|
return grammarErrorOnNode(modifier, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
|
|
74991
75000
|
} else if (isPrivateIdentifierClassElementDeclaration(node)) {
|
|
74992
75001
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare");
|
|
75002
|
+
} else if (flags & 128 /* Accessor */) {
|
|
75003
|
+
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "declare", "accessor");
|
|
74993
75004
|
}
|
|
74994
75005
|
flags |= 2 /* Ambient */;
|
|
74995
75006
|
lastDeclare = modifier;
|
|
@@ -106907,7 +106918,7 @@ ${lanes.join("\n")}
|
|
|
106907
106918
|
return contains(screenStartingMessageCodes, diagnostic.code) ? newLine + newLine : newLine;
|
|
106908
106919
|
}
|
|
106909
106920
|
function getLocaleTimeString(system) {
|
|
106910
|
-
return !system.now ? new Date().toLocaleTimeString() : system.now().toLocaleTimeString("en-US", { timeZone: "UTC" });
|
|
106921
|
+
return !system.now ? new Date().toLocaleTimeString() : system.now().toLocaleTimeString("en-US", { timeZone: "UTC" }).replace("\u202F", " ");
|
|
106911
106922
|
}
|
|
106912
106923
|
function createWatchStatusReporter(system, pretty) {
|
|
106913
106924
|
return pretty ? (diagnostic, newLine, options) => {
|
|
@@ -112844,19 +112855,19 @@ ${lanes.join("\n")}
|
|
|
112844
112855
|
function needsParentheses(expression) {
|
|
112845
112856
|
return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
|
|
112846
112857
|
}
|
|
112847
|
-
function getContextualTypeFromParent(node, checker) {
|
|
112858
|
+
function getContextualTypeFromParent(node, checker, contextFlags) {
|
|
112848
112859
|
const { parent: parent2 } = node;
|
|
112849
112860
|
switch (parent2.kind) {
|
|
112850
112861
|
case 211 /* NewExpression */:
|
|
112851
|
-
return checker.getContextualType(parent2);
|
|
112862
|
+
return checker.getContextualType(parent2, contextFlags);
|
|
112852
112863
|
case 223 /* BinaryExpression */: {
|
|
112853
112864
|
const { left, operatorToken, right } = parent2;
|
|
112854
|
-
return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node);
|
|
112865
|
+
return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags);
|
|
112855
112866
|
}
|
|
112856
112867
|
case 292 /* CaseClause */:
|
|
112857
112868
|
return parent2.expression === node ? getSwitchedType(parent2, checker) : void 0;
|
|
112858
112869
|
default:
|
|
112859
|
-
return checker.getContextualType(node);
|
|
112870
|
+
return checker.getContextualType(node, contextFlags);
|
|
112860
112871
|
}
|
|
112861
112872
|
}
|
|
112862
112873
|
function quote(sourceFile, preferences, text) {
|
|
@@ -130994,7 +131005,7 @@ ${lanes.join("\n")}
|
|
|
130994
131005
|
elements.push(factory.createNumericLiteral(type.value));
|
|
130995
131006
|
break;
|
|
130996
131007
|
case "string":
|
|
130997
|
-
elements.push(factory.createStringLiteral(type.value));
|
|
131008
|
+
elements.push(factory.createStringLiteral(type.value, quotePreference === 0 /* Single */));
|
|
130998
131009
|
break;
|
|
130999
131010
|
}
|
|
131000
131011
|
}
|
|
@@ -134072,7 +134083,7 @@ ${lanes.join("\n")}
|
|
|
134072
134083
|
return fromContextualType();
|
|
134073
134084
|
}
|
|
134074
134085
|
function fromContextualType() {
|
|
134075
|
-
return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker)), isNewIdentifier: false };
|
|
134086
|
+
return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, 4 /* Completions */)), isNewIdentifier: false };
|
|
134076
134087
|
}
|
|
134077
134088
|
}
|
|
134078
134089
|
function walkUpParentheses(node) {
|
|
@@ -134995,7 +135006,7 @@ ${lanes.join("\n")}
|
|
|
134995
135006
|
return getSpecialPropertyExport(parent2, true);
|
|
134996
135007
|
} else if (isBinaryExpression(grandparent)) {
|
|
134997
135008
|
return getSpecialPropertyExport(grandparent, true);
|
|
134998
|
-
} else if (isJSDocTypedefTag(parent2)) {
|
|
135009
|
+
} else if (isJSDocTypedefTag(parent2) || isJSDocCallbackTag(parent2)) {
|
|
134999
135010
|
return exportInfo(symbol, 0 /* Named */);
|
|
135000
135011
|
}
|
|
135001
135012
|
}
|
|
@@ -136911,6 +136922,16 @@ ${lanes.join("\n")}
|
|
|
136911
136922
|
const functionDeclaration = findAncestor(node.parent, (n) => isClassStaticBlockDeclaration(n) ? "quit" : isFunctionLikeDeclaration(n));
|
|
136912
136923
|
return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
|
136913
136924
|
}
|
|
136925
|
+
if (node.kind === 133 /* AwaitKeyword */) {
|
|
136926
|
+
const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n));
|
|
136927
|
+
const isAsyncFunction2 = functionDeclaration && some(functionDeclaration.modifiers, (node2) => node2.kind === 132 /* AsyncKeyword */);
|
|
136928
|
+
return isAsyncFunction2 ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
|
136929
|
+
}
|
|
136930
|
+
if (node.kind === 125 /* YieldKeyword */) {
|
|
136931
|
+
const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n));
|
|
136932
|
+
const isGeneratorFunction = functionDeclaration && functionDeclaration.asteriskToken;
|
|
136933
|
+
return isGeneratorFunction ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
|
136934
|
+
}
|
|
136914
136935
|
if (isStaticModifier(node) && isClassStaticBlockDeclaration(node.parent)) {
|
|
136915
136936
|
const classDecl = node.parent.parent;
|
|
136916
136937
|
const { symbol: symbol2, failedAliasResolution: failedAliasResolution2 } = getSymbol(classDecl, typeChecker, stopAtAlias);
|
|
@@ -138449,14 +138470,14 @@ ${lanes.join("\n")}
|
|
|
138449
138470
|
const n = statements.length;
|
|
138450
138471
|
while (current < n) {
|
|
138451
138472
|
while (current < n && !isAnyImportSyntax(statements[current])) {
|
|
138452
|
-
|
|
138473
|
+
visitNode3(statements[current]);
|
|
138453
138474
|
current++;
|
|
138454
138475
|
}
|
|
138455
138476
|
if (current === n)
|
|
138456
138477
|
break;
|
|
138457
138478
|
const firstImport = current;
|
|
138458
138479
|
while (current < n && isAnyImportSyntax(statements[current])) {
|
|
138459
|
-
|
|
138480
|
+
visitNode3(statements[current]);
|
|
138460
138481
|
current++;
|
|
138461
138482
|
}
|
|
138462
138483
|
const lastImport = current - 1;
|
|
@@ -138464,7 +138485,7 @@ ${lanes.join("\n")}
|
|
|
138464
138485
|
out.push(createOutliningSpanFromBounds(findChildOfKind(statements[firstImport], 100 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */));
|
|
138465
138486
|
}
|
|
138466
138487
|
}
|
|
138467
|
-
function
|
|
138488
|
+
function visitNode3(n2) {
|
|
138468
138489
|
var _a2;
|
|
138469
138490
|
if (depthRemaining === 0)
|
|
138470
138491
|
return;
|
|
@@ -138487,18 +138508,18 @@ ${lanes.join("\n")}
|
|
|
138487
138508
|
depthRemaining--;
|
|
138488
138509
|
if (isCallExpression(n2)) {
|
|
138489
138510
|
depthRemaining++;
|
|
138490
|
-
|
|
138511
|
+
visitNode3(n2.expression);
|
|
138491
138512
|
depthRemaining--;
|
|
138492
|
-
n2.arguments.forEach(
|
|
138493
|
-
(_a2 = n2.typeArguments) == null ? void 0 : _a2.forEach(
|
|
138513
|
+
n2.arguments.forEach(visitNode3);
|
|
138514
|
+
(_a2 = n2.typeArguments) == null ? void 0 : _a2.forEach(visitNode3);
|
|
138494
138515
|
} else if (isIfStatement(n2) && n2.elseStatement && isIfStatement(n2.elseStatement)) {
|
|
138495
|
-
|
|
138496
|
-
|
|
138516
|
+
visitNode3(n2.expression);
|
|
138517
|
+
visitNode3(n2.thenStatement);
|
|
138497
138518
|
depthRemaining++;
|
|
138498
|
-
|
|
138519
|
+
visitNode3(n2.elseStatement);
|
|
138499
138520
|
depthRemaining--;
|
|
138500
138521
|
} else {
|
|
138501
|
-
n2.forEachChild(
|
|
138522
|
+
n2.forEachChild(visitNode3);
|
|
138502
138523
|
}
|
|
138503
138524
|
depthRemaining++;
|
|
138504
138525
|
}
|
|
@@ -138647,6 +138668,21 @@ ${lanes.join("\n")}
|
|
|
138647
138668
|
return spanForCallExpression(n);
|
|
138648
138669
|
case 214 /* ParenthesizedExpression */:
|
|
138649
138670
|
return spanForParenthesizedExpression(n);
|
|
138671
|
+
case 272 /* NamedImports */:
|
|
138672
|
+
case 276 /* NamedExports */:
|
|
138673
|
+
case 296 /* AssertClause */:
|
|
138674
|
+
return spanForNamedImportsOrExportsOrAssertClause(n);
|
|
138675
|
+
}
|
|
138676
|
+
function spanForNamedImportsOrExportsOrAssertClause(node) {
|
|
138677
|
+
if (!node.elements.length) {
|
|
138678
|
+
return void 0;
|
|
138679
|
+
}
|
|
138680
|
+
const openToken = findChildOfKind(node, 18 /* OpenBraceToken */, sourceFile);
|
|
138681
|
+
const closeToken = findChildOfKind(node, 19 /* CloseBraceToken */, sourceFile);
|
|
138682
|
+
if (!openToken || !closeToken || positionsAreOnSameLine(openToken.pos, closeToken.pos, sourceFile)) {
|
|
138683
|
+
return void 0;
|
|
138684
|
+
}
|
|
138685
|
+
return spanBetweenTokens(openToken, closeToken, node, sourceFile, false, false);
|
|
138650
138686
|
}
|
|
138651
138687
|
function spanForCallExpression(node) {
|
|
138652
138688
|
if (!node.arguments.length) {
|
|
@@ -151996,6 +152032,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
151996
152032
|
nodeIsSynthesized: () => nodeIsSynthesized,
|
|
151997
152033
|
nodeModuleNameResolver: () => nodeModuleNameResolver,
|
|
151998
152034
|
nodeModulesPathPart: () => nodeModulesPathPart,
|
|
152035
|
+
nodeNextJsonConfigResolver: () => nodeNextJsonConfigResolver,
|
|
151999
152036
|
nodeOrChildIsDecorated: () => nodeOrChildIsDecorated,
|
|
152000
152037
|
nodeOverlapsWithStartEnd: () => nodeOverlapsWithStartEnd,
|
|
152001
152038
|
nodePosToString: () => nodePosToString,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -50,7 +50,7 @@ var path = __toESM(require("path"));
|
|
|
50
50
|
|
|
51
51
|
// src/compiler/corePublic.ts
|
|
52
52
|
var versionMajorMinor = "5.0";
|
|
53
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
53
|
+
var version = `${versionMajorMinor}.0-dev.20221221`;
|
|
54
54
|
|
|
55
55
|
// src/compiler/core.ts
|
|
56
56
|
var emptyArray = [];
|
|
@@ -26889,11 +26889,15 @@ function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecor
|
|
|
26889
26889
|
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
26890
26890
|
}
|
|
26891
26891
|
}
|
|
26892
|
-
function
|
|
26892
|
+
function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
|
|
26893
26893
|
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
26894
26894
|
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
26895
26895
|
return result !== void 0 ? { path: candidate, ext: tryExtractTSExtension(candidate), resolvedUsingTsExtension: void 0 } : void 0;
|
|
26896
26896
|
}
|
|
26897
|
+
if (state.isConfigLookup && extensions === 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */)) {
|
|
26898
|
+
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
26899
|
+
return result !== void 0 ? { path: candidate, ext: ".json" /* Json */, resolvedUsingTsExtension: void 0 } : void 0;
|
|
26900
|
+
}
|
|
26897
26901
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
26898
26902
|
}
|
|
26899
26903
|
function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecordFailures, state) {
|
|
@@ -27289,7 +27293,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
27289
27293
|
const inputLink = tryLoadInputFileForPath(finalPath, subpath, combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
27290
27294
|
if (inputLink)
|
|
27291
27295
|
return inputLink;
|
|
27292
|
-
return toSearchResult(withPackageId(scope,
|
|
27296
|
+
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(extensions, finalPath, false, state)));
|
|
27293
27297
|
} else if (typeof target === "object" && target !== null) {
|
|
27294
27298
|
if (!Array.isArray(target)) {
|
|
27295
27299
|
for (const condition of getOwnKeys(target)) {
|
|
@@ -27384,7 +27388,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
27384
27388
|
continue;
|
|
27385
27389
|
const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
27386
27390
|
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
27387
|
-
return toSearchResult(withPackageId(scope,
|
|
27391
|
+
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(extensions, possibleInputWithInputExtension, false, state)));
|
|
27388
27392
|
}
|
|
27389
27393
|
}
|
|
27390
27394
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.0.0-dev.
|
|
5
|
+
"version": "5.0.0-dev.20221221",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|