typescript 5.0.0-dev.20230109 → 5.0.0-dev.20230111
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 +160 -105
- package/lib/tsserver.js +165 -108
- package/lib/tsserverlibrary.d.ts +2 -2
- package/lib/tsserverlibrary.js +164 -107
- package/lib/typescript.d.ts +2 -2
- package/lib/typescript.js +163 -106
- package/lib/typingsInstaller.js +70 -64
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -1735,6 +1735,7 @@ __export(server_exports, {
|
|
|
1735
1735
|
isNonContextualKeyword: () => isNonContextualKeyword,
|
|
1736
1736
|
isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
|
|
1737
1737
|
isNonGlobalDeclaration: () => isNonGlobalDeclaration,
|
|
1738
|
+
isNonNullAccess: () => isNonNullAccess,
|
|
1738
1739
|
isNonNullChain: () => isNonNullChain,
|
|
1739
1740
|
isNonNullExpression: () => isNonNullExpression,
|
|
1740
1741
|
isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
|
|
@@ -2010,7 +2011,6 @@ __export(server_exports, {
|
|
|
2010
2011
|
moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
|
|
2011
2012
|
moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
|
|
2012
2013
|
moduleResolutionSupportsPackageJsonExportsAndImports: () => moduleResolutionSupportsPackageJsonExportsAndImports,
|
|
2013
|
-
moduleResolutionSupportsResolvingTsExtensions: () => moduleResolutionSupportsResolvingTsExtensions,
|
|
2014
2014
|
moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
|
|
2015
2015
|
moduleSpecifiers: () => ts_moduleSpecifiers_exports,
|
|
2016
2016
|
moveEmitHelpers: () => moveEmitHelpers,
|
|
@@ -2662,7 +2662,7 @@ __export(ts_server_exports3, {
|
|
|
2662
2662
|
|
|
2663
2663
|
// src/compiler/corePublic.ts
|
|
2664
2664
|
var versionMajorMinor = "5.0";
|
|
2665
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2665
|
+
var version = `${versionMajorMinor}.0-dev.20230111`;
|
|
2666
2666
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2667
2667
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2668
2668
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -10568,6 +10568,7 @@ var Diagnostics = {
|
|
|
10568
10568
|
Default_export_of_the_module_has_or_is_using_private_name_0: diag(4082, 1 /* Error */, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."),
|
|
10569
10569
|
Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: diag(4083, 1 /* Error */, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."),
|
|
10570
10570
|
Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2: diag(4084, 1 /* Error */, "Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084", "Exported type alias '{0}' has or is using private name '{1}' from module {2}."),
|
|
10571
|
+
Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1: diag(4085, 1 /* Error */, "Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085", "Extends clause for inferred type '{0}' has or is using private name '{1}'."),
|
|
10571
10572
|
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: diag(4090, 1 /* Error */, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."),
|
|
10572
10573
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
|
|
10573
10574
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
|
|
@@ -10939,6 +10940,9 @@ var Diagnostics = {
|
|
|
10939
10940
|
Found_1_error_in_1: diag(6259, 3 /* Message */, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
10940
10941
|
Found_0_errors_in_the_same_file_starting_at_Colon_1: diag(6260, 3 /* Message */, "Found_0_errors_in_the_same_file_starting_at_Colon_1_6260", "Found {0} errors in the same file, starting at: {1}"),
|
|
10941
10942
|
Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
10943
|
+
File_name_0_has_a_1_extension_looking_up_2_instead: diag(6262, 3 /* Message */, "File_name_0_has_a_1_extension_looking_up_2_instead_6262", "File name '{0}' has a '{1}' extension - looking up '{2}' instead."),
|
|
10944
|
+
Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set: diag(6263, 1 /* Error */, "Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set_6263", "Module '{0}' was resolved to '{1}', but '--allowArbitraryExtensions' is not set."),
|
|
10945
|
+
Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present: diag(6264, 3 /* Message */, "Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present_6264", "Enable importing files with any extension, provided a declaration file is present."),
|
|
10942
10946
|
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, 3 /* Message */, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
10943
10947
|
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, 3 /* Message */, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
10944
10948
|
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, 3 /* Message */, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
@@ -18484,13 +18488,13 @@ function getDeclarationEmitOutputFilePathWorker(fileName, options, currentDirect
|
|
|
18484
18488
|
return removeFileExtension(path) + declarationExtension;
|
|
18485
18489
|
}
|
|
18486
18490
|
function getDeclarationEmitExtensionForPath(path) {
|
|
18487
|
-
return fileExtensionIsOneOf(path, [".mjs" /* Mjs */, ".mts" /* Mts */]) ? ".d.mts" /* Dmts */ : fileExtensionIsOneOf(path, [".cjs" /* Cjs */, ".cts" /* Cts */]) ? ".d.cts" /* Dcts */ : fileExtensionIsOneOf(path, [".json" /* Json */]) ? `.json.
|
|
18491
|
+
return fileExtensionIsOneOf(path, [".mjs" /* Mjs */, ".mts" /* Mts */]) ? ".d.mts" /* Dmts */ : fileExtensionIsOneOf(path, [".cjs" /* Cjs */, ".cts" /* Cts */]) ? ".d.cts" /* Dcts */ : fileExtensionIsOneOf(path, [".json" /* Json */]) ? `.d.json.ts` : (
|
|
18488
18492
|
// Drive-by redefinition of json declaration file output name so if it's ever enabled, it behaves well
|
|
18489
18493
|
".d.ts" /* Dts */
|
|
18490
18494
|
);
|
|
18491
18495
|
}
|
|
18492
18496
|
function getPossibleOriginalInputExtensionForExtension(path) {
|
|
18493
|
-
return fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] : fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] : fileExtensionIsOneOf(path, [`.json.
|
|
18497
|
+
return fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] : fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] : fileExtensionIsOneOf(path, [`.d.json.ts`]) ? [".json" /* Json */] : [".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
|
|
18494
18498
|
}
|
|
18495
18499
|
function outFile(options) {
|
|
18496
18500
|
return options.outFile || options.out;
|
|
@@ -20574,7 +20578,7 @@ function positionIsSynthesized(pos) {
|
|
|
20574
20578
|
return !(pos >= 0);
|
|
20575
20579
|
}
|
|
20576
20580
|
function extensionIsTS(ext) {
|
|
20577
|
-
return ext === ".ts" /* Ts */ || ext === ".tsx" /* Tsx */ || ext === ".d.ts" /* Dts */ || ext === ".cts" /* Cts */ || ext === ".mts" /* Mts */ || ext === ".d.mts" /* Dmts */ || ext === ".d.cts" /* Dcts
|
|
20581
|
+
return ext === ".ts" /* Ts */ || ext === ".tsx" /* Tsx */ || ext === ".d.ts" /* Dts */ || ext === ".cts" /* Cts */ || ext === ".mts" /* Mts */ || ext === ".d.mts" /* Dmts */ || ext === ".d.cts" /* Dcts */ || startsWith(ext, ".d.") && endsWith(ext, ".ts");
|
|
20578
20582
|
}
|
|
20579
20583
|
function resolutionExtensionIsTSOrJson(ext) {
|
|
20580
20584
|
return extensionIsTS(ext) || ext === ".json" /* Json */;
|
|
@@ -21100,6 +21104,10 @@ function isOptionalDeclaration(declaration) {
|
|
|
21100
21104
|
return false;
|
|
21101
21105
|
}
|
|
21102
21106
|
}
|
|
21107
|
+
function isNonNullAccess(node) {
|
|
21108
|
+
const kind = node.kind;
|
|
21109
|
+
return (kind === 208 /* PropertyAccessExpression */ || kind === 209 /* ElementAccessExpression */) && isNonNullExpression(node.expression);
|
|
21110
|
+
}
|
|
21103
21111
|
|
|
21104
21112
|
// src/compiler/factory/baseNodeFactory.ts
|
|
21105
21113
|
function createBaseNodeFactory() {
|
|
@@ -36733,7 +36741,7 @@ var IncrementalParser;
|
|
|
36733
36741
|
})(InvalidPosition || (InvalidPosition = {}));
|
|
36734
36742
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
36735
36743
|
function isDeclarationFileName(fileName) {
|
|
36736
|
-
return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions);
|
|
36744
|
+
return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions) || fileExtensionIs(fileName, ".ts" /* Ts */) && stringContains(getBaseFileName(fileName), ".d.");
|
|
36737
36745
|
}
|
|
36738
36746
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
36739
36747
|
if (!mode) {
|
|
@@ -37991,6 +37999,14 @@ var commandOptionsWithoutBuild = [
|
|
|
37991
37999
|
description: Diagnostics.Enable_importing_json_files,
|
|
37992
38000
|
defaultValueDescription: false
|
|
37993
38001
|
},
|
|
38002
|
+
{
|
|
38003
|
+
name: "allowArbitraryExtensions",
|
|
38004
|
+
type: "boolean",
|
|
38005
|
+
affectsModuleResolution: true,
|
|
38006
|
+
category: Diagnostics.Modules,
|
|
38007
|
+
description: Diagnostics.Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present,
|
|
38008
|
+
defaultValueDescription: false
|
|
38009
|
+
},
|
|
37994
38010
|
{
|
|
37995
38011
|
name: "out",
|
|
37996
38012
|
type: "string",
|
|
@@ -40488,7 +40504,8 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
40488
40504
|
conditions,
|
|
40489
40505
|
requestContainingDirectory: containingDirectory,
|
|
40490
40506
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
40491
|
-
isConfigLookup: false
|
|
40507
|
+
isConfigLookup: false,
|
|
40508
|
+
candidateIsFromPackageJsonField: false
|
|
40492
40509
|
};
|
|
40493
40510
|
let resolved = primaryLookup();
|
|
40494
40511
|
let primary = true;
|
|
@@ -41359,7 +41376,8 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
41359
41376
|
conditions,
|
|
41360
41377
|
requestContainingDirectory: containingDirectory,
|
|
41361
41378
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
41362
|
-
isConfigLookup
|
|
41379
|
+
isConfigLookup,
|
|
41380
|
+
candidateIsFromPackageJsonField: false
|
|
41363
41381
|
};
|
|
41364
41382
|
if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
|
|
41365
41383
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
@@ -41527,14 +41545,19 @@ function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
|
|
|
41527
41545
|
}
|
|
41528
41546
|
}
|
|
41529
41547
|
function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
|
|
41530
|
-
|
|
41531
|
-
|
|
41532
|
-
|
|
41533
|
-
if (state.traceEnabled) {
|
|
41534
|
-
trace(state.host, Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
|
|
41535
|
-
}
|
|
41536
|
-
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
41548
|
+
const filename = getBaseFileName(candidate);
|
|
41549
|
+
if (filename.indexOf(".") === -1) {
|
|
41550
|
+
return void 0;
|
|
41537
41551
|
}
|
|
41552
|
+
let extensionless = removeFileExtension(candidate);
|
|
41553
|
+
if (extensionless === candidate) {
|
|
41554
|
+
extensionless = candidate.substring(0, candidate.lastIndexOf("."));
|
|
41555
|
+
}
|
|
41556
|
+
const extension = candidate.substring(extensionless.length);
|
|
41557
|
+
if (state.traceEnabled) {
|
|
41558
|
+
trace(state.host, Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
|
|
41559
|
+
}
|
|
41560
|
+
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
41538
41561
|
}
|
|
41539
41562
|
function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
|
|
41540
41563
|
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
@@ -41558,42 +41581,27 @@ function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecor
|
|
|
41558
41581
|
case ".mjs" /* Mjs */:
|
|
41559
41582
|
case ".mts" /* Mts */:
|
|
41560
41583
|
case ".d.mts" /* Dmts */:
|
|
41561
|
-
return extensions & 1 /* TypeScript */ && tryExtension(".mts" /* Mts */) || extensions & 4 /* Declaration */ && tryExtension(".d.mts" /* Dmts */) || extensions & 2 /* JavaScript */ && tryExtension(".mjs" /* Mjs */) || void 0;
|
|
41584
|
+
return extensions & 1 /* TypeScript */ && tryExtension(".mts" /* Mts */, originalExtension === ".mts" /* Mts */ || originalExtension === ".d.mts" /* Dmts */) || extensions & 4 /* Declaration */ && tryExtension(".d.mts" /* Dmts */, originalExtension === ".mts" /* Mts */ || originalExtension === ".d.mts" /* Dmts */) || extensions & 2 /* JavaScript */ && tryExtension(".mjs" /* Mjs */) || void 0;
|
|
41562
41585
|
case ".cjs" /* Cjs */:
|
|
41563
41586
|
case ".cts" /* Cts */:
|
|
41564
41587
|
case ".d.cts" /* Dcts */:
|
|
41565
|
-
return extensions & 1 /* TypeScript */ && tryExtension(".cts" /* Cts */) || extensions & 4 /* Declaration */ && tryExtension(".d.cts" /* Dcts */) || extensions & 2 /* JavaScript */ && tryExtension(".cjs" /* Cjs */) || void 0;
|
|
41588
|
+
return extensions & 1 /* TypeScript */ && tryExtension(".cts" /* Cts */, originalExtension === ".cts" /* Cts */ || originalExtension === ".d.cts" /* Dcts */) || extensions & 4 /* Declaration */ && tryExtension(".d.cts" /* Dcts */, originalExtension === ".cts" /* Cts */ || originalExtension === ".d.cts" /* Dcts */) || extensions & 2 /* JavaScript */ && tryExtension(".cjs" /* Cjs */) || void 0;
|
|
41566
41589
|
case ".json" /* Json */:
|
|
41567
|
-
|
|
41568
|
-
if (extensions & 4 /* Declaration */) {
|
|
41569
|
-
candidate += ".json" /* Json */;
|
|
41570
|
-
const result = tryExtension(".d.ts" /* Dts */);
|
|
41571
|
-
if (result)
|
|
41572
|
-
return result;
|
|
41573
|
-
}
|
|
41574
|
-
if (extensions & 8 /* Json */) {
|
|
41575
|
-
candidate = originalCandidate;
|
|
41576
|
-
const result = tryExtension(".json" /* Json */);
|
|
41577
|
-
if (result)
|
|
41578
|
-
return result;
|
|
41579
|
-
}
|
|
41580
|
-
return void 0;
|
|
41581
|
-
case ".ts" /* Ts */:
|
|
41590
|
+
return extensions & 4 /* Declaration */ && tryExtension(".d.json.ts") || extensions & 8 /* Json */ && tryExtension(".json" /* Json */) || void 0;
|
|
41582
41591
|
case ".tsx" /* Tsx */:
|
|
41592
|
+
case ".jsx" /* Jsx */:
|
|
41593
|
+
return extensions & 1 /* TypeScript */ && (tryExtension(".tsx" /* Tsx */, originalExtension === ".tsx" /* Tsx */) || tryExtension(".ts" /* Ts */, originalExtension === ".tsx" /* Tsx */)) || extensions & 4 /* Declaration */ && tryExtension(".d.ts" /* Dts */, originalExtension === ".tsx" /* Tsx */) || extensions & 2 /* JavaScript */ && (tryExtension(".jsx" /* Jsx */) || tryExtension(".js" /* Js */)) || void 0;
|
|
41594
|
+
case ".ts" /* Ts */:
|
|
41583
41595
|
case ".d.ts" /* Dts */:
|
|
41584
|
-
|
|
41585
|
-
|
|
41586
|
-
|
|
41587
|
-
/*resolvedUsingTsExtension*/
|
|
41588
|
-
true
|
|
41589
|
-
);
|
|
41590
|
-
}
|
|
41596
|
+
case ".js" /* Js */:
|
|
41597
|
+
case "":
|
|
41598
|
+
return extensions & 1 /* TypeScript */ && (tryExtension(".ts" /* Ts */, originalExtension === ".ts" /* Ts */ || originalExtension === ".d.ts" /* Dts */) || tryExtension(".tsx" /* Tsx */, originalExtension === ".ts" /* Ts */ || originalExtension === ".d.ts" /* Dts */)) || extensions & 4 /* Declaration */ && tryExtension(".d.ts" /* Dts */, originalExtension === ".ts" /* Ts */ || originalExtension === ".d.ts" /* Dts */) || extensions & 2 /* JavaScript */ && (tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */)) || state.isConfigLookup && tryExtension(".json" /* Json */) || void 0;
|
|
41591
41599
|
default:
|
|
41592
|
-
return extensions &
|
|
41600
|
+
return extensions & 4 /* Declaration */ && !isDeclarationFileName(candidate + originalExtension) && tryExtension(`.d${originalExtension}.ts`) || void 0;
|
|
41593
41601
|
}
|
|
41594
41602
|
function tryExtension(ext, resolvedUsingTsExtension) {
|
|
41595
41603
|
const path = tryFile(candidate + ext, onlyRecordFailures, state);
|
|
41596
|
-
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension };
|
|
41604
|
+
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension: !state.candidateIsFromPackageJsonField && resolvedUsingTsExtension };
|
|
41597
41605
|
}
|
|
41598
41606
|
}
|
|
41599
41607
|
function tryFile(fileName, onlyRecordFailures, state) {
|
|
@@ -41740,7 +41748,8 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
41740
41748
|
conditions: emptyArray,
|
|
41741
41749
|
requestContainingDirectory: void 0,
|
|
41742
41750
|
reportDiagnostic: noop,
|
|
41743
|
-
isConfigLookup: false
|
|
41751
|
+
isConfigLookup: false,
|
|
41752
|
+
candidateIsFromPackageJsonField: false
|
|
41744
41753
|
};
|
|
41745
41754
|
}
|
|
41746
41755
|
function getPackageScopeForPath(fileName, state) {
|
|
@@ -41828,6 +41837,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
41828
41837
|
}
|
|
41829
41838
|
const expandedExtensions = extensions2 === 4 /* Declaration */ ? 1 /* TypeScript */ | 4 /* Declaration */ : extensions2;
|
|
41830
41839
|
const features = state2.features;
|
|
41840
|
+
const candidateIsFromPackageJsonField = state2.candidateIsFromPackageJsonField;
|
|
41841
|
+
state2.candidateIsFromPackageJsonField = true;
|
|
41831
41842
|
if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
|
|
41832
41843
|
state2.features &= ~32 /* EsmMode */;
|
|
41833
41844
|
}
|
|
@@ -41840,6 +41851,7 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
41840
41851
|
false
|
|
41841
41852
|
);
|
|
41842
41853
|
state2.features = features;
|
|
41854
|
+
state2.candidateIsFromPackageJsonField = candidateIsFromPackageJsonField;
|
|
41843
41855
|
return result;
|
|
41844
41856
|
};
|
|
41845
41857
|
const onlyRecordFailuresForPackageFile = packageFile ? !directoryProbablyExists(getDirectoryPath(packageFile), state.host) : void 0;
|
|
@@ -41913,7 +41925,10 @@ function loadModuleFromSelfNameReference(extensions, moduleName, directory, stat
|
|
|
41913
41925
|
return void 0;
|
|
41914
41926
|
}
|
|
41915
41927
|
const trailingParts = parts.slice(nameParts.length);
|
|
41916
|
-
|
|
41928
|
+
const subpath = !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`;
|
|
41929
|
+
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
41930
|
+
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
41931
|
+
return loadModuleFromExports(scope, priorityExtensions, subpath, state, cache, redirectedReference) || loadModuleFromExports(scope, secondaryExtensions, subpath, state, cache, redirectedReference);
|
|
41917
41932
|
}
|
|
41918
41933
|
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
41919
41934
|
if (!scope.contents.packageJsonContent.exports) {
|
|
@@ -42415,25 +42430,26 @@ function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, dir
|
|
|
42415
42430
|
}
|
|
42416
42431
|
}
|
|
42417
42432
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
42418
|
-
var _a2;
|
|
42433
|
+
var _a2, _b, _c;
|
|
42419
42434
|
const candidate = normalizePath(combinePaths(nodeModulesDirectory, moduleName));
|
|
42435
|
+
const { packageName, rest } = parsePackageName(moduleName);
|
|
42436
|
+
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
42437
|
+
let rootPackageInfo;
|
|
42420
42438
|
let packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
42421
|
-
if (!(state.features & 8 /* Exports */)) {
|
|
42422
|
-
|
|
42423
|
-
|
|
42424
|
-
|
|
42425
|
-
return noPackageId(fromFile);
|
|
42426
|
-
}
|
|
42427
|
-
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
42428
|
-
extensions,
|
|
42429
|
-
candidate,
|
|
42430
|
-
!nodeModulesDirectoryExists,
|
|
42431
|
-
state,
|
|
42432
|
-
packageInfo.contents.packageJsonContent,
|
|
42433
|
-
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
42434
|
-
);
|
|
42435
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
42439
|
+
if (rest !== "" && packageInfo && (!(state.features & 8 /* Exports */) || !hasProperty((_b = (_a2 = rootPackageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state)) == null ? void 0 : _a2.contents.packageJsonContent) != null ? _b : emptyArray, "exports"))) {
|
|
42440
|
+
const fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
42441
|
+
if (fromFile) {
|
|
42442
|
+
return noPackageId(fromFile);
|
|
42436
42443
|
}
|
|
42444
|
+
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
42445
|
+
extensions,
|
|
42446
|
+
candidate,
|
|
42447
|
+
!nodeModulesDirectoryExists,
|
|
42448
|
+
state,
|
|
42449
|
+
packageInfo.contents.packageJsonContent,
|
|
42450
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
42451
|
+
);
|
|
42452
|
+
return withPackageId(packageInfo, fromDirectory);
|
|
42437
42453
|
}
|
|
42438
42454
|
const loader = (extensions2, candidate2, onlyRecordFailures, state2) => {
|
|
42439
42455
|
let pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
|
|
@@ -42449,13 +42465,11 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
42449
42465
|
}
|
|
42450
42466
|
return withPackageId(packageInfo, pathAndExtension);
|
|
42451
42467
|
};
|
|
42452
|
-
const { packageName, rest } = parsePackageName(moduleName);
|
|
42453
|
-
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
42454
42468
|
if (rest !== "") {
|
|
42455
|
-
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
42469
|
+
packageInfo = rootPackageInfo != null ? rootPackageInfo : getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
42456
42470
|
}
|
|
42457
42471
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
42458
|
-
return (
|
|
42472
|
+
return (_c = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _c.value;
|
|
42459
42473
|
}
|
|
42460
42474
|
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
42461
42475
|
if (versionPaths) {
|
|
@@ -42572,7 +42586,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
42572
42586
|
conditions: [],
|
|
42573
42587
|
requestContainingDirectory: containingDirectory,
|
|
42574
42588
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
42575
|
-
isConfigLookup: false
|
|
42589
|
+
isConfigLookup: false,
|
|
42590
|
+
candidateIsFromPackageJsonField: false
|
|
42576
42591
|
};
|
|
42577
42592
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
42578
42593
|
return createResolvedModuleWithFailedLookupLocations(
|
|
@@ -42629,11 +42644,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
42629
42644
|
}
|
|
42630
42645
|
}
|
|
42631
42646
|
}
|
|
42632
|
-
function moduleResolutionSupportsResolvingTsExtensions(compilerOptions) {
|
|
42633
|
-
return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */;
|
|
42634
|
-
}
|
|
42635
42647
|
function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
|
|
42636
|
-
return
|
|
42648
|
+
return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && (!!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName));
|
|
42637
42649
|
}
|
|
42638
42650
|
function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
|
|
42639
42651
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -42654,7 +42666,8 @@ function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, hos
|
|
|
42654
42666
|
conditions: [],
|
|
42655
42667
|
requestContainingDirectory: void 0,
|
|
42656
42668
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
42657
|
-
isConfigLookup: false
|
|
42669
|
+
isConfigLookup: false,
|
|
42670
|
+
candidateIsFromPackageJsonField: false
|
|
42658
42671
|
};
|
|
42659
42672
|
const resolved = loadModuleFromImmediateNodeModulesDirectory(
|
|
42660
42673
|
4 /* Declaration */,
|
|
@@ -45719,6 +45732,7 @@ __export(ts_moduleSpecifiers_exports, {
|
|
|
45719
45732
|
getNodeModulesPackageName: () => getNodeModulesPackageName,
|
|
45720
45733
|
tryGetJSExtensionForFile: () => tryGetJSExtensionForFile,
|
|
45721
45734
|
tryGetModuleSpecifiersFromCache: () => tryGetModuleSpecifiersFromCache,
|
|
45735
|
+
tryGetRealFileNameForNonJsDeclarationFileName: () => tryGetRealFileNameForNonJsDeclarationFileName,
|
|
45722
45736
|
updateModuleSpecifier: () => updateModuleSpecifier
|
|
45723
45737
|
});
|
|
45724
45738
|
|
|
@@ -46376,6 +46390,8 @@ function processEnding(fileName, allowedEndings, options, host) {
|
|
|
46376
46390
|
}
|
|
46377
46391
|
if (fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */])) {
|
|
46378
46392
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
46393
|
+
} else if (!fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */]) && fileExtensionIsOneOf(fileName, [".ts" /* Ts */]) && stringContains(fileName, ".d.")) {
|
|
46394
|
+
return tryGetRealFileNameForNonJsDeclarationFileName(fileName);
|
|
46379
46395
|
}
|
|
46380
46396
|
switch (allowedEndings[0]) {
|
|
46381
46397
|
case 0 /* Minimal */:
|
|
@@ -46399,6 +46415,14 @@ function processEnding(fileName, allowedEndings, options, host) {
|
|
|
46399
46415
|
return Debug.assertNever(allowedEndings[0]);
|
|
46400
46416
|
}
|
|
46401
46417
|
}
|
|
46418
|
+
function tryGetRealFileNameForNonJsDeclarationFileName(fileName) {
|
|
46419
|
+
const baseName = getBaseFileName(fileName);
|
|
46420
|
+
if (!endsWith(fileName, ".ts" /* Ts */) || !stringContains(baseName, ".d.") || fileExtensionIsOneOf(baseName, [".d.ts" /* Dts */]))
|
|
46421
|
+
return void 0;
|
|
46422
|
+
const noExtension = removeExtension(fileName, ".ts" /* Ts */);
|
|
46423
|
+
const ext = noExtension.substring(noExtension.lastIndexOf("."));
|
|
46424
|
+
return noExtension.substring(0, noExtension.indexOf(".d.")) + ext;
|
|
46425
|
+
}
|
|
46402
46426
|
function getJSExtensionForFile(fileName, options) {
|
|
46403
46427
|
var _a2;
|
|
46404
46428
|
return (_a2 = tryGetJSExtensionForFile(fileName, options)) != null ? _a2 : Debug.fail(`Extension ${extensionFromPath(fileName)} is unsupported:: FileName:: ${fileName}`);
|
|
@@ -48824,7 +48848,7 @@ function createTypeChecker(host) {
|
|
|
48824
48848
|
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
48825
48849
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
48826
48850
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
48827
|
-
if (hasExportAssignmentSymbol(moduleSymbol)) {
|
|
48851
|
+
if (hasExportAssignmentSymbol(moduleSymbol) && !(getAllowSyntheticDefaultImports(compilerOptions) || getESModuleInterop(compilerOptions))) {
|
|
48828
48852
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
48829
48853
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
48830
48854
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
@@ -49619,7 +49643,7 @@ function createTypeChecker(host) {
|
|
|
49619
49643
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
49620
49644
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
49621
49645
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49622
|
-
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
49646
|
+
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
49623
49647
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
49624
49648
|
if (sourceFile) {
|
|
49625
49649
|
if (resolutionDiagnostic) {
|
|
@@ -53573,7 +53597,9 @@ function createTypeChecker(host) {
|
|
|
53573
53597
|
case 267 /* NamespaceExportDeclaration */:
|
|
53574
53598
|
addResult(factory.createNamespaceExportDeclaration(idText(node.name)), 0 /* None */);
|
|
53575
53599
|
break;
|
|
53576
|
-
case 270 /* ImportClause */:
|
|
53600
|
+
case 270 /* ImportClause */: {
|
|
53601
|
+
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
53602
|
+
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
53577
53603
|
addResult(factory.createImportDeclaration(
|
|
53578
53604
|
/*modifiers*/
|
|
53579
53605
|
void 0,
|
|
@@ -53584,15 +53610,14 @@ function createTypeChecker(host) {
|
|
|
53584
53610
|
/*namedBindings*/
|
|
53585
53611
|
void 0
|
|
53586
53612
|
),
|
|
53587
|
-
|
|
53588
|
-
|
|
53589
|
-
// In such cases, the `target` refers to the module itself already
|
|
53590
|
-
factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)),
|
|
53591
|
-
/*assertClause*/
|
|
53592
|
-
void 0
|
|
53613
|
+
specifier2,
|
|
53614
|
+
node.parent.assertClause
|
|
53593
53615
|
), 0 /* None */);
|
|
53594
53616
|
break;
|
|
53595
|
-
|
|
53617
|
+
}
|
|
53618
|
+
case 271 /* NamespaceImport */: {
|
|
53619
|
+
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
53620
|
+
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
53596
53621
|
addResult(factory.createImportDeclaration(
|
|
53597
53622
|
/*modifiers*/
|
|
53598
53623
|
void 0,
|
|
@@ -53603,11 +53628,11 @@ function createTypeChecker(host) {
|
|
|
53603
53628
|
void 0,
|
|
53604
53629
|
factory.createNamespaceImport(factory.createIdentifier(localName))
|
|
53605
53630
|
),
|
|
53606
|
-
|
|
53607
|
-
|
|
53608
|
-
void 0
|
|
53631
|
+
specifier2,
|
|
53632
|
+
node.parent.parent.assertClause
|
|
53609
53633
|
), 0 /* None */);
|
|
53610
53634
|
break;
|
|
53635
|
+
}
|
|
53611
53636
|
case 277 /* NamespaceExport */:
|
|
53612
53637
|
addResult(factory.createExportDeclaration(
|
|
53613
53638
|
/*modifiers*/
|
|
@@ -53618,7 +53643,9 @@ function createTypeChecker(host) {
|
|
|
53618
53643
|
factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))
|
|
53619
53644
|
), 0 /* None */);
|
|
53620
53645
|
break;
|
|
53621
|
-
case 273 /* ImportSpecifier */:
|
|
53646
|
+
case 273 /* ImportSpecifier */: {
|
|
53647
|
+
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
53648
|
+
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
53622
53649
|
addResult(factory.createImportDeclaration(
|
|
53623
53650
|
/*modifiers*/
|
|
53624
53651
|
void 0,
|
|
@@ -53636,11 +53663,11 @@ function createTypeChecker(host) {
|
|
|
53636
53663
|
)
|
|
53637
53664
|
])
|
|
53638
53665
|
),
|
|
53639
|
-
|
|
53640
|
-
|
|
53641
|
-
void 0
|
|
53666
|
+
specifier2,
|
|
53667
|
+
node.parent.parent.parent.assertClause
|
|
53642
53668
|
), 0 /* None */);
|
|
53643
53669
|
break;
|
|
53670
|
+
}
|
|
53644
53671
|
case 278 /* ExportSpecifier */:
|
|
53645
53672
|
const specifier = node.parent.parent.moduleSpecifier;
|
|
53646
53673
|
serializeExportSpecifier(
|
|
@@ -55610,7 +55637,17 @@ function createTypeChecker(host) {
|
|
|
55610
55637
|
}
|
|
55611
55638
|
}
|
|
55612
55639
|
function getOuterTypeParametersOfClassOrInterface(symbol) {
|
|
55613
|
-
|
|
55640
|
+
var _a2;
|
|
55641
|
+
const declaration = symbol.flags & 32 /* Class */ || symbol.flags & 16 /* Function */ ? symbol.valueDeclaration : (_a2 = symbol.declarations) == null ? void 0 : _a2.find((decl) => {
|
|
55642
|
+
if (decl.kind === 261 /* InterfaceDeclaration */) {
|
|
55643
|
+
return true;
|
|
55644
|
+
}
|
|
55645
|
+
if (decl.kind !== 257 /* VariableDeclaration */) {
|
|
55646
|
+
return false;
|
|
55647
|
+
}
|
|
55648
|
+
const initializer = decl.initializer;
|
|
55649
|
+
return !!initializer && (initializer.kind === 215 /* FunctionExpression */ || initializer.kind === 216 /* ArrowFunction */);
|
|
55650
|
+
});
|
|
55614
55651
|
Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations");
|
|
55615
55652
|
return getOuterTypeParameters(declaration);
|
|
55616
55653
|
}
|
|
@@ -66955,7 +66992,7 @@ function createTypeChecker(host) {
|
|
|
66955
66992
|
if (signature) {
|
|
66956
66993
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : void 0;
|
|
66957
66994
|
if (inference.contraCandidates) {
|
|
66958
|
-
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other
|
|
66995
|
+
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType)));
|
|
66959
66996
|
inferredType = useCovariantType ? inferredCovariantType : getContravariantInference(inference);
|
|
66960
66997
|
} else if (inferredCovariantType) {
|
|
66961
66998
|
inferredType = inferredCovariantType;
|
|
@@ -68431,12 +68468,13 @@ function createTypeChecker(host) {
|
|
|
68431
68468
|
if (propName === void 0) {
|
|
68432
68469
|
return type;
|
|
68433
68470
|
}
|
|
68434
|
-
const
|
|
68471
|
+
const optionalChain = isOptionalChain(access);
|
|
68472
|
+
const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 98304 /* Nullable */);
|
|
68435
68473
|
let propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type, propName);
|
|
68436
68474
|
if (!propType) {
|
|
68437
68475
|
return type;
|
|
68438
68476
|
}
|
|
68439
|
-
propType = removeNullable ? getOptionalType(propType) : propType;
|
|
68477
|
+
propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
|
|
68440
68478
|
const narrowedPropType = narrowType2(propType);
|
|
68441
68479
|
return filterType(type, (t) => {
|
|
68442
68480
|
const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
|
@@ -76294,7 +76332,7 @@ function createTypeChecker(host) {
|
|
|
76294
76332
|
return getRegularTypeOfObjectLiteral(rightType);
|
|
76295
76333
|
}
|
|
76296
76334
|
case 27 /* CommaToken */:
|
|
76297
|
-
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !
|
|
76335
|
+
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
|
|
76298
76336
|
const sf = getSourceFileOfNode(left);
|
|
76299
76337
|
const sourceText = sf.text;
|
|
76300
76338
|
const start2 = skipTrivia(sourceText, left.pos);
|
|
@@ -76336,8 +76374,8 @@ function createTypeChecker(host) {
|
|
|
76336
76374
|
}
|
|
76337
76375
|
}
|
|
76338
76376
|
}
|
|
76339
|
-
function
|
|
76340
|
-
return node.kind ===
|
|
76377
|
+
function isIndirectCall(node) {
|
|
76378
|
+
return node.parent.kind === 214 /* ParenthesizedExpression */ && isNumericLiteral(node.left) && node.left.text === "0" && (isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 212 /* TaggedTemplateExpression */) && (isAccessExpression(node.right) || isIdentifier(node.right) && node.right.escapedText === "eval");
|
|
76341
76379
|
}
|
|
76342
76380
|
function checkForDisallowedESSymbolOperand(operator2) {
|
|
76343
76381
|
const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
|
|
@@ -76901,15 +76939,16 @@ function createTypeChecker(host) {
|
|
|
76901
76939
|
}
|
|
76902
76940
|
}
|
|
76903
76941
|
expr = skipParentheses(node);
|
|
76942
|
+
if (isAwaitExpression(expr)) {
|
|
76943
|
+
const type = getQuickTypeOfExpression(expr.expression);
|
|
76944
|
+
return type ? getAwaitedType(type) : void 0;
|
|
76945
|
+
}
|
|
76904
76946
|
if (isCallExpression(expr) && expr.expression.kind !== 106 /* SuperKeyword */ && !isRequireCall(
|
|
76905
76947
|
expr,
|
|
76906
76948
|
/*checkArgumentIsStringLiteralLike*/
|
|
76907
76949
|
true
|
|
76908
76950
|
) && !isSymbolOrSymbolForCall(expr)) {
|
|
76909
|
-
|
|
76910
|
-
if (type) {
|
|
76911
|
-
return type;
|
|
76912
|
-
}
|
|
76951
|
+
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
|
|
76913
76952
|
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
|
|
76914
76953
|
return getTypeFromTypeNode(expr.type);
|
|
76915
76954
|
} else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
|
|
@@ -82076,12 +82115,12 @@ function createTypeChecker(host) {
|
|
|
82076
82115
|
if (node.flags & 16777216 /* Ambient */ && !isEntityNameExpression(node.expression)) {
|
|
82077
82116
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
82078
82117
|
}
|
|
82079
|
-
if (node.isExportEquals
|
|
82080
|
-
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */) {
|
|
82118
|
+
if (node.isExportEquals) {
|
|
82119
|
+
if (moduleKind >= 5 /* ES2015 */ && (node.flags & 16777216 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 16777216 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
|
|
82081
82120
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
82082
|
-
} else if (moduleKind === 4 /* System */) {
|
|
82121
|
+
} else if (moduleKind === 4 /* System */ && !(node.flags & 16777216 /* Ambient */)) {
|
|
82083
82122
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
82084
|
-
} else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
82123
|
+
} else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && !(node.flags & 16777216 /* Ambient */)) {
|
|
82085
82124
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead);
|
|
82086
82125
|
}
|
|
82087
82126
|
}
|
|
@@ -105036,6 +105075,9 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
|
105036
105075
|
case 259 /* FunctionDeclaration */:
|
|
105037
105076
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
|
|
105038
105077
|
break;
|
|
105078
|
+
case 192 /* InferType */:
|
|
105079
|
+
diagnosticMessage = Diagnostics.Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1;
|
|
105080
|
+
break;
|
|
105039
105081
|
case 262 /* TypeAliasDeclaration */:
|
|
105040
105082
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
|
|
105041
105083
|
break;
|
|
@@ -115841,7 +115883,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115841
115883
|
currentNodeModulesDepth++;
|
|
115842
115884
|
}
|
|
115843
115885
|
const elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth;
|
|
115844
|
-
const shouldAddFile = resolvedFileName && !getResolutionDiagnostic(optionsForFile, resolution) && !optionsForFile.noResolve && index < file.imports.length && !elideImport && !(isJsFile && !getAllowJSCompilerOption(optionsForFile)) && (isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608 /* JSDoc */));
|
|
115886
|
+
const shouldAddFile = resolvedFileName && !getResolutionDiagnostic(optionsForFile, resolution, file) && !optionsForFile.noResolve && index < file.imports.length && !elideImport && !(isJsFile && !getAllowJSCompilerOption(optionsForFile)) && (isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608 /* JSDoc */));
|
|
115845
115887
|
if (elideImport) {
|
|
115846
115888
|
modulesWithElidedImports.set(file.path, true);
|
|
115847
115889
|
} else if (shouldAddFile) {
|
|
@@ -116184,7 +116226,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116184
116226
|
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
|
|
116185
116227
|
createOptionValueDiagnostic("importsNotUsedAsValues", Diagnostics.Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later);
|
|
116186
116228
|
}
|
|
116187
|
-
if (options.allowImportingTsExtensions && !(
|
|
116229
|
+
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly)) {
|
|
116188
116230
|
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_moduleResolution_is_set_to_bundler_and_either_noEmit_or_emitDeclarationOnly_is_set);
|
|
116189
116231
|
}
|
|
116190
116232
|
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
@@ -116836,19 +116878,27 @@ function resolveProjectReferencePath(hostOrRef, ref) {
|
|
|
116836
116878
|
const passedInRef = ref ? ref : hostOrRef;
|
|
116837
116879
|
return resolveConfigFileProjectName(passedInRef.path);
|
|
116838
116880
|
}
|
|
116839
|
-
function getResolutionDiagnostic(options, { extension }) {
|
|
116881
|
+
function getResolutionDiagnostic(options, { extension }, { isDeclarationFile }) {
|
|
116840
116882
|
switch (extension) {
|
|
116841
116883
|
case ".ts" /* Ts */:
|
|
116842
116884
|
case ".d.ts" /* Dts */:
|
|
116885
|
+
case ".mts" /* Mts */:
|
|
116886
|
+
case ".d.mts" /* Dmts */:
|
|
116887
|
+
case ".cts" /* Cts */:
|
|
116888
|
+
case ".d.cts" /* Dcts */:
|
|
116843
116889
|
return void 0;
|
|
116844
116890
|
case ".tsx" /* Tsx */:
|
|
116845
116891
|
return needJsx();
|
|
116846
116892
|
case ".jsx" /* Jsx */:
|
|
116847
116893
|
return needJsx() || needAllowJs();
|
|
116848
116894
|
case ".js" /* Js */:
|
|
116895
|
+
case ".mjs" /* Mjs */:
|
|
116896
|
+
case ".cjs" /* Cjs */:
|
|
116849
116897
|
return needAllowJs();
|
|
116850
116898
|
case ".json" /* Json */:
|
|
116851
116899
|
return needResolveJsonModule();
|
|
116900
|
+
default:
|
|
116901
|
+
return needAllowArbitraryExtensions();
|
|
116852
116902
|
}
|
|
116853
116903
|
function needJsx() {
|
|
116854
116904
|
return options.jsx ? void 0 : Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set;
|
|
@@ -116859,6 +116909,9 @@ function getResolutionDiagnostic(options, { extension }) {
|
|
|
116859
116909
|
function needResolveJsonModule() {
|
|
116860
116910
|
return getResolveJsonModule(options) ? void 0 : Diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used;
|
|
116861
116911
|
}
|
|
116912
|
+
function needAllowArbitraryExtensions() {
|
|
116913
|
+
return isDeclarationFile || options.allowArbitraryExtensions ? void 0 : Diagnostics.Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set;
|
|
116914
|
+
}
|
|
116862
116915
|
}
|
|
116863
116916
|
function getModuleNames({ imports, moduleAugmentations }) {
|
|
116864
116917
|
const res = imports.map((i) => i);
|
|
@@ -124852,6 +124905,7 @@ __export(ts_exports3, {
|
|
|
124852
124905
|
isNonContextualKeyword: () => isNonContextualKeyword,
|
|
124853
124906
|
isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
|
|
124854
124907
|
isNonGlobalDeclaration: () => isNonGlobalDeclaration,
|
|
124908
|
+
isNonNullAccess: () => isNonNullAccess,
|
|
124855
124909
|
isNonNullChain: () => isNonNullChain,
|
|
124856
124910
|
isNonNullExpression: () => isNonNullExpression,
|
|
124857
124911
|
isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
|
|
@@ -125127,7 +125181,6 @@ __export(ts_exports3, {
|
|
|
125127
125181
|
moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
|
|
125128
125182
|
moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
|
|
125129
125183
|
moduleResolutionSupportsPackageJsonExportsAndImports: () => moduleResolutionSupportsPackageJsonExportsAndImports,
|
|
125130
|
-
moduleResolutionSupportsResolvingTsExtensions: () => moduleResolutionSupportsResolvingTsExtensions,
|
|
125131
125184
|
moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
|
|
125132
125185
|
moduleSpecifiers: () => ts_moduleSpecifiers_exports,
|
|
125133
125186
|
moveEmitHelpers: () => moveEmitHelpers,
|
|
@@ -148479,7 +148532,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
148479
148532
|
break;
|
|
148480
148533
|
case 291 /* JsxExpression */:
|
|
148481
148534
|
case 290 /* JsxSpreadAttribute */:
|
|
148482
|
-
if (previousToken.kind === 19 /* CloseBraceToken */
|
|
148535
|
+
if (previousToken.kind === 19 /* CloseBraceToken */ || (previousToken.kind === 79 /* Identifier */ || previousToken.parent.kind === 288 /* JsxAttribute */)) {
|
|
148483
148536
|
isJsxIdentifierExpected = true;
|
|
148484
148537
|
}
|
|
148485
148538
|
break;
|
|
@@ -150577,6 +150630,10 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
150577
150630
|
return result;
|
|
150578
150631
|
}
|
|
150579
150632
|
function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions) {
|
|
150633
|
+
const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
|
|
150634
|
+
if (nonJsResult) {
|
|
150635
|
+
return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
|
|
150636
|
+
}
|
|
150580
150637
|
if (extensionOptions.referenceKind === 0 /* Filename */) {
|
|
150581
150638
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
150582
150639
|
}
|
|
@@ -151498,7 +151555,7 @@ function skipExportSpecifierSymbol(symbol, checker) {
|
|
|
151498
151555
|
if (symbol.declarations) {
|
|
151499
151556
|
for (const declaration of symbol.declarations) {
|
|
151500
151557
|
if (isExportSpecifier(declaration) && !declaration.propertyName && !declaration.parent.parent.moduleSpecifier) {
|
|
151501
|
-
return checker.getExportSpecifierLocalTargetSymbol(declaration);
|
|
151558
|
+
return checker.getExportSpecifierLocalTargetSymbol(declaration) || symbol;
|
|
151502
151559
|
} else if (isPropertyAccessExpression(declaration) && isModuleExportsAccessExpression(declaration.expression) && !isPrivateIdentifier(declaration.name)) {
|
|
151503
151560
|
return checker.getSymbolAtLocation(declaration);
|
|
151504
151561
|
} else if (isShorthandPropertyAssignment(declaration) && isBinaryExpression(declaration.parent.parent) && getAssignmentDeclarationKind(declaration.parent.parent) === 2 /* ModuleExports */) {
|
|
@@ -180427,6 +180484,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
180427
180484
|
isNonContextualKeyword,
|
|
180428
180485
|
isNonGlobalAmbientModule,
|
|
180429
180486
|
isNonGlobalDeclaration,
|
|
180487
|
+
isNonNullAccess,
|
|
180430
180488
|
isNonNullChain,
|
|
180431
180489
|
isNonNullExpression,
|
|
180432
180490
|
isNonStaticMethodOrAccessorWithPrivateName,
|
|
@@ -180702,7 +180760,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
180702
180760
|
moduleResolutionNameAndModeGetter,
|
|
180703
180761
|
moduleResolutionOptionDeclarations,
|
|
180704
180762
|
moduleResolutionSupportsPackageJsonExportsAndImports,
|
|
180705
|
-
moduleResolutionSupportsResolvingTsExtensions,
|
|
180706
180763
|
moduleResolutionUsesNodeModules,
|
|
180707
180764
|
moduleSpecifiers,
|
|
180708
180765
|
moveEmitHelpers,
|