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/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.20230111`;
|
|
46
46
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
47
47
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
48
48
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -8023,6 +8023,7 @@ ${lanes.join("\n")}
|
|
|
8023
8023
|
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}'."),
|
|
8024
8024
|
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}'."),
|
|
8025
8025
|
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}."),
|
|
8026
|
+
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}'."),
|
|
8026
8027
|
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."),
|
|
8027
8028
|
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}'."),
|
|
8028
8029
|
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}'."),
|
|
@@ -8394,6 +8395,9 @@ ${lanes.join("\n")}
|
|
|
8394
8395
|
Found_1_error_in_1: diag(6259, 3 /* Message */, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
8395
8396
|
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}"),
|
|
8396
8397
|
Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
8398
|
+
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."),
|
|
8399
|
+
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."),
|
|
8400
|
+
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."),
|
|
8397
8401
|
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."),
|
|
8398
8402
|
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}'."),
|
|
8399
8403
|
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."),
|
|
@@ -15859,13 +15863,13 @@ ${lanes.join("\n")}
|
|
|
15859
15863
|
return removeFileExtension(path) + declarationExtension;
|
|
15860
15864
|
}
|
|
15861
15865
|
function getDeclarationEmitExtensionForPath(path) {
|
|
15862
|
-
return fileExtensionIsOneOf(path, [".mjs" /* Mjs */, ".mts" /* Mts */]) ? ".d.mts" /* Dmts */ : fileExtensionIsOneOf(path, [".cjs" /* Cjs */, ".cts" /* Cts */]) ? ".d.cts" /* Dcts */ : fileExtensionIsOneOf(path, [".json" /* Json */]) ? `.json.
|
|
15866
|
+
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` : (
|
|
15863
15867
|
// Drive-by redefinition of json declaration file output name so if it's ever enabled, it behaves well
|
|
15864
15868
|
".d.ts" /* Dts */
|
|
15865
15869
|
);
|
|
15866
15870
|
}
|
|
15867
15871
|
function getPossibleOriginalInputExtensionForExtension(path) {
|
|
15868
|
-
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.
|
|
15872
|
+
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 */];
|
|
15869
15873
|
}
|
|
15870
15874
|
function outFile(options) {
|
|
15871
15875
|
return options.outFile || options.out;
|
|
@@ -17872,7 +17876,7 @@ ${lanes.join("\n")}
|
|
|
17872
17876
|
return !(pos >= 0);
|
|
17873
17877
|
}
|
|
17874
17878
|
function extensionIsTS(ext) {
|
|
17875
|
-
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
|
|
17879
|
+
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");
|
|
17876
17880
|
}
|
|
17877
17881
|
function resolutionExtensionIsTSOrJson(ext) {
|
|
17878
17882
|
return extensionIsTS(ext) || ext === ".json" /* Json */;
|
|
@@ -18394,6 +18398,10 @@ ${lanes.join("\n")}
|
|
|
18394
18398
|
return false;
|
|
18395
18399
|
}
|
|
18396
18400
|
}
|
|
18401
|
+
function isNonNullAccess(node) {
|
|
18402
|
+
const kind = node.kind;
|
|
18403
|
+
return (kind === 208 /* PropertyAccessExpression */ || kind === 209 /* ElementAccessExpression */) && isNonNullExpression(node.expression);
|
|
18404
|
+
}
|
|
18397
18405
|
var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, AccessKind, objectAllocator, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
|
|
18398
18406
|
var init_utilities = __esm({
|
|
18399
18407
|
"src/compiler/utilities.ts"() {
|
|
@@ -26928,7 +26936,7 @@ ${lanes.join("\n")}
|
|
|
26928
26936
|
return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length2);
|
|
26929
26937
|
}
|
|
26930
26938
|
function isDeclarationFileName(fileName) {
|
|
26931
|
-
return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions);
|
|
26939
|
+
return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions) || fileExtensionIs(fileName, ".ts" /* Ts */) && stringContains(getBaseFileName(fileName), ".d.");
|
|
26932
26940
|
}
|
|
26933
26941
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
26934
26942
|
if (!mode) {
|
|
@@ -37298,6 +37306,14 @@ ${lanes.join("\n")}
|
|
|
37298
37306
|
description: Diagnostics.Enable_importing_json_files,
|
|
37299
37307
|
defaultValueDescription: false
|
|
37300
37308
|
},
|
|
37309
|
+
{
|
|
37310
|
+
name: "allowArbitraryExtensions",
|
|
37311
|
+
type: "boolean",
|
|
37312
|
+
affectsModuleResolution: true,
|
|
37313
|
+
category: Diagnostics.Modules,
|
|
37314
|
+
description: Diagnostics.Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present,
|
|
37315
|
+
defaultValueDescription: false
|
|
37316
|
+
},
|
|
37301
37317
|
{
|
|
37302
37318
|
name: "out",
|
|
37303
37319
|
type: "string",
|
|
@@ -38020,7 +38036,8 @@ ${lanes.join("\n")}
|
|
|
38020
38036
|
conditions,
|
|
38021
38037
|
requestContainingDirectory: containingDirectory,
|
|
38022
38038
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
38023
|
-
isConfigLookup: false
|
|
38039
|
+
isConfigLookup: false,
|
|
38040
|
+
candidateIsFromPackageJsonField: false
|
|
38024
38041
|
};
|
|
38025
38042
|
let resolved = primaryLookup();
|
|
38026
38043
|
let primary = true;
|
|
@@ -38878,7 +38895,8 @@ ${lanes.join("\n")}
|
|
|
38878
38895
|
conditions,
|
|
38879
38896
|
requestContainingDirectory: containingDirectory,
|
|
38880
38897
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
38881
|
-
isConfigLookup
|
|
38898
|
+
isConfigLookup,
|
|
38899
|
+
candidateIsFromPackageJsonField: false
|
|
38882
38900
|
};
|
|
38883
38901
|
if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
|
|
38884
38902
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
@@ -39045,14 +39063,19 @@ ${lanes.join("\n")}
|
|
|
39045
39063
|
}
|
|
39046
39064
|
}
|
|
39047
39065
|
function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
|
|
39048
|
-
|
|
39049
|
-
|
|
39050
|
-
|
|
39051
|
-
if (state.traceEnabled) {
|
|
39052
|
-
trace(state.host, Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
|
|
39053
|
-
}
|
|
39054
|
-
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
39066
|
+
const filename = getBaseFileName(candidate);
|
|
39067
|
+
if (filename.indexOf(".") === -1) {
|
|
39068
|
+
return void 0;
|
|
39055
39069
|
}
|
|
39070
|
+
let extensionless = removeFileExtension(candidate);
|
|
39071
|
+
if (extensionless === candidate) {
|
|
39072
|
+
extensionless = candidate.substring(0, candidate.lastIndexOf("."));
|
|
39073
|
+
}
|
|
39074
|
+
const extension = candidate.substring(extensionless.length);
|
|
39075
|
+
if (state.traceEnabled) {
|
|
39076
|
+
trace(state.host, Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
|
|
39077
|
+
}
|
|
39078
|
+
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
39056
39079
|
}
|
|
39057
39080
|
function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
|
|
39058
39081
|
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
@@ -39076,42 +39099,27 @@ ${lanes.join("\n")}
|
|
|
39076
39099
|
case ".mjs" /* Mjs */:
|
|
39077
39100
|
case ".mts" /* Mts */:
|
|
39078
39101
|
case ".d.mts" /* Dmts */:
|
|
39079
|
-
return extensions & 1 /* TypeScript */ && tryExtension(".mts" /* Mts */) || extensions & 4 /* Declaration */ && tryExtension(".d.mts" /* Dmts */) || extensions & 2 /* JavaScript */ && tryExtension(".mjs" /* Mjs */) || void 0;
|
|
39102
|
+
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;
|
|
39080
39103
|
case ".cjs" /* Cjs */:
|
|
39081
39104
|
case ".cts" /* Cts */:
|
|
39082
39105
|
case ".d.cts" /* Dcts */:
|
|
39083
|
-
return extensions & 1 /* TypeScript */ && tryExtension(".cts" /* Cts */) || extensions & 4 /* Declaration */ && tryExtension(".d.cts" /* Dcts */) || extensions & 2 /* JavaScript */ && tryExtension(".cjs" /* Cjs */) || void 0;
|
|
39106
|
+
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;
|
|
39084
39107
|
case ".json" /* Json */:
|
|
39085
|
-
|
|
39086
|
-
if (extensions & 4 /* Declaration */) {
|
|
39087
|
-
candidate += ".json" /* Json */;
|
|
39088
|
-
const result = tryExtension(".d.ts" /* Dts */);
|
|
39089
|
-
if (result)
|
|
39090
|
-
return result;
|
|
39091
|
-
}
|
|
39092
|
-
if (extensions & 8 /* Json */) {
|
|
39093
|
-
candidate = originalCandidate;
|
|
39094
|
-
const result = tryExtension(".json" /* Json */);
|
|
39095
|
-
if (result)
|
|
39096
|
-
return result;
|
|
39097
|
-
}
|
|
39098
|
-
return void 0;
|
|
39099
|
-
case ".ts" /* Ts */:
|
|
39108
|
+
return extensions & 4 /* Declaration */ && tryExtension(".d.json.ts") || extensions & 8 /* Json */ && tryExtension(".json" /* Json */) || void 0;
|
|
39100
39109
|
case ".tsx" /* Tsx */:
|
|
39110
|
+
case ".jsx" /* Jsx */:
|
|
39111
|
+
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;
|
|
39112
|
+
case ".ts" /* Ts */:
|
|
39101
39113
|
case ".d.ts" /* Dts */:
|
|
39102
|
-
|
|
39103
|
-
|
|
39104
|
-
|
|
39105
|
-
/*resolvedUsingTsExtension*/
|
|
39106
|
-
true
|
|
39107
|
-
);
|
|
39108
|
-
}
|
|
39114
|
+
case ".js" /* Js */:
|
|
39115
|
+
case "":
|
|
39116
|
+
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;
|
|
39109
39117
|
default:
|
|
39110
|
-
return extensions &
|
|
39118
|
+
return extensions & 4 /* Declaration */ && !isDeclarationFileName(candidate + originalExtension) && tryExtension(`.d${originalExtension}.ts`) || void 0;
|
|
39111
39119
|
}
|
|
39112
39120
|
function tryExtension(ext, resolvedUsingTsExtension) {
|
|
39113
39121
|
const path = tryFile(candidate + ext, onlyRecordFailures, state);
|
|
39114
|
-
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension };
|
|
39122
|
+
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension: !state.candidateIsFromPackageJsonField && resolvedUsingTsExtension };
|
|
39115
39123
|
}
|
|
39116
39124
|
}
|
|
39117
39125
|
function tryFile(fileName, onlyRecordFailures, state) {
|
|
@@ -39258,7 +39266,8 @@ ${lanes.join("\n")}
|
|
|
39258
39266
|
conditions: emptyArray,
|
|
39259
39267
|
requestContainingDirectory: void 0,
|
|
39260
39268
|
reportDiagnostic: noop,
|
|
39261
|
-
isConfigLookup: false
|
|
39269
|
+
isConfigLookup: false,
|
|
39270
|
+
candidateIsFromPackageJsonField: false
|
|
39262
39271
|
};
|
|
39263
39272
|
}
|
|
39264
39273
|
function getPackageScopeForPath(fileName, state) {
|
|
@@ -39346,6 +39355,8 @@ ${lanes.join("\n")}
|
|
|
39346
39355
|
}
|
|
39347
39356
|
const expandedExtensions = extensions2 === 4 /* Declaration */ ? 1 /* TypeScript */ | 4 /* Declaration */ : extensions2;
|
|
39348
39357
|
const features = state2.features;
|
|
39358
|
+
const candidateIsFromPackageJsonField = state2.candidateIsFromPackageJsonField;
|
|
39359
|
+
state2.candidateIsFromPackageJsonField = true;
|
|
39349
39360
|
if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
|
|
39350
39361
|
state2.features &= ~32 /* EsmMode */;
|
|
39351
39362
|
}
|
|
@@ -39358,6 +39369,7 @@ ${lanes.join("\n")}
|
|
|
39358
39369
|
false
|
|
39359
39370
|
);
|
|
39360
39371
|
state2.features = features;
|
|
39372
|
+
state2.candidateIsFromPackageJsonField = candidateIsFromPackageJsonField;
|
|
39361
39373
|
return result;
|
|
39362
39374
|
};
|
|
39363
39375
|
const onlyRecordFailuresForPackageFile = packageFile ? !directoryProbablyExists(getDirectoryPath(packageFile), state.host) : void 0;
|
|
@@ -39431,7 +39443,10 @@ ${lanes.join("\n")}
|
|
|
39431
39443
|
return void 0;
|
|
39432
39444
|
}
|
|
39433
39445
|
const trailingParts = parts.slice(nameParts.length);
|
|
39434
|
-
|
|
39446
|
+
const subpath = !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`;
|
|
39447
|
+
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
39448
|
+
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
39449
|
+
return loadModuleFromExports(scope, priorityExtensions, subpath, state, cache, redirectedReference) || loadModuleFromExports(scope, secondaryExtensions, subpath, state, cache, redirectedReference);
|
|
39435
39450
|
}
|
|
39436
39451
|
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
39437
39452
|
if (!scope.contents.packageJsonContent.exports) {
|
|
@@ -39933,25 +39948,26 @@ ${lanes.join("\n")}
|
|
|
39933
39948
|
}
|
|
39934
39949
|
}
|
|
39935
39950
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
39936
|
-
var _a2;
|
|
39951
|
+
var _a2, _b, _c;
|
|
39937
39952
|
const candidate = normalizePath(combinePaths(nodeModulesDirectory, moduleName));
|
|
39953
|
+
const { packageName, rest } = parsePackageName(moduleName);
|
|
39954
|
+
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
39955
|
+
let rootPackageInfo;
|
|
39938
39956
|
let packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
39939
|
-
if (!(state.features & 8 /* Exports */)) {
|
|
39940
|
-
|
|
39941
|
-
|
|
39942
|
-
|
|
39943
|
-
return noPackageId(fromFile);
|
|
39944
|
-
}
|
|
39945
|
-
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
39946
|
-
extensions,
|
|
39947
|
-
candidate,
|
|
39948
|
-
!nodeModulesDirectoryExists,
|
|
39949
|
-
state,
|
|
39950
|
-
packageInfo.contents.packageJsonContent,
|
|
39951
|
-
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
39952
|
-
);
|
|
39953
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
39957
|
+
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"))) {
|
|
39958
|
+
const fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
39959
|
+
if (fromFile) {
|
|
39960
|
+
return noPackageId(fromFile);
|
|
39954
39961
|
}
|
|
39962
|
+
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
39963
|
+
extensions,
|
|
39964
|
+
candidate,
|
|
39965
|
+
!nodeModulesDirectoryExists,
|
|
39966
|
+
state,
|
|
39967
|
+
packageInfo.contents.packageJsonContent,
|
|
39968
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
39969
|
+
);
|
|
39970
|
+
return withPackageId(packageInfo, fromDirectory);
|
|
39955
39971
|
}
|
|
39956
39972
|
const loader = (extensions2, candidate2, onlyRecordFailures, state2) => {
|
|
39957
39973
|
let pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
|
|
@@ -39967,13 +39983,11 @@ ${lanes.join("\n")}
|
|
|
39967
39983
|
}
|
|
39968
39984
|
return withPackageId(packageInfo, pathAndExtension);
|
|
39969
39985
|
};
|
|
39970
|
-
const { packageName, rest } = parsePackageName(moduleName);
|
|
39971
|
-
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
39972
39986
|
if (rest !== "") {
|
|
39973
|
-
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
39987
|
+
packageInfo = rootPackageInfo != null ? rootPackageInfo : getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
39974
39988
|
}
|
|
39975
39989
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
39976
|
-
return (
|
|
39990
|
+
return (_c = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _c.value;
|
|
39977
39991
|
}
|
|
39978
39992
|
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
39979
39993
|
if (versionPaths) {
|
|
@@ -40089,7 +40103,8 @@ ${lanes.join("\n")}
|
|
|
40089
40103
|
conditions: [],
|
|
40090
40104
|
requestContainingDirectory: containingDirectory,
|
|
40091
40105
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
40092
|
-
isConfigLookup: false
|
|
40106
|
+
isConfigLookup: false,
|
|
40107
|
+
candidateIsFromPackageJsonField: false
|
|
40093
40108
|
};
|
|
40094
40109
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
40095
40110
|
return createResolvedModuleWithFailedLookupLocations(
|
|
@@ -40146,11 +40161,8 @@ ${lanes.join("\n")}
|
|
|
40146
40161
|
}
|
|
40147
40162
|
}
|
|
40148
40163
|
}
|
|
40149
|
-
function moduleResolutionSupportsResolvingTsExtensions(compilerOptions) {
|
|
40150
|
-
return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */;
|
|
40151
|
-
}
|
|
40152
40164
|
function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
|
|
40153
|
-
return
|
|
40165
|
+
return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && (!!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName));
|
|
40154
40166
|
}
|
|
40155
40167
|
function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
|
|
40156
40168
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -40171,7 +40183,8 @@ ${lanes.join("\n")}
|
|
|
40171
40183
|
conditions: [],
|
|
40172
40184
|
requestContainingDirectory: void 0,
|
|
40173
40185
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
40174
|
-
isConfigLookup: false
|
|
40186
|
+
isConfigLookup: false,
|
|
40187
|
+
candidateIsFromPackageJsonField: false
|
|
40175
40188
|
};
|
|
40176
40189
|
const resolved = loadModuleFromImmediateNodeModulesDirectory(
|
|
40177
40190
|
4 /* Declaration */,
|
|
@@ -43916,6 +43929,8 @@ ${lanes.join("\n")}
|
|
|
43916
43929
|
}
|
|
43917
43930
|
if (fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */])) {
|
|
43918
43931
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
43932
|
+
} else if (!fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */]) && fileExtensionIsOneOf(fileName, [".ts" /* Ts */]) && stringContains(fileName, ".d.")) {
|
|
43933
|
+
return tryGetRealFileNameForNonJsDeclarationFileName(fileName);
|
|
43919
43934
|
}
|
|
43920
43935
|
switch (allowedEndings[0]) {
|
|
43921
43936
|
case 0 /* Minimal */:
|
|
@@ -43939,6 +43954,14 @@ ${lanes.join("\n")}
|
|
|
43939
43954
|
return Debug.assertNever(allowedEndings[0]);
|
|
43940
43955
|
}
|
|
43941
43956
|
}
|
|
43957
|
+
function tryGetRealFileNameForNonJsDeclarationFileName(fileName) {
|
|
43958
|
+
const baseName = getBaseFileName(fileName);
|
|
43959
|
+
if (!endsWith(fileName, ".ts" /* Ts */) || !stringContains(baseName, ".d.") || fileExtensionIsOneOf(baseName, [".d.ts" /* Dts */]))
|
|
43960
|
+
return void 0;
|
|
43961
|
+
const noExtension = removeExtension(fileName, ".ts" /* Ts */);
|
|
43962
|
+
const ext = noExtension.substring(noExtension.lastIndexOf("."));
|
|
43963
|
+
return noExtension.substring(0, noExtension.indexOf(".d.")) + ext;
|
|
43964
|
+
}
|
|
43942
43965
|
function getJSExtensionForFile(fileName, options) {
|
|
43943
43966
|
var _a2;
|
|
43944
43967
|
return (_a2 = tryGetJSExtensionForFile(fileName, options)) != null ? _a2 : Debug.fail(`Extension ${extensionFromPath(fileName)} is unsupported:: FileName:: ${fileName}`);
|
|
@@ -43999,6 +44022,7 @@ ${lanes.join("\n")}
|
|
|
43999
44022
|
getNodeModulesPackageName: () => getNodeModulesPackageName,
|
|
44000
44023
|
tryGetJSExtensionForFile: () => tryGetJSExtensionForFile,
|
|
44001
44024
|
tryGetModuleSpecifiersFromCache: () => tryGetModuleSpecifiersFromCache,
|
|
44025
|
+
tryGetRealFileNameForNonJsDeclarationFileName: () => tryGetRealFileNameForNonJsDeclarationFileName,
|
|
44002
44026
|
updateModuleSpecifier: () => updateModuleSpecifier
|
|
44003
44027
|
});
|
|
44004
44028
|
var init_ts_moduleSpecifiers = __esm({
|
|
@@ -46266,7 +46290,7 @@ ${lanes.join("\n")}
|
|
|
46266
46290
|
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
46267
46291
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
46268
46292
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
46269
|
-
if (hasExportAssignmentSymbol(moduleSymbol)) {
|
|
46293
|
+
if (hasExportAssignmentSymbol(moduleSymbol) && !(getAllowSyntheticDefaultImports(compilerOptions) || getESModuleInterop(compilerOptions))) {
|
|
46270
46294
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
46271
46295
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
46272
46296
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
@@ -47061,7 +47085,7 @@ ${lanes.join("\n")}
|
|
|
47061
47085
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
47062
47086
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
47063
47087
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
47064
|
-
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
47088
|
+
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
47065
47089
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
47066
47090
|
if (sourceFile) {
|
|
47067
47091
|
if (resolutionDiagnostic) {
|
|
@@ -51015,7 +51039,9 @@ ${lanes.join("\n")}
|
|
|
51015
51039
|
case 267 /* NamespaceExportDeclaration */:
|
|
51016
51040
|
addResult(factory.createNamespaceExportDeclaration(idText(node.name)), 0 /* None */);
|
|
51017
51041
|
break;
|
|
51018
|
-
case 270 /* ImportClause */:
|
|
51042
|
+
case 270 /* ImportClause */: {
|
|
51043
|
+
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51044
|
+
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
51019
51045
|
addResult(factory.createImportDeclaration(
|
|
51020
51046
|
/*modifiers*/
|
|
51021
51047
|
void 0,
|
|
@@ -51026,15 +51052,14 @@ ${lanes.join("\n")}
|
|
|
51026
51052
|
/*namedBindings*/
|
|
51027
51053
|
void 0
|
|
51028
51054
|
),
|
|
51029
|
-
|
|
51030
|
-
|
|
51031
|
-
// In such cases, the `target` refers to the module itself already
|
|
51032
|
-
factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)),
|
|
51033
|
-
/*assertClause*/
|
|
51034
|
-
void 0
|
|
51055
|
+
specifier2,
|
|
51056
|
+
node.parent.assertClause
|
|
51035
51057
|
), 0 /* None */);
|
|
51036
51058
|
break;
|
|
51037
|
-
|
|
51059
|
+
}
|
|
51060
|
+
case 271 /* NamespaceImport */: {
|
|
51061
|
+
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51062
|
+
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
51038
51063
|
addResult(factory.createImportDeclaration(
|
|
51039
51064
|
/*modifiers*/
|
|
51040
51065
|
void 0,
|
|
@@ -51045,11 +51070,11 @@ ${lanes.join("\n")}
|
|
|
51045
51070
|
void 0,
|
|
51046
51071
|
factory.createNamespaceImport(factory.createIdentifier(localName))
|
|
51047
51072
|
),
|
|
51048
|
-
|
|
51049
|
-
|
|
51050
|
-
void 0
|
|
51073
|
+
specifier2,
|
|
51074
|
+
node.parent.parent.assertClause
|
|
51051
51075
|
), 0 /* None */);
|
|
51052
51076
|
break;
|
|
51077
|
+
}
|
|
51053
51078
|
case 277 /* NamespaceExport */:
|
|
51054
51079
|
addResult(factory.createExportDeclaration(
|
|
51055
51080
|
/*modifiers*/
|
|
@@ -51060,7 +51085,9 @@ ${lanes.join("\n")}
|
|
|
51060
51085
|
factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))
|
|
51061
51086
|
), 0 /* None */);
|
|
51062
51087
|
break;
|
|
51063
|
-
case 273 /* ImportSpecifier */:
|
|
51088
|
+
case 273 /* ImportSpecifier */: {
|
|
51089
|
+
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51090
|
+
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
51064
51091
|
addResult(factory.createImportDeclaration(
|
|
51065
51092
|
/*modifiers*/
|
|
51066
51093
|
void 0,
|
|
@@ -51078,11 +51105,11 @@ ${lanes.join("\n")}
|
|
|
51078
51105
|
)
|
|
51079
51106
|
])
|
|
51080
51107
|
),
|
|
51081
|
-
|
|
51082
|
-
|
|
51083
|
-
void 0
|
|
51108
|
+
specifier2,
|
|
51109
|
+
node.parent.parent.parent.assertClause
|
|
51084
51110
|
), 0 /* None */);
|
|
51085
51111
|
break;
|
|
51112
|
+
}
|
|
51086
51113
|
case 278 /* ExportSpecifier */:
|
|
51087
51114
|
const specifier = node.parent.parent.moduleSpecifier;
|
|
51088
51115
|
serializeExportSpecifier(
|
|
@@ -53052,7 +53079,17 @@ ${lanes.join("\n")}
|
|
|
53052
53079
|
}
|
|
53053
53080
|
}
|
|
53054
53081
|
function getOuterTypeParametersOfClassOrInterface(symbol) {
|
|
53055
|
-
|
|
53082
|
+
var _a2;
|
|
53083
|
+
const declaration = symbol.flags & 32 /* Class */ || symbol.flags & 16 /* Function */ ? symbol.valueDeclaration : (_a2 = symbol.declarations) == null ? void 0 : _a2.find((decl) => {
|
|
53084
|
+
if (decl.kind === 261 /* InterfaceDeclaration */) {
|
|
53085
|
+
return true;
|
|
53086
|
+
}
|
|
53087
|
+
if (decl.kind !== 257 /* VariableDeclaration */) {
|
|
53088
|
+
return false;
|
|
53089
|
+
}
|
|
53090
|
+
const initializer = decl.initializer;
|
|
53091
|
+
return !!initializer && (initializer.kind === 215 /* FunctionExpression */ || initializer.kind === 216 /* ArrowFunction */);
|
|
53092
|
+
});
|
|
53056
53093
|
Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations");
|
|
53057
53094
|
return getOuterTypeParameters(declaration);
|
|
53058
53095
|
}
|
|
@@ -64397,7 +64434,7 @@ ${lanes.join("\n")}
|
|
|
64397
64434
|
if (signature) {
|
|
64398
64435
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : void 0;
|
|
64399
64436
|
if (inference.contraCandidates) {
|
|
64400
|
-
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other
|
|
64437
|
+
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)));
|
|
64401
64438
|
inferredType = useCovariantType ? inferredCovariantType : getContravariantInference(inference);
|
|
64402
64439
|
} else if (inferredCovariantType) {
|
|
64403
64440
|
inferredType = inferredCovariantType;
|
|
@@ -65873,12 +65910,13 @@ ${lanes.join("\n")}
|
|
|
65873
65910
|
if (propName === void 0) {
|
|
65874
65911
|
return type;
|
|
65875
65912
|
}
|
|
65876
|
-
const
|
|
65913
|
+
const optionalChain = isOptionalChain(access);
|
|
65914
|
+
const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 98304 /* Nullable */);
|
|
65877
65915
|
let propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type, propName);
|
|
65878
65916
|
if (!propType) {
|
|
65879
65917
|
return type;
|
|
65880
65918
|
}
|
|
65881
|
-
propType = removeNullable ? getOptionalType(propType) : propType;
|
|
65919
|
+
propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
|
|
65882
65920
|
const narrowedPropType = narrowType2(propType);
|
|
65883
65921
|
return filterType(type, (t) => {
|
|
65884
65922
|
const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
|
@@ -73736,7 +73774,7 @@ ${lanes.join("\n")}
|
|
|
73736
73774
|
return getRegularTypeOfObjectLiteral(rightType);
|
|
73737
73775
|
}
|
|
73738
73776
|
case 27 /* CommaToken */:
|
|
73739
|
-
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !
|
|
73777
|
+
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
|
|
73740
73778
|
const sf = getSourceFileOfNode(left);
|
|
73741
73779
|
const sourceText = sf.text;
|
|
73742
73780
|
const start = skipTrivia(sourceText, left.pos);
|
|
@@ -73778,8 +73816,8 @@ ${lanes.join("\n")}
|
|
|
73778
73816
|
}
|
|
73779
73817
|
}
|
|
73780
73818
|
}
|
|
73781
|
-
function
|
|
73782
|
-
return node.kind ===
|
|
73819
|
+
function isIndirectCall(node) {
|
|
73820
|
+
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");
|
|
73783
73821
|
}
|
|
73784
73822
|
function checkForDisallowedESSymbolOperand(operator2) {
|
|
73785
73823
|
const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
|
|
@@ -74343,15 +74381,16 @@ ${lanes.join("\n")}
|
|
|
74343
74381
|
}
|
|
74344
74382
|
}
|
|
74345
74383
|
expr = skipParentheses(node);
|
|
74384
|
+
if (isAwaitExpression(expr)) {
|
|
74385
|
+
const type = getQuickTypeOfExpression(expr.expression);
|
|
74386
|
+
return type ? getAwaitedType(type) : void 0;
|
|
74387
|
+
}
|
|
74346
74388
|
if (isCallExpression(expr) && expr.expression.kind !== 106 /* SuperKeyword */ && !isRequireCall(
|
|
74347
74389
|
expr,
|
|
74348
74390
|
/*checkArgumentIsStringLiteralLike*/
|
|
74349
74391
|
true
|
|
74350
74392
|
) && !isSymbolOrSymbolForCall(expr)) {
|
|
74351
|
-
|
|
74352
|
-
if (type) {
|
|
74353
|
-
return type;
|
|
74354
|
-
}
|
|
74393
|
+
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
|
|
74355
74394
|
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
|
|
74356
74395
|
return getTypeFromTypeNode(expr.type);
|
|
74357
74396
|
} else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
|
|
@@ -79518,12 +79557,12 @@ ${lanes.join("\n")}
|
|
|
79518
79557
|
if (node.flags & 16777216 /* Ambient */ && !isEntityNameExpression(node.expression)) {
|
|
79519
79558
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
79520
79559
|
}
|
|
79521
|
-
if (node.isExportEquals
|
|
79522
|
-
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */) {
|
|
79560
|
+
if (node.isExportEquals) {
|
|
79561
|
+
if (moduleKind >= 5 /* ES2015 */ && (node.flags & 16777216 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 16777216 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
|
|
79523
79562
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
79524
|
-
} else if (moduleKind === 4 /* System */) {
|
|
79563
|
+
} else if (moduleKind === 4 /* System */ && !(node.flags & 16777216 /* Ambient */)) {
|
|
79525
79564
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
79526
|
-
} else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
79565
|
+
} else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && !(node.flags & 16777216 /* Ambient */)) {
|
|
79527
79566
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead);
|
|
79528
79567
|
}
|
|
79529
79568
|
}
|
|
@@ -102764,6 +102803,9 @@ ${lanes.join("\n")}
|
|
|
102764
102803
|
case 259 /* FunctionDeclaration */:
|
|
102765
102804
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
|
|
102766
102805
|
break;
|
|
102806
|
+
case 192 /* InferType */:
|
|
102807
|
+
diagnosticMessage = Diagnostics.Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1;
|
|
102808
|
+
break;
|
|
102767
102809
|
case 262 /* TypeAliasDeclaration */:
|
|
102768
102810
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
|
|
102769
102811
|
break;
|
|
@@ -113486,7 +113528,7 @@ ${lanes.join("\n")}
|
|
|
113486
113528
|
currentNodeModulesDepth++;
|
|
113487
113529
|
}
|
|
113488
113530
|
const elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth;
|
|
113489
|
-
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 */));
|
|
113531
|
+
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 */));
|
|
113490
113532
|
if (elideImport) {
|
|
113491
113533
|
modulesWithElidedImports.set(file.path, true);
|
|
113492
113534
|
} else if (shouldAddFile) {
|
|
@@ -113829,7 +113871,7 @@ ${lanes.join("\n")}
|
|
|
113829
113871
|
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
|
|
113830
113872
|
createOptionValueDiagnostic("importsNotUsedAsValues", Diagnostics.Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later);
|
|
113831
113873
|
}
|
|
113832
|
-
if (options.allowImportingTsExtensions && !(
|
|
113874
|
+
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly)) {
|
|
113833
113875
|
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_moduleResolution_is_set_to_bundler_and_either_noEmit_or_emitDeclarationOnly_is_set);
|
|
113834
113876
|
}
|
|
113835
113877
|
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
@@ -114480,19 +114522,27 @@ ${lanes.join("\n")}
|
|
|
114480
114522
|
const passedInRef = ref ? ref : hostOrRef;
|
|
114481
114523
|
return resolveConfigFileProjectName(passedInRef.path);
|
|
114482
114524
|
}
|
|
114483
|
-
function getResolutionDiagnostic(options, { extension }) {
|
|
114525
|
+
function getResolutionDiagnostic(options, { extension }, { isDeclarationFile }) {
|
|
114484
114526
|
switch (extension) {
|
|
114485
114527
|
case ".ts" /* Ts */:
|
|
114486
114528
|
case ".d.ts" /* Dts */:
|
|
114529
|
+
case ".mts" /* Mts */:
|
|
114530
|
+
case ".d.mts" /* Dmts */:
|
|
114531
|
+
case ".cts" /* Cts */:
|
|
114532
|
+
case ".d.cts" /* Dcts */:
|
|
114487
114533
|
return void 0;
|
|
114488
114534
|
case ".tsx" /* Tsx */:
|
|
114489
114535
|
return needJsx();
|
|
114490
114536
|
case ".jsx" /* Jsx */:
|
|
114491
114537
|
return needJsx() || needAllowJs();
|
|
114492
114538
|
case ".js" /* Js */:
|
|
114539
|
+
case ".mjs" /* Mjs */:
|
|
114540
|
+
case ".cjs" /* Cjs */:
|
|
114493
114541
|
return needAllowJs();
|
|
114494
114542
|
case ".json" /* Json */:
|
|
114495
114543
|
return needResolveJsonModule();
|
|
114544
|
+
default:
|
|
114545
|
+
return needAllowArbitraryExtensions();
|
|
114496
114546
|
}
|
|
114497
114547
|
function needJsx() {
|
|
114498
114548
|
return options.jsx ? void 0 : Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set;
|
|
@@ -114503,6 +114553,9 @@ ${lanes.join("\n")}
|
|
|
114503
114553
|
function needResolveJsonModule() {
|
|
114504
114554
|
return getResolveJsonModule(options) ? void 0 : Diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used;
|
|
114505
114555
|
}
|
|
114556
|
+
function needAllowArbitraryExtensions() {
|
|
114557
|
+
return isDeclarationFile || options.allowArbitraryExtensions ? void 0 : Diagnostics.Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set;
|
|
114558
|
+
}
|
|
114506
114559
|
}
|
|
114507
114560
|
function getModuleNames({ imports, moduleAugmentations }) {
|
|
114508
114561
|
const res = imports.map((i) => i);
|
|
@@ -144542,7 +144595,7 @@ ${lanes.join("\n")}
|
|
|
144542
144595
|
break;
|
|
144543
144596
|
case 291 /* JsxExpression */:
|
|
144544
144597
|
case 290 /* JsxSpreadAttribute */:
|
|
144545
|
-
if (previousToken.kind === 19 /* CloseBraceToken */
|
|
144598
|
+
if (previousToken.kind === 19 /* CloseBraceToken */ || (previousToken.kind === 79 /* Identifier */ || previousToken.parent.kind === 288 /* JsxAttribute */)) {
|
|
144546
144599
|
isJsxIdentifierExpected = true;
|
|
144547
144600
|
}
|
|
144548
144601
|
break;
|
|
@@ -146688,6 +146741,10 @@ ${lanes.join("\n")}
|
|
|
146688
146741
|
return result;
|
|
146689
146742
|
}
|
|
146690
146743
|
function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions) {
|
|
146744
|
+
const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
|
|
146745
|
+
if (nonJsResult) {
|
|
146746
|
+
return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
|
|
146747
|
+
}
|
|
146691
146748
|
if (extensionOptions.referenceKind === 0 /* Filename */) {
|
|
146692
146749
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
146693
146750
|
}
|
|
@@ -147633,7 +147690,7 @@ ${lanes.join("\n")}
|
|
|
147633
147690
|
if (symbol.declarations) {
|
|
147634
147691
|
for (const declaration of symbol.declarations) {
|
|
147635
147692
|
if (isExportSpecifier(declaration) && !declaration.propertyName && !declaration.parent.parent.moduleSpecifier) {
|
|
147636
|
-
return checker.getExportSpecifierLocalTargetSymbol(declaration);
|
|
147693
|
+
return checker.getExportSpecifierLocalTargetSymbol(declaration) || symbol;
|
|
147637
147694
|
} else if (isPropertyAccessExpression(declaration) && isModuleExportsAccessExpression(declaration.expression) && !isPrivateIdentifier(declaration.name)) {
|
|
147638
147695
|
return checker.getSymbolAtLocation(declaration);
|
|
147639
147696
|
} else if (isShorthandPropertyAssignment(declaration) && isBinaryExpression(declaration.parent.parent) && getAssignmentDeclarationKind(declaration.parent.parent) === 2 /* ModuleExports */) {
|
|
@@ -165723,6 +165780,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
165723
165780
|
isNonContextualKeyword: () => isNonContextualKeyword,
|
|
165724
165781
|
isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
|
|
165725
165782
|
isNonGlobalDeclaration: () => isNonGlobalDeclaration,
|
|
165783
|
+
isNonNullAccess: () => isNonNullAccess,
|
|
165726
165784
|
isNonNullChain: () => isNonNullChain,
|
|
165727
165785
|
isNonNullExpression: () => isNonNullExpression,
|
|
165728
165786
|
isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
|
|
@@ -165998,7 +166056,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
165998
166056
|
moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
|
|
165999
166057
|
moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
|
|
166000
166058
|
moduleResolutionSupportsPackageJsonExportsAndImports: () => moduleResolutionSupportsPackageJsonExportsAndImports,
|
|
166001
|
-
moduleResolutionSupportsResolvingTsExtensions: () => moduleResolutionSupportsResolvingTsExtensions,
|
|
166002
166059
|
moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
|
|
166003
166060
|
moduleSpecifiers: () => ts_moduleSpecifiers_exports,
|
|
166004
166061
|
moveEmitHelpers: () => moveEmitHelpers,
|