@typescript-deploys/pr-build 5.1.0-pr-52838-7 → 5.1.0-pr-52984-22
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 +132 -71
- package/lib/tsserver.js +755 -525
- package/lib/tsserverlibrary.d.ts +0 -30
- package/lib/tsserverlibrary.js +814 -574
- package/lib/typescript.d.ts +0 -3
- package/lib/typescript.js +809 -548
- package/lib/typingsInstaller.js +49 -13
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -899,10 +899,6 @@ function cast(value, test) {
|
|
|
899
899
|
}
|
|
900
900
|
function noop(_) {
|
|
901
901
|
}
|
|
902
|
-
var noopPush = {
|
|
903
|
-
push: noop,
|
|
904
|
-
length: 0
|
|
905
|
-
};
|
|
906
902
|
function returnFalse() {
|
|
907
903
|
return false;
|
|
908
904
|
}
|
|
@@ -7172,6 +7168,7 @@ var Diagnostics = {
|
|
|
7172
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."),
|
|
7173
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."),
|
|
7174
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."),
|
|
7175
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."),
|
|
7176
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}'."),
|
|
7177
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."),
|
|
@@ -7567,6 +7564,8 @@ var Diagnostics = {
|
|
|
7567
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."),
|
|
7568
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."),
|
|
7569
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."),
|
|
7570
7569
|
Add_missing_super_call: diag(90001, 3 /* Message */, "Add_missing_super_call_90001", "Add missing 'super()' call"),
|
|
7571
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"),
|
|
7572
7571
|
Change_extends_to_implements: diag(90003, 3 /* Message */, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"),
|
|
@@ -7781,6 +7780,8 @@ var Diagnostics = {
|
|
|
7781
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}'"),
|
|
7782
7781
|
Use_0: diag(95174, 3 /* Message */, "Use_0_95174", "Use `{0}`."),
|
|
7783
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."),
|
|
7784
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."),
|
|
7785
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'."),
|
|
7786
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?"),
|
|
@@ -36539,20 +36540,14 @@ function getEffectiveTypeRoots(options, host) {
|
|
|
36539
36540
|
currentDirectory = host.getCurrentDirectory();
|
|
36540
36541
|
}
|
|
36541
36542
|
if (currentDirectory !== void 0) {
|
|
36542
|
-
return getDefaultTypeRoots(currentDirectory
|
|
36543
|
+
return getDefaultTypeRoots(currentDirectory);
|
|
36543
36544
|
}
|
|
36544
36545
|
}
|
|
36545
|
-
function getDefaultTypeRoots(currentDirectory
|
|
36546
|
-
if (!host.directoryExists) {
|
|
36547
|
-
return [combinePaths(currentDirectory, nodeModulesAtTypes)];
|
|
36548
|
-
}
|
|
36546
|
+
function getDefaultTypeRoots(currentDirectory) {
|
|
36549
36547
|
let typeRoots;
|
|
36550
36548
|
forEachAncestorDirectory(normalizePath(currentDirectory), (directory) => {
|
|
36551
36549
|
const atTypes = combinePaths(directory, nodeModulesAtTypes);
|
|
36552
|
-
|
|
36553
|
-
(typeRoots || (typeRoots = [])).push(atTypes);
|
|
36554
|
-
}
|
|
36555
|
-
return void 0;
|
|
36550
|
+
(typeRoots != null ? typeRoots : typeRoots = []).push(atTypes);
|
|
36556
36551
|
});
|
|
36557
36552
|
return typeRoots;
|
|
36558
36553
|
}
|
|
@@ -36689,10 +36684,22 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
36689
36684
|
}
|
|
36690
36685
|
return firstDefined(typeRoots, (typeRoot) => {
|
|
36691
36686
|
const candidate = combinePaths(typeRoot, typeReferenceDirectiveName);
|
|
36692
|
-
const
|
|
36693
|
-
const directoryExists = directoryProbablyExists(candidateDirectory, host);
|
|
36687
|
+
const directoryExists = directoryProbablyExists(typeRoot, host);
|
|
36694
36688
|
if (!directoryExists && traceEnabled) {
|
|
36695
|
-
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
|
+
}
|
|
36696
36703
|
}
|
|
36697
36704
|
return resolvedTypeScriptOnly(
|
|
36698
36705
|
loadNodeModuleFromDirectory(
|
|
@@ -36712,33 +36719,37 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
36712
36719
|
function secondaryLookup() {
|
|
36713
36720
|
const initialLocationForSecondaryLookup = containingFile && getDirectoryPath(containingFile);
|
|
36714
36721
|
if (initialLocationForSecondaryLookup !== void 0) {
|
|
36715
|
-
if (traceEnabled) {
|
|
36716
|
-
trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
|
|
36717
|
-
}
|
|
36718
36722
|
let result2;
|
|
36719
|
-
if (!
|
|
36720
|
-
|
|
36721
|
-
|
|
36722
|
-
|
|
36723
|
-
|
|
36724
|
-
|
|
36725
|
-
|
|
36726
|
-
|
|
36727
|
-
|
|
36728
|
-
|
|
36729
|
-
|
|
36730
|
-
|
|
36731
|
-
|
|
36732
|
-
|
|
36733
|
-
|
|
36734
|
-
|
|
36735
|
-
|
|
36736
|
-
|
|
36737
|
-
|
|
36738
|
-
|
|
36739
|
-
|
|
36740
|
-
|
|
36741
|
-
|
|
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);
|
|
36742
36753
|
}
|
|
36743
36754
|
return resolvedTypeScriptOnly(result2);
|
|
36744
36755
|
} else {
|
|
@@ -37532,6 +37543,9 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37532
37543
|
}
|
|
37533
37544
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
37534
37545
|
}
|
|
37546
|
+
if (extensions2 & 4 /* Declaration */) {
|
|
37547
|
+
resolved2 != null ? resolved2 : resolved2 = resolveFromTypeRoot(moduleName, state2);
|
|
37548
|
+
}
|
|
37535
37549
|
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
37536
37550
|
} else {
|
|
37537
37551
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
@@ -37712,6 +37726,7 @@ function tryFile(fileName, onlyRecordFailures, state) {
|
|
|
37712
37726
|
return forEach(state.compilerOptions.moduleSuffixes, (suffix) => tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state));
|
|
37713
37727
|
}
|
|
37714
37728
|
function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
37729
|
+
var _a2;
|
|
37715
37730
|
if (!onlyRecordFailures) {
|
|
37716
37731
|
if (state.host.fileExists(fileName)) {
|
|
37717
37732
|
if (state.traceEnabled) {
|
|
@@ -37724,7 +37739,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
|
37724
37739
|
}
|
|
37725
37740
|
}
|
|
37726
37741
|
}
|
|
37727
|
-
state.failedLookupLocations.push(fileName);
|
|
37742
|
+
(_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(fileName);
|
|
37728
37743
|
return void 0;
|
|
37729
37744
|
}
|
|
37730
37745
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
|
@@ -37738,8 +37753,8 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
37738
37753
|
host,
|
|
37739
37754
|
compilerOptions: options,
|
|
37740
37755
|
traceEnabled: isTraceEnabled(options, host),
|
|
37741
|
-
failedLookupLocations:
|
|
37742
|
-
affectingLocations:
|
|
37756
|
+
failedLookupLocations: void 0,
|
|
37757
|
+
affectingLocations: void 0,
|
|
37743
37758
|
packageJsonInfoCache,
|
|
37744
37759
|
features: 0 /* None */,
|
|
37745
37760
|
conditions: emptyArray,
|
|
@@ -37773,24 +37788,24 @@ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
|
37773
37788
|
return packageJsonInfo.contents.versionPaths || void 0;
|
|
37774
37789
|
}
|
|
37775
37790
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
37776
|
-
var _a2, _b, _c;
|
|
37791
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
37777
37792
|
const { host, traceEnabled } = state;
|
|
37778
37793
|
const packageJsonPath = combinePaths(packageDirectory, "package.json");
|
|
37779
37794
|
if (onlyRecordFailures) {
|
|
37780
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
37795
|
+
(_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(packageJsonPath);
|
|
37781
37796
|
return void 0;
|
|
37782
37797
|
}
|
|
37783
|
-
const existing = (
|
|
37798
|
+
const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
37784
37799
|
if (existing !== void 0) {
|
|
37785
37800
|
if (typeof existing !== "boolean") {
|
|
37786
37801
|
if (traceEnabled)
|
|
37787
37802
|
trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
|
|
37788
|
-
state.affectingLocations.push(packageJsonPath);
|
|
37803
|
+
(_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath);
|
|
37789
37804
|
return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents };
|
|
37790
37805
|
} else {
|
|
37791
37806
|
if (existing && traceEnabled)
|
|
37792
37807
|
trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
|
|
37793
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
37808
|
+
(_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath);
|
|
37794
37809
|
return void 0;
|
|
37795
37810
|
}
|
|
37796
37811
|
}
|
|
@@ -37801,15 +37816,15 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
37801
37816
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
37802
37817
|
}
|
|
37803
37818
|
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
37804
|
-
(
|
|
37805
|
-
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);
|
|
37806
37821
|
return result;
|
|
37807
37822
|
} else {
|
|
37808
37823
|
if (directoryExists && traceEnabled) {
|
|
37809
37824
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
37810
37825
|
}
|
|
37811
|
-
(
|
|
37812
|
-
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);
|
|
37813
37828
|
}
|
|
37814
37829
|
}
|
|
37815
37830
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
@@ -38630,11 +38645,13 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
38630
38645
|
state
|
|
38631
38646
|
));
|
|
38632
38647
|
});
|
|
38633
|
-
if (resolved2)
|
|
38648
|
+
if (resolved2)
|
|
38634
38649
|
return resolved2;
|
|
38635
|
-
}
|
|
38636
38650
|
if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
|
|
38637
|
-
|
|
38651
|
+
let resolved3 = loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
|
|
38652
|
+
if (extensions & 4 /* Declaration */)
|
|
38653
|
+
resolved3 != null ? resolved3 : resolved3 = resolveFromTypeRoot(moduleName, state);
|
|
38654
|
+
return resolved3;
|
|
38638
38655
|
}
|
|
38639
38656
|
} else {
|
|
38640
38657
|
const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
|
|
@@ -38648,6 +38665,31 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
38648
38665
|
}
|
|
38649
38666
|
}
|
|
38650
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
|
+
}
|
|
38651
38693
|
function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
|
|
38652
38694
|
return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName);
|
|
38653
38695
|
}
|
|
@@ -51592,7 +51634,11 @@ function createTypeChecker(host) {
|
|
|
51592
51634
|
const baseTypeVariable = getBaseTypeVariableOfClass(symbol);
|
|
51593
51635
|
return baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type;
|
|
51594
51636
|
} else {
|
|
51595
|
-
return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(
|
|
51637
|
+
return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(
|
|
51638
|
+
type,
|
|
51639
|
+
/*isProperty*/
|
|
51640
|
+
true
|
|
51641
|
+
) : type;
|
|
51596
51642
|
}
|
|
51597
51643
|
}
|
|
51598
51644
|
function getTypeOfEnumMember(symbol) {
|
|
@@ -58164,6 +58210,9 @@ function createTypeChecker(host) {
|
|
|
58164
58210
|
function isTypeSubtypeOf(source, target) {
|
|
58165
58211
|
return isTypeRelatedTo(source, target, subtypeRelation);
|
|
58166
58212
|
}
|
|
58213
|
+
function isTypeStrictSubtypeOf(source, target) {
|
|
58214
|
+
return isTypeRelatedTo(source, target, strictSubtypeRelation);
|
|
58215
|
+
}
|
|
58167
58216
|
function isTypeAssignableTo(source, target) {
|
|
58168
58217
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
58169
58218
|
}
|
|
@@ -60293,6 +60342,7 @@ function createTypeChecker(host) {
|
|
|
60293
60342
|
} else if (targetFlags & 8388608 /* IndexedAccess */) {
|
|
60294
60343
|
if (sourceFlags & 8388608 /* IndexedAccess */) {
|
|
60295
60344
|
if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
|
|
60345
|
+
instantiateType(source2.objectType, reportUnreliableMapper);
|
|
60296
60346
|
result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
|
|
60297
60347
|
}
|
|
60298
60348
|
if (result2) {
|
|
@@ -63438,7 +63488,7 @@ function createTypeChecker(host) {
|
|
|
63438
63488
|
);
|
|
63439
63489
|
}
|
|
63440
63490
|
function isInAmbientOrTypeNode(node) {
|
|
63441
|
-
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeLiteralNode(n)));
|
|
63491
|
+
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeAliasDeclaration(n) || isTypeLiteralNode(n)));
|
|
63442
63492
|
}
|
|
63443
63493
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
63444
63494
|
switch (node.kind) {
|
|
@@ -65259,7 +65309,7 @@ function createTypeChecker(host) {
|
|
|
65259
65309
|
const narrowedType = mapType(candidate, (c) => {
|
|
65260
65310
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
65261
65311
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
65262
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) =>
|
|
65312
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType);
|
|
65263
65313
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
65264
65314
|
});
|
|
65265
65315
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -66586,6 +66636,16 @@ function createTypeChecker(host) {
|
|
|
66586
66636
|
const symbol = getSymbolOfDeclaration(element);
|
|
66587
66637
|
return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
|
|
66588
66638
|
}
|
|
66639
|
+
if (hasDynamicName(element)) {
|
|
66640
|
+
const name = getNameOfDeclaration(element);
|
|
66641
|
+
if (name && isComputedPropertyName(name)) {
|
|
66642
|
+
const exprType = checkExpression(name.expression);
|
|
66643
|
+
const propType = isTypeUsableAsPropertyName(exprType) && getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType));
|
|
66644
|
+
if (propType) {
|
|
66645
|
+
return propType;
|
|
66646
|
+
}
|
|
66647
|
+
}
|
|
66648
|
+
}
|
|
66589
66649
|
if (element.name) {
|
|
66590
66650
|
const nameType = getLiteralTypeFromPropertyName(element.name);
|
|
66591
66651
|
return mapType(
|
|
@@ -69193,20 +69253,16 @@ function createTypeChecker(host) {
|
|
|
69193
69253
|
) : createTupleType([type], [8 /* Variadic */]);
|
|
69194
69254
|
}
|
|
69195
69255
|
function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) {
|
|
69196
|
-
const inConstContext = isConstTypeVariable(restType);
|
|
69197
69256
|
if (index >= argCount - 1) {
|
|
69198
69257
|
const arg = args[argCount - 1];
|
|
69199
69258
|
if (isSpreadArgument(arg)) {
|
|
69200
|
-
|
|
69201
|
-
if (isArrayLikeType(spreadType)) {
|
|
69202
|
-
return getMutableArrayOrTupleType(spreadType);
|
|
69203
|
-
}
|
|
69204
|
-
return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 227 /* SpreadElement */ ? arg.expression : arg), inConstContext);
|
|
69259
|
+
return getMutableArrayOrTupleType(arg.kind === 234 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode));
|
|
69205
69260
|
}
|
|
69206
69261
|
}
|
|
69207
69262
|
const types = [];
|
|
69208
69263
|
const flags = [];
|
|
69209
69264
|
const names = [];
|
|
69265
|
+
const inConstContext = isConstTypeVariable(restType);
|
|
69210
69266
|
for (let i = index; i < argCount; i++) {
|
|
69211
69267
|
const arg = args[i];
|
|
69212
69268
|
if (isSpreadArgument(arg)) {
|
|
@@ -71363,7 +71419,7 @@ function createTypeChecker(host) {
|
|
|
71363
71419
|
}
|
|
71364
71420
|
function getNonArrayRestType(signature) {
|
|
71365
71421
|
const restType = getEffectiveRestType(signature);
|
|
71366
|
-
return restType && !isArrayType(restType) && !isTypeAny(restType)
|
|
71422
|
+
return restType && !isArrayType(restType) && !isTypeAny(restType) ? restType : void 0;
|
|
71367
71423
|
}
|
|
71368
71424
|
function getTypeOfFirstParameterOfSignature(signature) {
|
|
71369
71425
|
return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType);
|
|
@@ -76177,6 +76233,9 @@ function createTypeChecker(host) {
|
|
|
76177
76233
|
return;
|
|
76178
76234
|
}
|
|
76179
76235
|
if (isBindingPattern(node.name)) {
|
|
76236
|
+
if (isInAmbientOrTypeNode(node)) {
|
|
76237
|
+
return;
|
|
76238
|
+
}
|
|
76180
76239
|
const needCheckInitializer = hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* ForInStatement */;
|
|
76181
76240
|
const needCheckWidenedType = !some(node.name.elements, not(isOmittedExpression));
|
|
76182
76241
|
if (needCheckInitializer || needCheckWidenedType) {
|
|
@@ -118528,7 +118587,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118528
118587
|
return toWatch && directoryWatchesOfFailedLookups.has(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
118529
118588
|
}
|
|
118530
118589
|
function createTypeRootsWatch(typeRootPath, typeRoot) {
|
|
118531
|
-
return resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
118590
|
+
return canWatchTypeRootPath(typeRootPath) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
118532
118591
|
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
|
|
118533
118592
|
if (cachedDirectoryStructureHost) {
|
|
118534
118593
|
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
@@ -118539,7 +118598,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118539
118598
|
if (dirPath) {
|
|
118540
118599
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
118541
118600
|
}
|
|
118542
|
-
}, 1 /* Recursive */);
|
|
118601
|
+
}, 1 /* Recursive */) : noopFileWatcher;
|
|
118543
118602
|
}
|
|
118544
118603
|
function updateTypeRootsWatch() {
|
|
118545
118604
|
const options = resolutionHost.getCompilationSettings();
|
|
@@ -118547,7 +118606,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118547
118606
|
closeTypeRootsWatch();
|
|
118548
118607
|
return;
|
|
118549
118608
|
}
|
|
118550
|
-
const typeRoots = getEffectiveTypeRoots(options, {
|
|
118609
|
+
const typeRoots = getEffectiveTypeRoots(options, { getCurrentDirectory });
|
|
118551
118610
|
if (typeRoots) {
|
|
118552
118611
|
mutateMap(
|
|
118553
118612
|
typeRootsWatches,
|
|
@@ -118561,7 +118620,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118561
118620
|
closeTypeRootsWatch();
|
|
118562
118621
|
}
|
|
118563
118622
|
}
|
|
118564
|
-
function
|
|
118623
|
+
function canWatchTypeRootPath(nodeTypesDirectory) {
|
|
118624
|
+
if (resolutionHost.getCompilationSettings().typeRoots)
|
|
118625
|
+
return true;
|
|
118565
118626
|
const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory));
|
|
118566
118627
|
const dirPath = resolutionHost.toPath(dir);
|
|
118567
118628
|
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|