typescript 5.1.0-dev.20230227 → 5.1.0-dev.20230302
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/README.md +2 -0
- package/lib/lib.es2015.collection.d.ts +1 -1
- package/lib/tsc.js +216 -152
- package/lib/tsserver.js +960 -697
- package/lib/tsserverlibrary.d.ts +7 -44
- package/lib/tsserverlibrary.js +1019 -745
- package/lib/typescript.d.ts +5 -10
- package/lib/typescript.js +897 -634
- package/lib/typingsInstaller.js +50 -14
- package/package.json +14 -14
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.1";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20230302`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -842,9 +842,6 @@ function multiMapRemove(key, value) {
|
|
|
842
842
|
}
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
|
-
function createUnderscoreEscapedMultiMap() {
|
|
846
|
-
return createMultiMap();
|
|
847
|
-
}
|
|
848
845
|
function createQueue(items) {
|
|
849
846
|
const elements = (items == null ? void 0 : items.slice()) || [];
|
|
850
847
|
let headIndex = 0;
|
|
@@ -902,10 +899,6 @@ function cast(value, test) {
|
|
|
902
899
|
}
|
|
903
900
|
function noop(_) {
|
|
904
901
|
}
|
|
905
|
-
var noopPush = {
|
|
906
|
-
push: noop,
|
|
907
|
-
length: 0
|
|
908
|
-
};
|
|
909
902
|
function returnFalse() {
|
|
910
903
|
return false;
|
|
911
904
|
}
|
|
@@ -7175,6 +7168,7 @@ var Diagnostics = {
|
|
|
7175
7168
|
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."),
|
|
7176
7169
|
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."),
|
|
7177
7170
|
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."),
|
|
7171
|
+
Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder: diag(6265, 3 /* Message */, "Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_no_6265", "Resolving type reference directive for program that specifies custom typeRoots, skipping lookup in 'node_modules' folder."),
|
|
7178
7172
|
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."),
|
|
7179
7173
|
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}'."),
|
|
7180
7174
|
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."),
|
|
@@ -7570,6 +7564,8 @@ var Diagnostics = {
|
|
|
7570
7564
|
This_may_be_converted_to_an_async_function: diag(80006, 2 /* Suggestion */, "This_may_be_converted_to_an_async_function_80006", "This may be converted to an async function."),
|
|
7571
7565
|
await_has_no_effect_on_the_type_of_this_expression: diag(80007, 2 /* Suggestion */, "await_has_no_effect_on_the_type_of_this_expression_80007", "'await' has no effect on the type of this expression."),
|
|
7572
7566
|
Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers: diag(80008, 2 /* Suggestion */, "Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accur_80008", "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers."),
|
|
7567
|
+
JSDoc_typedef_may_be_converted_to_TypeScript_type: diag(80009, 2 /* Suggestion */, "JSDoc_typedef_may_be_converted_to_TypeScript_type_80009", "JSDoc typedef may be converted to TypeScript type."),
|
|
7568
|
+
JSDoc_typedefs_may_be_converted_to_TypeScript_types: diag(80010, 2 /* Suggestion */, "JSDoc_typedefs_may_be_converted_to_TypeScript_types_80010", "JSDoc typedefs may be converted to TypeScript types."),
|
|
7573
7569
|
Add_missing_super_call: diag(90001, 3 /* Message */, "Add_missing_super_call_90001", "Add missing 'super()' call"),
|
|
7574
7570
|
Make_super_call_the_first_statement_in_the_constructor: diag(90002, 3 /* Message */, "Make_super_call_the_first_statement_in_the_constructor_90002", "Make 'super()' call the first statement in the constructor"),
|
|
7575
7571
|
Change_extends_to_implements: diag(90003, 3 /* Message */, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"),
|
|
@@ -7784,6 +7780,8 @@ var Diagnostics = {
|
|
|
7784
7780
|
Rename_param_tag_name_0_to_1: diag(95173, 3 /* Message */, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"),
|
|
7785
7781
|
Use_0: diag(95174, 3 /* Message */, "Use_0_95174", "Use `{0}`."),
|
|
7786
7782
|
Use_Number_isNaN_in_all_conditions: diag(95175, 3 /* Message */, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
|
|
7783
|
+
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
|
|
7784
|
+
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
7787
7785
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7788
7786
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7789
7787
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -36542,20 +36540,14 @@ function getEffectiveTypeRoots(options, host) {
|
|
|
36542
36540
|
currentDirectory = host.getCurrentDirectory();
|
|
36543
36541
|
}
|
|
36544
36542
|
if (currentDirectory !== void 0) {
|
|
36545
|
-
return getDefaultTypeRoots(currentDirectory
|
|
36543
|
+
return getDefaultTypeRoots(currentDirectory);
|
|
36546
36544
|
}
|
|
36547
36545
|
}
|
|
36548
|
-
function getDefaultTypeRoots(currentDirectory
|
|
36549
|
-
if (!host.directoryExists) {
|
|
36550
|
-
return [combinePaths(currentDirectory, nodeModulesAtTypes)];
|
|
36551
|
-
}
|
|
36546
|
+
function getDefaultTypeRoots(currentDirectory) {
|
|
36552
36547
|
let typeRoots;
|
|
36553
36548
|
forEachAncestorDirectory(normalizePath(currentDirectory), (directory) => {
|
|
36554
36549
|
const atTypes = combinePaths(directory, nodeModulesAtTypes);
|
|
36555
|
-
|
|
36556
|
-
(typeRoots || (typeRoots = [])).push(atTypes);
|
|
36557
|
-
}
|
|
36558
|
-
return void 0;
|
|
36550
|
+
(typeRoots != null ? typeRoots : typeRoots = []).push(atTypes);
|
|
36559
36551
|
});
|
|
36560
36552
|
return typeRoots;
|
|
36561
36553
|
}
|
|
@@ -36692,10 +36684,22 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
36692
36684
|
}
|
|
36693
36685
|
return firstDefined(typeRoots, (typeRoot) => {
|
|
36694
36686
|
const candidate = combinePaths(typeRoot, typeReferenceDirectiveName);
|
|
36695
|
-
const
|
|
36696
|
-
const directoryExists = directoryProbablyExists(candidateDirectory, host);
|
|
36687
|
+
const directoryExists = directoryProbablyExists(typeRoot, host);
|
|
36697
36688
|
if (!directoryExists && traceEnabled) {
|
|
36698
|
-
trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it,
|
|
36689
|
+
trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
36690
|
+
}
|
|
36691
|
+
if (options.typeRoots) {
|
|
36692
|
+
const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, moduleResolutionState);
|
|
36693
|
+
if (resolvedFromFile) {
|
|
36694
|
+
const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path);
|
|
36695
|
+
const packageInfo = packageDirectory ? getPackageJsonInfo(
|
|
36696
|
+
packageDirectory,
|
|
36697
|
+
/*onlyRecordFailures*/
|
|
36698
|
+
false,
|
|
36699
|
+
moduleResolutionState
|
|
36700
|
+
) : void 0;
|
|
36701
|
+
return resolvedTypeScriptOnly(withPackageId(packageInfo, resolvedFromFile));
|
|
36702
|
+
}
|
|
36699
36703
|
}
|
|
36700
36704
|
return resolvedTypeScriptOnly(
|
|
36701
36705
|
loadNodeModuleFromDirectory(
|
|
@@ -36715,33 +36719,37 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
36715
36719
|
function secondaryLookup() {
|
|
36716
36720
|
const initialLocationForSecondaryLookup = containingFile && getDirectoryPath(containingFile);
|
|
36717
36721
|
if (initialLocationForSecondaryLookup !== void 0) {
|
|
36718
|
-
if (traceEnabled) {
|
|
36719
|
-
trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
|
|
36720
|
-
}
|
|
36721
36722
|
let result2;
|
|
36722
|
-
if (!
|
|
36723
|
-
|
|
36724
|
-
|
|
36725
|
-
|
|
36726
|
-
|
|
36727
|
-
|
|
36728
|
-
|
|
36729
|
-
|
|
36730
|
-
|
|
36731
|
-
|
|
36732
|
-
|
|
36733
|
-
|
|
36734
|
-
|
|
36735
|
-
|
|
36736
|
-
|
|
36737
|
-
|
|
36738
|
-
|
|
36739
|
-
|
|
36740
|
-
|
|
36741
|
-
|
|
36742
|
-
|
|
36743
|
-
|
|
36744
|
-
|
|
36723
|
+
if (!options.typeRoots || !endsWith(containingFile, inferredTypesContainingFile)) {
|
|
36724
|
+
if (traceEnabled) {
|
|
36725
|
+
trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
|
|
36726
|
+
}
|
|
36727
|
+
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
36728
|
+
const searchResult = loadModuleFromNearestNodeModulesDirectory(
|
|
36729
|
+
4 /* Declaration */,
|
|
36730
|
+
typeReferenceDirectiveName,
|
|
36731
|
+
initialLocationForSecondaryLookup,
|
|
36732
|
+
moduleResolutionState,
|
|
36733
|
+
/*cache*/
|
|
36734
|
+
void 0,
|
|
36735
|
+
/*redirectedReference*/
|
|
36736
|
+
void 0
|
|
36737
|
+
);
|
|
36738
|
+
result2 = searchResult && searchResult.value;
|
|
36739
|
+
} else {
|
|
36740
|
+
const { path: candidate } = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName);
|
|
36741
|
+
result2 = nodeLoadModuleByRelativeName(
|
|
36742
|
+
4 /* Declaration */,
|
|
36743
|
+
candidate,
|
|
36744
|
+
/*onlyRecordFailures*/
|
|
36745
|
+
false,
|
|
36746
|
+
moduleResolutionState,
|
|
36747
|
+
/*considerPackageJson*/
|
|
36748
|
+
true
|
|
36749
|
+
);
|
|
36750
|
+
}
|
|
36751
|
+
} else if (traceEnabled) {
|
|
36752
|
+
trace(host, Diagnostics.Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder);
|
|
36745
36753
|
}
|
|
36746
36754
|
return resolvedTypeScriptOnly(result2);
|
|
36747
36755
|
} else {
|
|
@@ -37535,6 +37543,9 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37535
37543
|
}
|
|
37536
37544
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
37537
37545
|
}
|
|
37546
|
+
if (extensions2 & 4 /* Declaration */) {
|
|
37547
|
+
resolved2 != null ? resolved2 : resolved2 = resolveFromTypeRoot(moduleName, state2);
|
|
37548
|
+
}
|
|
37538
37549
|
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
37539
37550
|
} else {
|
|
37540
37551
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
@@ -37715,6 +37726,7 @@ function tryFile(fileName, onlyRecordFailures, state) {
|
|
|
37715
37726
|
return forEach(state.compilerOptions.moduleSuffixes, (suffix) => tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state));
|
|
37716
37727
|
}
|
|
37717
37728
|
function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
37729
|
+
var _a2;
|
|
37718
37730
|
if (!onlyRecordFailures) {
|
|
37719
37731
|
if (state.host.fileExists(fileName)) {
|
|
37720
37732
|
if (state.traceEnabled) {
|
|
@@ -37727,7 +37739,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
|
37727
37739
|
}
|
|
37728
37740
|
}
|
|
37729
37741
|
}
|
|
37730
|
-
state.failedLookupLocations.push(fileName);
|
|
37742
|
+
(_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(fileName);
|
|
37731
37743
|
return void 0;
|
|
37732
37744
|
}
|
|
37733
37745
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
|
@@ -37741,8 +37753,8 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
37741
37753
|
host,
|
|
37742
37754
|
compilerOptions: options,
|
|
37743
37755
|
traceEnabled: isTraceEnabled(options, host),
|
|
37744
|
-
failedLookupLocations:
|
|
37745
|
-
affectingLocations:
|
|
37756
|
+
failedLookupLocations: void 0,
|
|
37757
|
+
affectingLocations: void 0,
|
|
37746
37758
|
packageJsonInfoCache,
|
|
37747
37759
|
features: 0 /* None */,
|
|
37748
37760
|
conditions: emptyArray,
|
|
@@ -37776,24 +37788,24 @@ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
|
37776
37788
|
return packageJsonInfo.contents.versionPaths || void 0;
|
|
37777
37789
|
}
|
|
37778
37790
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
37779
|
-
var _a2, _b, _c;
|
|
37791
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
37780
37792
|
const { host, traceEnabled } = state;
|
|
37781
37793
|
const packageJsonPath = combinePaths(packageDirectory, "package.json");
|
|
37782
37794
|
if (onlyRecordFailures) {
|
|
37783
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
37795
|
+
(_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(packageJsonPath);
|
|
37784
37796
|
return void 0;
|
|
37785
37797
|
}
|
|
37786
|
-
const existing = (
|
|
37798
|
+
const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
37787
37799
|
if (existing !== void 0) {
|
|
37788
37800
|
if (typeof existing !== "boolean") {
|
|
37789
37801
|
if (traceEnabled)
|
|
37790
37802
|
trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
|
|
37791
|
-
state.affectingLocations.push(packageJsonPath);
|
|
37803
|
+
(_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath);
|
|
37792
37804
|
return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents };
|
|
37793
37805
|
} else {
|
|
37794
37806
|
if (existing && traceEnabled)
|
|
37795
37807
|
trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
|
|
37796
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
37808
|
+
(_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath);
|
|
37797
37809
|
return void 0;
|
|
37798
37810
|
}
|
|
37799
37811
|
}
|
|
@@ -37804,15 +37816,15 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
37804
37816
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
37805
37817
|
}
|
|
37806
37818
|
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
37807
|
-
(
|
|
37808
|
-
state.affectingLocations.push(packageJsonPath);
|
|
37819
|
+
(_e = state.packageJsonInfoCache) == null ? void 0 : _e.setPackageJsonInfo(packageJsonPath, result);
|
|
37820
|
+
(_f = state.affectingLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
37809
37821
|
return result;
|
|
37810
37822
|
} else {
|
|
37811
37823
|
if (directoryExists && traceEnabled) {
|
|
37812
37824
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
37813
37825
|
}
|
|
37814
|
-
(
|
|
37815
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
37826
|
+
(_g = state.packageJsonInfoCache) == null ? void 0 : _g.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
37827
|
+
(_h = state.failedLookupLocations) == null ? void 0 : _h.push(packageJsonPath);
|
|
37816
37828
|
}
|
|
37817
37829
|
}
|
|
37818
37830
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
@@ -38633,11 +38645,13 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
38633
38645
|
state
|
|
38634
38646
|
));
|
|
38635
38647
|
});
|
|
38636
|
-
if (resolved2)
|
|
38648
|
+
if (resolved2)
|
|
38637
38649
|
return resolved2;
|
|
38638
|
-
}
|
|
38639
38650
|
if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
|
|
38640
|
-
|
|
38651
|
+
let resolved3 = loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
|
|
38652
|
+
if (extensions & 4 /* Declaration */)
|
|
38653
|
+
resolved3 != null ? resolved3 : resolved3 = resolveFromTypeRoot(moduleName, state);
|
|
38654
|
+
return resolved3;
|
|
38641
38655
|
}
|
|
38642
38656
|
} else {
|
|
38643
38657
|
const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
|
|
@@ -38651,6 +38665,31 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
38651
38665
|
}
|
|
38652
38666
|
}
|
|
38653
38667
|
}
|
|
38668
|
+
function resolveFromTypeRoot(moduleName, state) {
|
|
38669
|
+
if (!state.compilerOptions.typeRoots)
|
|
38670
|
+
return;
|
|
38671
|
+
for (const typeRoot of state.compilerOptions.typeRoots) {
|
|
38672
|
+
const candidate = combinePaths(typeRoot, moduleName);
|
|
38673
|
+
const directoryExists = directoryProbablyExists(typeRoot, state.host);
|
|
38674
|
+
if (!directoryExists && state.traceEnabled) {
|
|
38675
|
+
trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
38676
|
+
}
|
|
38677
|
+
const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, state);
|
|
38678
|
+
if (resolvedFromFile) {
|
|
38679
|
+
const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path);
|
|
38680
|
+
const packageInfo = packageDirectory ? getPackageJsonInfo(
|
|
38681
|
+
packageDirectory,
|
|
38682
|
+
/*onlyRecordFailures*/
|
|
38683
|
+
false,
|
|
38684
|
+
state
|
|
38685
|
+
) : void 0;
|
|
38686
|
+
return toSearchResult(withPackageId(packageInfo, resolvedFromFile));
|
|
38687
|
+
}
|
|
38688
|
+
const resolved = loadNodeModuleFromDirectory(4 /* Declaration */, candidate, !directoryExists, state);
|
|
38689
|
+
if (resolved)
|
|
38690
|
+
return toSearchResult(resolved);
|
|
38691
|
+
}
|
|
38692
|
+
}
|
|
38654
38693
|
function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
|
|
38655
38694
|
return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName);
|
|
38656
38695
|
}
|
|
@@ -47794,7 +47833,7 @@ function createTypeChecker(host) {
|
|
|
47794
47833
|
}
|
|
47795
47834
|
}
|
|
47796
47835
|
const mayHaveNameCollisions = !(context.flags & 64 /* UseFullyQualifiedType */);
|
|
47797
|
-
const seenNames = mayHaveNameCollisions ?
|
|
47836
|
+
const seenNames = mayHaveNameCollisions ? createMultiMap() : void 0;
|
|
47798
47837
|
const result = [];
|
|
47799
47838
|
let i = 0;
|
|
47800
47839
|
for (const type of types) {
|
|
@@ -51595,7 +51634,11 @@ function createTypeChecker(host) {
|
|
|
51595
51634
|
const baseTypeVariable = getBaseTypeVariableOfClass(symbol);
|
|
51596
51635
|
return baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type;
|
|
51597
51636
|
} else {
|
|
51598
|
-
return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(
|
|
51637
|
+
return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(
|
|
51638
|
+
type,
|
|
51639
|
+
/*isProperty*/
|
|
51640
|
+
true
|
|
51641
|
+
) : type;
|
|
51599
51642
|
}
|
|
51600
51643
|
}
|
|
51601
51644
|
function getTypeOfEnumMember(symbol) {
|
|
@@ -60075,7 +60118,7 @@ function createTypeChecker(host) {
|
|
|
60075
60118
|
0 /* None */
|
|
60076
60119
|
);
|
|
60077
60120
|
}
|
|
60078
|
-
} else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
|
|
60121
|
+
} else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => t === target2 || !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
|
|
60079
60122
|
result2 &= propertiesRelatedTo(
|
|
60080
60123
|
source2,
|
|
60081
60124
|
target2,
|
|
@@ -60296,6 +60339,7 @@ function createTypeChecker(host) {
|
|
|
60296
60339
|
} else if (targetFlags & 8388608 /* IndexedAccess */) {
|
|
60297
60340
|
if (sourceFlags & 8388608 /* IndexedAccess */) {
|
|
60298
60341
|
if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
|
|
60342
|
+
instantiateType(source2.objectType, reportUnreliableMapper);
|
|
60299
60343
|
result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
|
|
60300
60344
|
}
|
|
60301
60345
|
if (result2) {
|
|
@@ -63441,7 +63485,7 @@ function createTypeChecker(host) {
|
|
|
63441
63485
|
);
|
|
63442
63486
|
}
|
|
63443
63487
|
function isInAmbientOrTypeNode(node) {
|
|
63444
|
-
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeLiteralNode(n)));
|
|
63488
|
+
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeAliasDeclaration(n) || isTypeLiteralNode(n)));
|
|
63445
63489
|
}
|
|
63446
63490
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
63447
63491
|
switch (node.kind) {
|
|
@@ -66589,6 +66633,16 @@ function createTypeChecker(host) {
|
|
|
66589
66633
|
const symbol = getSymbolOfDeclaration(element);
|
|
66590
66634
|
return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
|
|
66591
66635
|
}
|
|
66636
|
+
if (hasDynamicName(element)) {
|
|
66637
|
+
const name = getNameOfDeclaration(element);
|
|
66638
|
+
if (name && isComputedPropertyName(name)) {
|
|
66639
|
+
const exprType = checkExpression(name.expression);
|
|
66640
|
+
const propType = isTypeUsableAsPropertyName(exprType) && getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType));
|
|
66641
|
+
if (propType) {
|
|
66642
|
+
return propType;
|
|
66643
|
+
}
|
|
66644
|
+
}
|
|
66645
|
+
}
|
|
66592
66646
|
if (element.name) {
|
|
66593
66647
|
const nameType = getLiteralTypeFromPropertyName(element.name);
|
|
66594
66648
|
return mapType(
|
|
@@ -71362,7 +71416,7 @@ function createTypeChecker(host) {
|
|
|
71362
71416
|
}
|
|
71363
71417
|
function getNonArrayRestType(signature) {
|
|
71364
71418
|
const restType = getEffectiveRestType(signature);
|
|
71365
|
-
return restType && !isArrayType(restType) && !isTypeAny(restType)
|
|
71419
|
+
return restType && !isArrayType(restType) && !isTypeAny(restType) ? restType : void 0;
|
|
71366
71420
|
}
|
|
71367
71421
|
function getTypeOfFirstParameterOfSignature(signature) {
|
|
71368
71422
|
return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType);
|
|
@@ -76176,6 +76230,9 @@ function createTypeChecker(host) {
|
|
|
76176
76230
|
return;
|
|
76177
76231
|
}
|
|
76178
76232
|
if (isBindingPattern(node.name)) {
|
|
76233
|
+
if (isInAmbientOrTypeNode(node)) {
|
|
76234
|
+
return;
|
|
76235
|
+
}
|
|
76179
76236
|
const needCheckInitializer = hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* ForInStatement */;
|
|
76180
76237
|
const needCheckWidenedType = !some(node.name.elements, not(isOmittedExpression));
|
|
76181
76238
|
if (needCheckInitializer || needCheckWidenedType) {
|
|
@@ -85279,6 +85336,7 @@ function createDefaultValueCheck(flattenContext, value, defaultValue, location)
|
|
|
85279
85336
|
);
|
|
85280
85337
|
}
|
|
85281
85338
|
function createDestructuringPropertyAccess(flattenContext, value, propertyName) {
|
|
85339
|
+
const { factory: factory2 } = flattenContext.context;
|
|
85282
85340
|
if (isComputedPropertyName(propertyName)) {
|
|
85283
85341
|
const argumentExpression = ensureIdentifier(
|
|
85284
85342
|
flattenContext,
|
|
@@ -85290,7 +85348,7 @@ function createDestructuringPropertyAccess(flattenContext, value, propertyName)
|
|
|
85290
85348
|
);
|
|
85291
85349
|
return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression);
|
|
85292
85350
|
} else if (isStringOrNumericLiteralLike(propertyName)) {
|
|
85293
|
-
const argumentExpression =
|
|
85351
|
+
const argumentExpression = factory2.cloneNode(propertyName);
|
|
85294
85352
|
return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression);
|
|
85295
85353
|
} else {
|
|
85296
85354
|
const name = flattenContext.context.factory.createIdentifier(idText(propertyName));
|
|
@@ -85360,28 +85418,29 @@ function processTaggedTemplateExpression(context, node, visitor, currentSourceFi
|
|
|
85360
85418
|
if (level === 0 /* LiftRestriction */ && !hasInvalidEscape(template)) {
|
|
85361
85419
|
return visitEachChild(node, visitor, context);
|
|
85362
85420
|
}
|
|
85421
|
+
const { factory: factory2 } = context;
|
|
85363
85422
|
if (isNoSubstitutionTemplateLiteral(template)) {
|
|
85364
|
-
cookedStrings.push(createTemplateCooked(template));
|
|
85365
|
-
rawStrings.push(getRawLiteral(template, currentSourceFile));
|
|
85423
|
+
cookedStrings.push(createTemplateCooked(factory2, template));
|
|
85424
|
+
rawStrings.push(getRawLiteral(factory2, template, currentSourceFile));
|
|
85366
85425
|
} else {
|
|
85367
|
-
cookedStrings.push(createTemplateCooked(template.head));
|
|
85368
|
-
rawStrings.push(getRawLiteral(template.head, currentSourceFile));
|
|
85426
|
+
cookedStrings.push(createTemplateCooked(factory2, template.head));
|
|
85427
|
+
rawStrings.push(getRawLiteral(factory2, template.head, currentSourceFile));
|
|
85369
85428
|
for (const templateSpan of template.templateSpans) {
|
|
85370
|
-
cookedStrings.push(createTemplateCooked(templateSpan.literal));
|
|
85371
|
-
rawStrings.push(getRawLiteral(templateSpan.literal, currentSourceFile));
|
|
85429
|
+
cookedStrings.push(createTemplateCooked(factory2, templateSpan.literal));
|
|
85430
|
+
rawStrings.push(getRawLiteral(factory2, templateSpan.literal, currentSourceFile));
|
|
85372
85431
|
templateArguments.push(Debug.checkDefined(visitNode(templateSpan.expression, visitor, isExpression)));
|
|
85373
85432
|
}
|
|
85374
85433
|
}
|
|
85375
85434
|
const helperCall = context.getEmitHelperFactory().createTemplateObjectHelper(
|
|
85376
|
-
|
|
85377
|
-
|
|
85435
|
+
factory2.createArrayLiteralExpression(cookedStrings),
|
|
85436
|
+
factory2.createArrayLiteralExpression(rawStrings)
|
|
85378
85437
|
);
|
|
85379
85438
|
if (isExternalModule(currentSourceFile)) {
|
|
85380
|
-
const tempVar =
|
|
85439
|
+
const tempVar = factory2.createUniqueName("templateObject");
|
|
85381
85440
|
recordTaggedTemplateString(tempVar);
|
|
85382
|
-
templateArguments[0] =
|
|
85441
|
+
templateArguments[0] = factory2.createLogicalOr(
|
|
85383
85442
|
tempVar,
|
|
85384
|
-
|
|
85443
|
+
factory2.createAssignment(
|
|
85385
85444
|
tempVar,
|
|
85386
85445
|
helperCall
|
|
85387
85446
|
)
|
|
@@ -85389,17 +85448,17 @@ function processTaggedTemplateExpression(context, node, visitor, currentSourceFi
|
|
|
85389
85448
|
} else {
|
|
85390
85449
|
templateArguments[0] = helperCall;
|
|
85391
85450
|
}
|
|
85392
|
-
return
|
|
85451
|
+
return factory2.createCallExpression(
|
|
85393
85452
|
tag,
|
|
85394
85453
|
/*typeArguments*/
|
|
85395
85454
|
void 0,
|
|
85396
85455
|
templateArguments
|
|
85397
85456
|
);
|
|
85398
85457
|
}
|
|
85399
|
-
function createTemplateCooked(template) {
|
|
85400
|
-
return template.templateFlags ?
|
|
85458
|
+
function createTemplateCooked(factory2, template) {
|
|
85459
|
+
return template.templateFlags ? factory2.createVoidZero() : factory2.createStringLiteral(template.text);
|
|
85401
85460
|
}
|
|
85402
|
-
function getRawLiteral(node, currentSourceFile) {
|
|
85461
|
+
function getRawLiteral(factory2, node, currentSourceFile) {
|
|
85403
85462
|
let text = node.rawText;
|
|
85404
85463
|
if (text === void 0) {
|
|
85405
85464
|
Debug.assertIsDefined(
|
|
@@ -85411,7 +85470,7 @@ function getRawLiteral(node, currentSourceFile) {
|
|
|
85411
85470
|
text = text.substring(1, text.length - (isLast ? 1 : 2));
|
|
85412
85471
|
}
|
|
85413
85472
|
text = text.replace(/\r\n?/g, "\n");
|
|
85414
|
-
return setTextRange(
|
|
85473
|
+
return setTextRange(factory2.createStringLiteral(text), node);
|
|
85415
85474
|
}
|
|
85416
85475
|
|
|
85417
85476
|
// src/compiler/transformers/ts.ts
|
|
@@ -88867,12 +88926,14 @@ function transformClassFields(context) {
|
|
|
88867
88926
|
if (privateIdentifierInfo.kind === "f" /* Field */) {
|
|
88868
88927
|
if (!privateIdentifierInfo.isStatic) {
|
|
88869
88928
|
return createPrivateInstanceFieldInitializer(
|
|
88929
|
+
factory2,
|
|
88870
88930
|
receiver,
|
|
88871
88931
|
visitNode(property.initializer, initializerVisitor, isExpression),
|
|
88872
88932
|
privateIdentifierInfo.brandCheckIdentifier
|
|
88873
88933
|
);
|
|
88874
88934
|
} else {
|
|
88875
88935
|
return createPrivateStaticFieldInitializer(
|
|
88936
|
+
factory2,
|
|
88876
88937
|
privateIdentifierInfo.variableName,
|
|
88877
88938
|
visitNode(property.initializer, initializerVisitor, isExpression)
|
|
88878
88939
|
);
|
|
@@ -88954,7 +89015,7 @@ function transformClassFields(context) {
|
|
|
88954
89015
|
Debug.assert(weakSetName, "weakSetName should be set in private identifier environment");
|
|
88955
89016
|
statements.push(
|
|
88956
89017
|
factory2.createExpressionStatement(
|
|
88957
|
-
createPrivateInstanceMethodInitializer(receiver, weakSetName)
|
|
89018
|
+
createPrivateInstanceMethodInitializer(factory2, receiver, weakSetName)
|
|
88958
89019
|
)
|
|
88959
89020
|
);
|
|
88960
89021
|
}
|
|
@@ -89407,25 +89468,25 @@ function transformClassFields(context) {
|
|
|
89407
89468
|
return void 0;
|
|
89408
89469
|
}
|
|
89409
89470
|
}
|
|
89410
|
-
function createPrivateStaticFieldInitializer(variableName, initializer) {
|
|
89411
|
-
return
|
|
89471
|
+
function createPrivateStaticFieldInitializer(factory2, variableName, initializer) {
|
|
89472
|
+
return factory2.createAssignment(
|
|
89412
89473
|
variableName,
|
|
89413
|
-
|
|
89414
|
-
|
|
89474
|
+
factory2.createObjectLiteralExpression([
|
|
89475
|
+
factory2.createPropertyAssignment("value", initializer || factory2.createVoidZero())
|
|
89415
89476
|
])
|
|
89416
89477
|
);
|
|
89417
89478
|
}
|
|
89418
|
-
function createPrivateInstanceFieldInitializer(receiver, initializer, weakMapName) {
|
|
89419
|
-
return
|
|
89420
|
-
|
|
89479
|
+
function createPrivateInstanceFieldInitializer(factory2, receiver, initializer, weakMapName) {
|
|
89480
|
+
return factory2.createCallExpression(
|
|
89481
|
+
factory2.createPropertyAccessExpression(weakMapName, "set"),
|
|
89421
89482
|
/*typeArguments*/
|
|
89422
89483
|
void 0,
|
|
89423
|
-
[receiver, initializer ||
|
|
89484
|
+
[receiver, initializer || factory2.createVoidZero()]
|
|
89424
89485
|
);
|
|
89425
89486
|
}
|
|
89426
|
-
function createPrivateInstanceMethodInitializer(receiver, weakSetName) {
|
|
89427
|
-
return
|
|
89428
|
-
|
|
89487
|
+
function createPrivateInstanceMethodInitializer(factory2, receiver, weakSetName) {
|
|
89488
|
+
return factory2.createCallExpression(
|
|
89489
|
+
factory2.createPropertyAccessExpression(weakSetName, "add"),
|
|
89429
89490
|
/*typeArguments*/
|
|
89430
89491
|
void 0,
|
|
89431
89492
|
[receiver]
|
|
@@ -89441,6 +89502,7 @@ function isPrivateIdentifierInExpression(node) {
|
|
|
89441
89502
|
// src/compiler/transformers/typeSerializer.ts
|
|
89442
89503
|
function createRuntimeTypeSerializer(context) {
|
|
89443
89504
|
const {
|
|
89505
|
+
factory: factory2,
|
|
89444
89506
|
hoistVariableDeclaration
|
|
89445
89507
|
} = context;
|
|
89446
89508
|
const resolver = context.getEmitResolver();
|
|
@@ -89480,9 +89542,9 @@ function createRuntimeTypeSerializer(context) {
|
|
|
89480
89542
|
case 260 /* ClassDeclaration */:
|
|
89481
89543
|
case 228 /* ClassExpression */:
|
|
89482
89544
|
case 171 /* MethodDeclaration */:
|
|
89483
|
-
return
|
|
89545
|
+
return factory2.createIdentifier("Function");
|
|
89484
89546
|
default:
|
|
89485
|
-
return
|
|
89547
|
+
return factory2.createVoidZero();
|
|
89486
89548
|
}
|
|
89487
89549
|
}
|
|
89488
89550
|
function serializeParameterTypesOfNode(node, container) {
|
|
@@ -89503,7 +89565,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
89503
89565
|
}
|
|
89504
89566
|
}
|
|
89505
89567
|
}
|
|
89506
|
-
return
|
|
89568
|
+
return factory2.createArrayLiteralExpression(expressions);
|
|
89507
89569
|
}
|
|
89508
89570
|
function getParametersOfDecoratedDeclaration(node, container) {
|
|
89509
89571
|
if (container && node.kind === 174 /* GetAccessor */) {
|
|
@@ -89518,39 +89580,39 @@ function createRuntimeTypeSerializer(context) {
|
|
|
89518
89580
|
if (isFunctionLike(node) && node.type) {
|
|
89519
89581
|
return serializeTypeNode(node.type);
|
|
89520
89582
|
} else if (isAsyncFunction(node)) {
|
|
89521
|
-
return
|
|
89583
|
+
return factory2.createIdentifier("Promise");
|
|
89522
89584
|
}
|
|
89523
|
-
return
|
|
89585
|
+
return factory2.createVoidZero();
|
|
89524
89586
|
}
|
|
89525
89587
|
function serializeTypeNode(node) {
|
|
89526
89588
|
if (node === void 0) {
|
|
89527
|
-
return
|
|
89589
|
+
return factory2.createIdentifier("Object");
|
|
89528
89590
|
}
|
|
89529
89591
|
node = skipTypeParentheses(node);
|
|
89530
89592
|
switch (node.kind) {
|
|
89531
89593
|
case 114 /* VoidKeyword */:
|
|
89532
89594
|
case 155 /* UndefinedKeyword */:
|
|
89533
89595
|
case 144 /* NeverKeyword */:
|
|
89534
|
-
return
|
|
89596
|
+
return factory2.createVoidZero();
|
|
89535
89597
|
case 181 /* FunctionType */:
|
|
89536
89598
|
case 182 /* ConstructorType */:
|
|
89537
|
-
return
|
|
89599
|
+
return factory2.createIdentifier("Function");
|
|
89538
89600
|
case 185 /* ArrayType */:
|
|
89539
89601
|
case 186 /* TupleType */:
|
|
89540
|
-
return
|
|
89602
|
+
return factory2.createIdentifier("Array");
|
|
89541
89603
|
case 179 /* TypePredicate */:
|
|
89542
|
-
return node.assertsModifier ?
|
|
89604
|
+
return node.assertsModifier ? factory2.createVoidZero() : factory2.createIdentifier("Boolean");
|
|
89543
89605
|
case 134 /* BooleanKeyword */:
|
|
89544
|
-
return
|
|
89606
|
+
return factory2.createIdentifier("Boolean");
|
|
89545
89607
|
case 200 /* TemplateLiteralType */:
|
|
89546
89608
|
case 152 /* StringKeyword */:
|
|
89547
|
-
return
|
|
89609
|
+
return factory2.createIdentifier("String");
|
|
89548
89610
|
case 149 /* ObjectKeyword */:
|
|
89549
|
-
return
|
|
89611
|
+
return factory2.createIdentifier("Object");
|
|
89550
89612
|
case 198 /* LiteralType */:
|
|
89551
89613
|
return serializeLiteralOfLiteralTypeNode(node.literal);
|
|
89552
89614
|
case 148 /* NumberKeyword */:
|
|
89553
|
-
return
|
|
89615
|
+
return factory2.createIdentifier("Number");
|
|
89554
89616
|
case 160 /* BigIntKeyword */:
|
|
89555
89617
|
return getGlobalConstructor("BigInt", 7 /* ES2020 */);
|
|
89556
89618
|
case 153 /* SymbolKeyword */:
|
|
@@ -89602,13 +89664,13 @@ function createRuntimeTypeSerializer(context) {
|
|
|
89602
89664
|
default:
|
|
89603
89665
|
return Debug.failBadSyntaxKind(node);
|
|
89604
89666
|
}
|
|
89605
|
-
return
|
|
89667
|
+
return factory2.createIdentifier("Object");
|
|
89606
89668
|
}
|
|
89607
89669
|
function serializeLiteralOfLiteralTypeNode(node) {
|
|
89608
89670
|
switch (node.kind) {
|
|
89609
89671
|
case 10 /* StringLiteral */:
|
|
89610
89672
|
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
89611
|
-
return
|
|
89673
|
+
return factory2.createIdentifier("String");
|
|
89612
89674
|
case 221 /* PrefixUnaryExpression */: {
|
|
89613
89675
|
const operand = node.operand;
|
|
89614
89676
|
switch (operand.kind) {
|
|
@@ -89620,14 +89682,14 @@ function createRuntimeTypeSerializer(context) {
|
|
|
89620
89682
|
}
|
|
89621
89683
|
}
|
|
89622
89684
|
case 8 /* NumericLiteral */:
|
|
89623
|
-
return
|
|
89685
|
+
return factory2.createIdentifier("Number");
|
|
89624
89686
|
case 9 /* BigIntLiteral */:
|
|
89625
89687
|
return getGlobalConstructor("BigInt", 7 /* ES2020 */);
|
|
89626
89688
|
case 110 /* TrueKeyword */:
|
|
89627
89689
|
case 95 /* FalseKeyword */:
|
|
89628
|
-
return
|
|
89690
|
+
return factory2.createIdentifier("Boolean");
|
|
89629
89691
|
case 104 /* NullKeyword */:
|
|
89630
|
-
return
|
|
89692
|
+
return factory2.createVoidZero();
|
|
89631
89693
|
default:
|
|
89632
89694
|
return Debug.failBadSyntaxKind(node);
|
|
89633
89695
|
}
|
|
@@ -89638,16 +89700,16 @@ function createRuntimeTypeSerializer(context) {
|
|
|
89638
89700
|
typeNode = skipTypeParentheses(typeNode);
|
|
89639
89701
|
if (typeNode.kind === 144 /* NeverKeyword */) {
|
|
89640
89702
|
if (isIntersection)
|
|
89641
|
-
return
|
|
89703
|
+
return factory2.createVoidZero();
|
|
89642
89704
|
continue;
|
|
89643
89705
|
}
|
|
89644
89706
|
if (typeNode.kind === 157 /* UnknownKeyword */) {
|
|
89645
89707
|
if (!isIntersection)
|
|
89646
|
-
return
|
|
89708
|
+
return factory2.createIdentifier("Object");
|
|
89647
89709
|
continue;
|
|
89648
89710
|
}
|
|
89649
89711
|
if (typeNode.kind === 131 /* AnyKeyword */) {
|
|
89650
|
-
return
|
|
89712
|
+
return factory2.createIdentifier("Object");
|
|
89651
89713
|
}
|
|
89652
89714
|
if (!strictNullChecks && (isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* NullKeyword */ || typeNode.kind === 155 /* UndefinedKeyword */)) {
|
|
89653
89715
|
continue;
|
|
@@ -89658,13 +89720,13 @@ function createRuntimeTypeSerializer(context) {
|
|
|
89658
89720
|
}
|
|
89659
89721
|
if (serializedType) {
|
|
89660
89722
|
if (!equateSerializedTypeNodes(serializedType, serializedConstituent)) {
|
|
89661
|
-
return
|
|
89723
|
+
return factory2.createIdentifier("Object");
|
|
89662
89724
|
}
|
|
89663
89725
|
} else {
|
|
89664
89726
|
serializedType = serializedConstituent;
|
|
89665
89727
|
}
|
|
89666
89728
|
}
|
|
89667
|
-
return serializedType != null ? serializedType :
|
|
89729
|
+
return serializedType != null ? serializedType : factory2.createVoidZero();
|
|
89668
89730
|
}
|
|
89669
89731
|
function equateSerializedTypeNodes(left, right) {
|
|
89670
89732
|
return (
|
|
@@ -89698,48 +89760,48 @@ function createRuntimeTypeSerializer(context) {
|
|
|
89698
89760
|
switch (kind) {
|
|
89699
89761
|
case 0 /* Unknown */:
|
|
89700
89762
|
if (findAncestor(node, (n) => n.parent && isConditionalTypeNode(n.parent) && (n.parent.trueType === n || n.parent.falseType === n))) {
|
|
89701
|
-
return
|
|
89763
|
+
return factory2.createIdentifier("Object");
|
|
89702
89764
|
}
|
|
89703
89765
|
const serialized = serializeEntityNameAsExpressionFallback(node.typeName);
|
|
89704
|
-
const temp =
|
|
89705
|
-
return
|
|
89706
|
-
|
|
89766
|
+
const temp = factory2.createTempVariable(hoistVariableDeclaration);
|
|
89767
|
+
return factory2.createConditionalExpression(
|
|
89768
|
+
factory2.createTypeCheck(factory2.createAssignment(temp, serialized), "function"),
|
|
89707
89769
|
/*questionToken*/
|
|
89708
89770
|
void 0,
|
|
89709
89771
|
temp,
|
|
89710
89772
|
/*colonToken*/
|
|
89711
89773
|
void 0,
|
|
89712
|
-
|
|
89774
|
+
factory2.createIdentifier("Object")
|
|
89713
89775
|
);
|
|
89714
89776
|
case 1 /* TypeWithConstructSignatureAndValue */:
|
|
89715
89777
|
return serializeEntityNameAsExpression(node.typeName);
|
|
89716
89778
|
case 2 /* VoidNullableOrNeverType */:
|
|
89717
|
-
return
|
|
89779
|
+
return factory2.createVoidZero();
|
|
89718
89780
|
case 4 /* BigIntLikeType */:
|
|
89719
89781
|
return getGlobalConstructor("BigInt", 7 /* ES2020 */);
|
|
89720
89782
|
case 6 /* BooleanType */:
|
|
89721
|
-
return
|
|
89783
|
+
return factory2.createIdentifier("Boolean");
|
|
89722
89784
|
case 3 /* NumberLikeType */:
|
|
89723
|
-
return
|
|
89785
|
+
return factory2.createIdentifier("Number");
|
|
89724
89786
|
case 5 /* StringLikeType */:
|
|
89725
|
-
return
|
|
89787
|
+
return factory2.createIdentifier("String");
|
|
89726
89788
|
case 7 /* ArrayLikeType */:
|
|
89727
|
-
return
|
|
89789
|
+
return factory2.createIdentifier("Array");
|
|
89728
89790
|
case 8 /* ESSymbolType */:
|
|
89729
89791
|
return getGlobalConstructor("Symbol", 2 /* ES2015 */);
|
|
89730
89792
|
case 10 /* TypeWithCallSignature */:
|
|
89731
|
-
return
|
|
89793
|
+
return factory2.createIdentifier("Function");
|
|
89732
89794
|
case 9 /* Promise */:
|
|
89733
|
-
return
|
|
89795
|
+
return factory2.createIdentifier("Promise");
|
|
89734
89796
|
case 11 /* ObjectType */:
|
|
89735
|
-
return
|
|
89797
|
+
return factory2.createIdentifier("Object");
|
|
89736
89798
|
default:
|
|
89737
89799
|
return Debug.assertNever(kind);
|
|
89738
89800
|
}
|
|
89739
89801
|
}
|
|
89740
89802
|
function createCheckedValue(left, right) {
|
|
89741
|
-
return
|
|
89742
|
-
|
|
89803
|
+
return factory2.createLogicalAnd(
|
|
89804
|
+
factory2.createStrictInequality(factory2.createTypeOfExpression(left), factory2.createStringLiteral("undefined")),
|
|
89743
89805
|
right
|
|
89744
89806
|
);
|
|
89745
89807
|
}
|
|
@@ -89752,13 +89814,13 @@ function createRuntimeTypeSerializer(context) {
|
|
|
89752
89814
|
return createCheckedValue(serializeEntityNameAsExpression(node.left), serializeEntityNameAsExpression(node));
|
|
89753
89815
|
}
|
|
89754
89816
|
const left = serializeEntityNameAsExpressionFallback(node.left);
|
|
89755
|
-
const temp =
|
|
89756
|
-
return
|
|
89757
|
-
|
|
89817
|
+
const temp = factory2.createTempVariable(hoistVariableDeclaration);
|
|
89818
|
+
return factory2.createLogicalAnd(
|
|
89819
|
+
factory2.createLogicalAnd(
|
|
89758
89820
|
left.left,
|
|
89759
|
-
|
|
89821
|
+
factory2.createStrictInequality(factory2.createAssignment(temp, left.right), factory2.createVoidZero())
|
|
89760
89822
|
),
|
|
89761
|
-
|
|
89823
|
+
factory2.createPropertyAccessExpression(temp, node.right)
|
|
89762
89824
|
);
|
|
89763
89825
|
}
|
|
89764
89826
|
function serializeEntityNameAsExpression(node) {
|
|
@@ -89773,21 +89835,21 @@ function createRuntimeTypeSerializer(context) {
|
|
|
89773
89835
|
}
|
|
89774
89836
|
}
|
|
89775
89837
|
function serializeQualifiedNameAsExpression(node) {
|
|
89776
|
-
return
|
|
89838
|
+
return factory2.createPropertyAccessExpression(serializeEntityNameAsExpression(node.left), node.right);
|
|
89777
89839
|
}
|
|
89778
89840
|
function getGlobalConstructorWithFallback(name) {
|
|
89779
|
-
return
|
|
89780
|
-
|
|
89841
|
+
return factory2.createConditionalExpression(
|
|
89842
|
+
factory2.createTypeCheck(factory2.createIdentifier(name), "function"),
|
|
89781
89843
|
/*questionToken*/
|
|
89782
89844
|
void 0,
|
|
89783
|
-
|
|
89845
|
+
factory2.createIdentifier(name),
|
|
89784
89846
|
/*colonToken*/
|
|
89785
89847
|
void 0,
|
|
89786
|
-
|
|
89848
|
+
factory2.createIdentifier("Object")
|
|
89787
89849
|
);
|
|
89788
89850
|
}
|
|
89789
89851
|
function getGlobalConstructor(name, minLanguageVersion) {
|
|
89790
|
-
return languageVersion < minLanguageVersion ? getGlobalConstructorWithFallback(name) :
|
|
89852
|
+
return languageVersion < minLanguageVersion ? getGlobalConstructorWithFallback(name) : factory2.createIdentifier(name);
|
|
89791
89853
|
}
|
|
89792
89854
|
}
|
|
89793
89855
|
|
|
@@ -104618,7 +104680,7 @@ function transformDeclarations(context) {
|
|
|
104618
104680
|
}
|
|
104619
104681
|
const newParam = factory2.updateParameterDeclaration(
|
|
104620
104682
|
p,
|
|
104621
|
-
maskModifiers(p, modifierMask),
|
|
104683
|
+
maskModifiers(factory2, p, modifierMask),
|
|
104622
104684
|
p.dotDotDotToken,
|
|
104623
104685
|
filterBindingPatternInitializersAndRenamings(p.name),
|
|
104624
104686
|
resolver.isOptionalParameter(p) ? p.questionToken || factory2.createToken(57 /* QuestionToken */) : void 0,
|
|
@@ -105732,8 +105794,8 @@ function isAlwaysType(node) {
|
|
|
105732
105794
|
}
|
|
105733
105795
|
return false;
|
|
105734
105796
|
}
|
|
105735
|
-
function maskModifiers(node, modifierMask, modifierAdditions) {
|
|
105736
|
-
return
|
|
105797
|
+
function maskModifiers(factory2, node, modifierMask, modifierAdditions) {
|
|
105798
|
+
return factory2.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions));
|
|
105737
105799
|
}
|
|
105738
105800
|
function maskModifierFlags(node, modifierMask = 258047 /* All */ ^ 4 /* Public */, modifierAdditions = 0 /* None */) {
|
|
105739
105801
|
let flags = getEffectiveModifierFlags(node) & modifierMask | modifierAdditions;
|
|
@@ -118522,7 +118584,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118522
118584
|
return toWatch && directoryWatchesOfFailedLookups.has(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
118523
118585
|
}
|
|
118524
118586
|
function createTypeRootsWatch(typeRootPath, typeRoot) {
|
|
118525
|
-
return resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
118587
|
+
return canWatchTypeRootPath(typeRootPath) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
118526
118588
|
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
|
|
118527
118589
|
if (cachedDirectoryStructureHost) {
|
|
118528
118590
|
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
@@ -118533,7 +118595,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118533
118595
|
if (dirPath) {
|
|
118534
118596
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
118535
118597
|
}
|
|
118536
|
-
}, 1 /* Recursive */);
|
|
118598
|
+
}, 1 /* Recursive */) : noopFileWatcher;
|
|
118537
118599
|
}
|
|
118538
118600
|
function updateTypeRootsWatch() {
|
|
118539
118601
|
const options = resolutionHost.getCompilationSettings();
|
|
@@ -118541,7 +118603,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118541
118603
|
closeTypeRootsWatch();
|
|
118542
118604
|
return;
|
|
118543
118605
|
}
|
|
118544
|
-
const typeRoots = getEffectiveTypeRoots(options, {
|
|
118606
|
+
const typeRoots = getEffectiveTypeRoots(options, { getCurrentDirectory });
|
|
118545
118607
|
if (typeRoots) {
|
|
118546
118608
|
mutateMap(
|
|
118547
118609
|
typeRootsWatches,
|
|
@@ -118555,7 +118617,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118555
118617
|
closeTypeRootsWatch();
|
|
118556
118618
|
}
|
|
118557
118619
|
}
|
|
118558
|
-
function
|
|
118620
|
+
function canWatchTypeRootPath(nodeTypesDirectory) {
|
|
118621
|
+
if (resolutionHost.getCompilationSettings().typeRoots)
|
|
118622
|
+
return true;
|
|
118559
118623
|
const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory));
|
|
118560
118624
|
const dirPath = resolutionHost.toPath(dir);
|
|
118561
118625
|
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|