typescript 4.6.0-dev.20220209 → 4.7.0-dev.20220215
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/cs/diagnosticMessages.generated.json +9 -3
- package/lib/de/diagnosticMessages.generated.json +9 -3
- package/lib/es/diagnosticMessages.generated.json +9 -3
- package/lib/fr/diagnosticMessages.generated.json +9 -3
- package/lib/it/diagnosticMessages.generated.json +9 -3
- package/lib/ja/diagnosticMessages.generated.json +9 -3
- package/lib/ko/diagnosticMessages.generated.json +9 -3
- package/lib/pl/diagnosticMessages.generated.json +9 -3
- package/lib/pt-br/diagnosticMessages.generated.json +9 -3
- package/lib/ru/diagnosticMessages.generated.json +9 -3
- package/lib/tr/diagnosticMessages.generated.json +9 -3
- package/lib/tsc.js +191 -113
- package/lib/tsserver.js +439 -161
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +439 -161
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +439 -161
- package/lib/typescriptServices.d.ts +1 -1
- package/lib/typescriptServices.js +439 -161
- package/lib/typingsInstaller.js +223 -118
- package/lib/zh-cn/diagnosticMessages.generated.json +9 -3
- package/lib/zh-tw/diagnosticMessages.generated.json +9 -3
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -68,8 +68,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
68
68
|
};
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
|
-
ts.versionMajorMinor = "4.
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
71
|
+
ts.versionMajorMinor = "4.7";
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220215";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -4885,18 +4885,6 @@ var ts;
|
|
|
4885
4885
|
return getCanonicalFileName(nonCanonicalizedPath);
|
|
4886
4886
|
}
|
|
4887
4887
|
ts.toPath = toPath;
|
|
4888
|
-
function normalizePathAndParts(path) {
|
|
4889
|
-
path = normalizeSlashes(path);
|
|
4890
|
-
var _a = reducePathComponents(getPathComponents(path)), root = _a[0], parts = _a.slice(1);
|
|
4891
|
-
if (parts.length) {
|
|
4892
|
-
var joinedParts = root + parts.join(ts.directorySeparator);
|
|
4893
|
-
return { path: hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(joinedParts) : joinedParts, parts: parts };
|
|
4894
|
-
}
|
|
4895
|
-
else {
|
|
4896
|
-
return { path: root, parts: parts };
|
|
4897
|
-
}
|
|
4898
|
-
}
|
|
4899
|
-
ts.normalizePathAndParts = normalizePathAndParts;
|
|
4900
4888
|
function removeTrailingDirectorySeparator(path) {
|
|
4901
4889
|
if (hasTrailingDirectorySeparator(path)) {
|
|
4902
4890
|
return path.substr(0, path.length - 1);
|
|
@@ -5259,10 +5247,10 @@ var ts;
|
|
|
5259
5247
|
A_type_predicate_cannot_reference_a_rest_parameter: diag(1229, ts.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_a_rest_parameter_1229", "A type predicate cannot reference a rest parameter."),
|
|
5260
5248
|
A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: diag(1230, ts.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230", "A type predicate cannot reference element '{0}' in a binding pattern."),
|
|
5261
5249
|
An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration: diag(1231, ts.DiagnosticCategory.Error, "An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration_1231", "An export assignment must be at the top level of a file or module declaration."),
|
|
5262
|
-
|
|
5263
|
-
|
|
5250
|
+
An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module: diag(1232, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module_1232", "An import declaration can only be used at the top level of a namespace or module."),
|
|
5251
|
+
An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module: diag(1233, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module_1233", "An export declaration can only be used at the top level of a namespace or module."),
|
|
5264
5252
|
An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: diag(1234, ts.DiagnosticCategory.Error, "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234", "An ambient module declaration is only allowed at the top level in a file."),
|
|
5265
|
-
|
|
5253
|
+
A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module: diag(1235, ts.DiagnosticCategory.Error, "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235", "A namespace declaration is only allowed at the top level of a namespace or module."),
|
|
5266
5254
|
The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: diag(1236, ts.DiagnosticCategory.Error, "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236", "The return type of a property decorator function must be either 'void' or 'any'."),
|
|
5267
5255
|
The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: diag(1237, ts.DiagnosticCategory.Error, "The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237", "The return type of a parameter decorator function must be either 'void' or 'any'."),
|
|
5268
5256
|
Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: diag(1238, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238", "Unable to resolve signature of class decorator when called as an expression."),
|
|
@@ -5294,6 +5282,7 @@ var ts;
|
|
|
5294
5282
|
An_optional_element_cannot_follow_a_rest_element: diag(1266, ts.DiagnosticCategory.Error, "An_optional_element_cannot_follow_a_rest_element_1266", "An optional element cannot follow a rest element."),
|
|
5295
5283
|
Property_0_cannot_have_an_initializer_because_it_is_marked_abstract: diag(1267, ts.DiagnosticCategory.Error, "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267", "Property '{0}' cannot have an initializer because it is marked abstract."),
|
|
5296
5284
|
An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type: diag(1268, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type_1268", "An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type."),
|
|
5285
|
+
Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided: diag(1269, ts.DiagnosticCategory.Error, "Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided_1269", "Cannot use 'export import' on a type or type-only namespace when the '--isolatedModules' flag is provided."),
|
|
5297
5286
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
5298
5287
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
5299
5288
|
Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
|
|
@@ -5430,6 +5419,8 @@ var ts;
|
|
|
5430
5419
|
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
|
|
5431
5420
|
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
|
|
5432
5421
|
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
5422
|
+
An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
|
|
5423
|
+
An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
|
|
5433
5424
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
5434
5425
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
5435
5426
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", undefined, true),
|
|
@@ -6850,6 +6841,9 @@ var ts;
|
|
|
6850
6841
|
Add_all_missing_attributes: diag(95168, ts.DiagnosticCategory.Message, "Add_all_missing_attributes_95168", "Add all missing attributes"),
|
|
6851
6842
|
Add_undefined_to_optional_property_type: diag(95169, ts.DiagnosticCategory.Message, "Add_undefined_to_optional_property_type_95169", "Add 'undefined' to optional property type"),
|
|
6852
6843
|
Convert_named_imports_to_default_import: diag(95170, ts.DiagnosticCategory.Message, "Convert_named_imports_to_default_import_95170", "Convert named imports to default import"),
|
|
6844
|
+
Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
|
|
6845
|
+
Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
|
|
6846
|
+
Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"),
|
|
6853
6847
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.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."),
|
|
6854
6848
|
Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
6855
6849
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.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?"),
|
|
@@ -10739,6 +10733,10 @@ var ts;
|
|
|
10739
10733
|
return getSourceFileOfNode(module.valueDeclaration || getNonAugmentationDeclaration(module));
|
|
10740
10734
|
}
|
|
10741
10735
|
ts.getSourceFileOfModule = getSourceFileOfModule;
|
|
10736
|
+
function isPlainJsFile(file, checkJs) {
|
|
10737
|
+
return !!file && (file.scriptKind === 1 || file.scriptKind === 2) && !file.checkJsDirective && checkJs === undefined;
|
|
10738
|
+
}
|
|
10739
|
+
ts.isPlainJsFile = isPlainJsFile;
|
|
10742
10740
|
function isStatementWithLocals(node) {
|
|
10743
10741
|
switch (node.kind) {
|
|
10744
10742
|
case 234:
|
|
@@ -34024,7 +34022,7 @@ var ts;
|
|
|
34024
34022
|
result_4 = searchResult && searchResult.value;
|
|
34025
34023
|
}
|
|
34026
34024
|
else {
|
|
34027
|
-
var candidate =
|
|
34025
|
+
var candidate = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName).path;
|
|
34028
34026
|
result_4 = nodeLoadModuleByRelativeName(Extensions.DtsOnly, candidate, false, moduleResolutionState, true);
|
|
34029
34027
|
}
|
|
34030
34028
|
return resolvedTypeScriptOnly(result_4);
|
|
@@ -34600,12 +34598,19 @@ var ts;
|
|
|
34600
34598
|
return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
|
|
34601
34599
|
}
|
|
34602
34600
|
else {
|
|
34603
|
-
var _a =
|
|
34601
|
+
var _a = normalizePathForCJSResolution(containingDirectory, moduleName), candidate = _a.path, parts = _a.parts;
|
|
34604
34602
|
var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, false, state, true);
|
|
34605
34603
|
return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: ts.contains(parts, "node_modules") });
|
|
34606
34604
|
}
|
|
34607
34605
|
}
|
|
34608
34606
|
}
|
|
34607
|
+
function normalizePathForCJSResolution(containingDirectory, moduleName) {
|
|
34608
|
+
var combined = ts.combinePaths(containingDirectory, moduleName);
|
|
34609
|
+
var parts = ts.getPathComponents(combined);
|
|
34610
|
+
var lastPart = ts.lastOrUndefined(parts);
|
|
34611
|
+
var path = lastPart === "." || lastPart === ".." ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(combined)) : ts.normalizePath(combined);
|
|
34612
|
+
return { path: path, parts: parts };
|
|
34613
|
+
}
|
|
34609
34614
|
function realPath(path, host, traceEnabled) {
|
|
34610
34615
|
if (!host.realpath) {
|
|
34611
34616
|
return path;
|
|
@@ -34647,7 +34652,10 @@ var ts;
|
|
|
34647
34652
|
onlyRecordFailures = true;
|
|
34648
34653
|
}
|
|
34649
34654
|
}
|
|
34650
|
-
|
|
34655
|
+
if (!(state.features & NodeResolutionFeatures.EsmMode)) {
|
|
34656
|
+
return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson);
|
|
34657
|
+
}
|
|
34658
|
+
return undefined;
|
|
34651
34659
|
}
|
|
34652
34660
|
ts.nodeModulesPathPart = "/node_modules/";
|
|
34653
34661
|
function pathContainsNodeModules(path) {
|
|
@@ -34975,7 +34983,13 @@ var ts;
|
|
|
34975
34983
|
}
|
|
34976
34984
|
}
|
|
34977
34985
|
var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions;
|
|
34978
|
-
|
|
34986
|
+
var features = state.features;
|
|
34987
|
+
if ((jsonContent === null || jsonContent === void 0 ? void 0 : jsonContent.type) !== "module") {
|
|
34988
|
+
state.features &= ~NodeResolutionFeatures.EsmMode;
|
|
34989
|
+
}
|
|
34990
|
+
var result = nodeLoadModuleByRelativeName(nextExtensions, candidate, onlyRecordFailures, state, false);
|
|
34991
|
+
state.features = features;
|
|
34992
|
+
return result;
|
|
34979
34993
|
};
|
|
34980
34994
|
var onlyRecordFailuresForPackageFile = packageFile ? !ts.directoryProbablyExists(ts.getDirectoryPath(packageFile), state.host) : undefined;
|
|
34981
34995
|
var onlyRecordFailuresForIndex = onlyRecordFailures || !ts.directoryProbablyExists(candidate, state.host);
|
|
@@ -35304,6 +35318,12 @@ var ts;
|
|
|
35304
35318
|
}
|
|
35305
35319
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
35306
35320
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
35321
|
+
if (!pathAndExtension && packageInfo
|
|
35322
|
+
&& packageInfo.packageJsonContent.exports === undefined
|
|
35323
|
+
&& packageInfo.packageJsonContent.main === undefined
|
|
35324
|
+
&& state.features & NodeResolutionFeatures.EsmMode) {
|
|
35325
|
+
pathAndExtension = loadModuleFromFile(extensions, ts.combinePaths(candidate, "index.js"), onlyRecordFailures, state);
|
|
35326
|
+
}
|
|
35307
35327
|
return withPackageId(packageInfo, pathAndExtension);
|
|
35308
35328
|
};
|
|
35309
35329
|
if (rest !== "") {
|
|
@@ -39329,13 +39349,13 @@ var ts;
|
|
|
39329
39349
|
else {
|
|
39330
39350
|
var isEitherEnum = !!(target.flags & 384 || source.flags & 384);
|
|
39331
39351
|
var isEitherBlockScoped_1 = !!(target.flags & 2 || source.flags & 2);
|
|
39332
|
-
var message = isEitherEnum
|
|
39333
|
-
? ts.Diagnostics.
|
|
39334
|
-
: isEitherBlockScoped_1
|
|
39335
|
-
? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0
|
|
39352
|
+
var message = isEitherEnum ? ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations
|
|
39353
|
+
: isEitherBlockScoped_1 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0
|
|
39336
39354
|
: ts.Diagnostics.Duplicate_identifier_0;
|
|
39337
39355
|
var sourceSymbolFile = source.declarations && ts.getSourceFileOfNode(source.declarations[0]);
|
|
39338
39356
|
var targetSymbolFile = target.declarations && ts.getSourceFileOfNode(target.declarations[0]);
|
|
39357
|
+
var isSourcePlainJs = ts.isPlainJsFile(sourceSymbolFile, compilerOptions.checkJs);
|
|
39358
|
+
var isTargetPlainJs = ts.isPlainJsFile(targetSymbolFile, compilerOptions.checkJs);
|
|
39339
39359
|
var symbolName_1 = symbolToString(source);
|
|
39340
39360
|
if (sourceSymbolFile && targetSymbolFile && amalgamatedDuplicates && !isEitherEnum && sourceSymbolFile !== targetSymbolFile) {
|
|
39341
39361
|
var firstFile_1 = ts.comparePaths(sourceSymbolFile.path, targetSymbolFile.path) === -1 ? sourceSymbolFile : targetSymbolFile;
|
|
@@ -39346,12 +39366,16 @@ var ts;
|
|
|
39346
39366
|
var conflictingSymbolInfo = ts.getOrUpdate(filesDuplicates.conflictingSymbols, symbolName_1, function () {
|
|
39347
39367
|
return ({ isBlockScoped: isEitherBlockScoped_1, firstFileLocations: [], secondFileLocations: [] });
|
|
39348
39368
|
});
|
|
39349
|
-
|
|
39350
|
-
|
|
39369
|
+
if (!isSourcePlainJs)
|
|
39370
|
+
addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source);
|
|
39371
|
+
if (!isTargetPlainJs)
|
|
39372
|
+
addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target);
|
|
39351
39373
|
}
|
|
39352
39374
|
else {
|
|
39353
|
-
|
|
39354
|
-
|
|
39375
|
+
if (!isSourcePlainJs)
|
|
39376
|
+
addDuplicateDeclarationErrorsForSymbols(source, message, symbolName_1, target);
|
|
39377
|
+
if (!isTargetPlainJs)
|
|
39378
|
+
addDuplicateDeclarationErrorsForSymbols(target, message, symbolName_1, source);
|
|
39355
39379
|
}
|
|
39356
39380
|
}
|
|
39357
39381
|
return target;
|
|
@@ -39732,6 +39756,8 @@ var ts;
|
|
|
39732
39756
|
useResult = result.flags & 262144
|
|
39733
39757
|
? lastLocation === location.type ||
|
|
39734
39758
|
lastLocation.kind === 163 ||
|
|
39759
|
+
lastLocation.kind === 338 ||
|
|
39760
|
+
lastLocation.kind === 339 ||
|
|
39735
39761
|
lastLocation.kind === 162
|
|
39736
39762
|
: false;
|
|
39737
39763
|
}
|
|
@@ -39920,9 +39946,9 @@ var ts;
|
|
|
39920
39946
|
lastSelfReferenceLocation = location;
|
|
39921
39947
|
}
|
|
39922
39948
|
lastLocation = location;
|
|
39923
|
-
location = ts.isJSDocTemplateTag(location) ?
|
|
39924
|
-
ts.
|
|
39925
|
-
|
|
39949
|
+
location = ts.isJSDocTemplateTag(location) ? ts.getEffectiveContainerForJSDocTemplateTag(location) || location.parent :
|
|
39950
|
+
ts.isJSDocParameterTag(location) || ts.isJSDocReturnTag(location) ? ts.getHostSignatureFromJSDoc(location) || location.parent :
|
|
39951
|
+
location.parent;
|
|
39926
39952
|
}
|
|
39927
39953
|
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
|
|
39928
39954
|
result.isReferenced |= meaning;
|
|
@@ -40914,15 +40940,18 @@ var ts;
|
|
|
40914
40940
|
return;
|
|
40915
40941
|
}
|
|
40916
40942
|
var host = ts.getJSDocHost(node);
|
|
40917
|
-
if (host &&
|
|
40918
|
-
ts.isExpressionStatement(host) &&
|
|
40919
|
-
ts.isBinaryExpression(host.expression) &&
|
|
40920
|
-
ts.getAssignmentDeclarationKind(host.expression) === 3) {
|
|
40943
|
+
if (host && ts.isExpressionStatement(host) && ts.isPrototypePropertyAssignment(host.expression)) {
|
|
40921
40944
|
var symbol = getSymbolOfNode(host.expression.left);
|
|
40922
40945
|
if (symbol) {
|
|
40923
40946
|
return getDeclarationOfJSPrototypeContainer(symbol);
|
|
40924
40947
|
}
|
|
40925
40948
|
}
|
|
40949
|
+
if (host && ts.isFunctionExpression(host) && ts.isPrototypePropertyAssignment(host.parent) && ts.isExpressionStatement(host.parent.parent)) {
|
|
40950
|
+
var symbol = getSymbolOfNode(host.parent.left);
|
|
40951
|
+
if (symbol) {
|
|
40952
|
+
return getDeclarationOfJSPrototypeContainer(symbol);
|
|
40953
|
+
}
|
|
40954
|
+
}
|
|
40926
40955
|
if (host && (ts.isObjectLiteralMethod(host) || ts.isPropertyAssignment(host)) &&
|
|
40927
40956
|
ts.isBinaryExpression(host.parent.parent) &&
|
|
40928
40957
|
ts.getAssignmentDeclarationKind(host.parent.parent) === 6) {
|
|
@@ -41402,8 +41431,13 @@ var ts;
|
|
|
41402
41431
|
return res;
|
|
41403
41432
|
}
|
|
41404
41433
|
var candidates = ts.mapDefined(symbol.declarations, function (d) {
|
|
41405
|
-
if (!ts.isAmbientModule(d) && d.parent
|
|
41406
|
-
|
|
41434
|
+
if (!ts.isAmbientModule(d) && d.parent) {
|
|
41435
|
+
if (hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) {
|
|
41436
|
+
return getSymbolOfNode(d.parent);
|
|
41437
|
+
}
|
|
41438
|
+
if (ts.isModuleBlock(d.parent) && d.parent.parent && resolveExternalModuleSymbol(getSymbolOfNode(d.parent.parent)) === symbol) {
|
|
41439
|
+
return getSymbolOfNode(d.parent.parent);
|
|
41440
|
+
}
|
|
41407
41441
|
}
|
|
41408
41442
|
if (ts.isClassExpression(d) && ts.isBinaryExpression(d.parent) && d.parent.operatorToken.kind === 63 && ts.isAccessExpression(d.parent.left) && ts.isEntityNameExpression(d.parent.left.expression)) {
|
|
41409
41443
|
if (ts.isModuleExportsAccessExpression(d.parent.left) || ts.isExportsIdentifier(d.parent.left.expression)) {
|
|
@@ -44805,9 +44839,12 @@ var ts;
|
|
|
44805
44839
|
function isErrorType(type) {
|
|
44806
44840
|
return type === errorType || !!(type.flags & 1 && type.aliasSymbol);
|
|
44807
44841
|
}
|
|
44808
|
-
function getTypeForBindingElementParent(node) {
|
|
44842
|
+
function getTypeForBindingElementParent(node, checkMode) {
|
|
44843
|
+
if (checkMode !== 0) {
|
|
44844
|
+
return getTypeForVariableLikeDeclaration(node, false, checkMode);
|
|
44845
|
+
}
|
|
44809
44846
|
var symbol = getSymbolOfNode(node);
|
|
44810
|
-
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false);
|
|
44847
|
+
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false, checkMode);
|
|
44811
44848
|
}
|
|
44812
44849
|
function getRestType(source, properties, symbol) {
|
|
44813
44850
|
source = filterType(source, function (t) { return !(t.flags & 98304); });
|
|
@@ -44912,7 +44949,8 @@ var ts;
|
|
|
44912
44949
|
return type.flags & (128 | 256) ? "" + type.value : undefined;
|
|
44913
44950
|
}
|
|
44914
44951
|
function getTypeForBindingElement(declaration) {
|
|
44915
|
-
var
|
|
44952
|
+
var checkMode = declaration.dotDotDotToken ? 32 : 0;
|
|
44953
|
+
var parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
44916
44954
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
44917
44955
|
}
|
|
44918
44956
|
function getBindingElementTypeFromParentType(declaration, parentType) {
|
|
@@ -44972,9 +45010,9 @@ var ts;
|
|
|
44972
45010
|
return type;
|
|
44973
45011
|
}
|
|
44974
45012
|
if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
|
|
44975
|
-
return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration)) & 32768) ? getNonUndefinedType(type) : type;
|
|
45013
|
+
return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration, 0)) & 32768) ? getNonUndefinedType(type) : type;
|
|
44976
45014
|
}
|
|
44977
|
-
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration)], 2));
|
|
45015
|
+
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0)], 2));
|
|
44978
45016
|
}
|
|
44979
45017
|
function getTypeForDeclarationFromJSDocComment(declaration) {
|
|
44980
45018
|
var jsdocType = ts.getJSDocType(declaration);
|
|
@@ -44996,9 +45034,9 @@ var ts;
|
|
|
44996
45034
|
if (isOptional === void 0) { isOptional = true; }
|
|
44997
45035
|
return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type;
|
|
44998
45036
|
}
|
|
44999
|
-
function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
|
|
45037
|
+
function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) {
|
|
45000
45038
|
if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 242) {
|
|
45001
|
-
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
|
|
45039
|
+
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, checkMode)));
|
|
45002
45040
|
return indexType.flags & (262144 | 4194304) ? getExtractStringType(indexType) : stringType;
|
|
45003
45041
|
}
|
|
45004
45042
|
if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243) {
|
|
@@ -45041,12 +45079,9 @@ var ts;
|
|
|
45041
45079
|
}
|
|
45042
45080
|
}
|
|
45043
45081
|
if (ts.isInJSFile(declaration)) {
|
|
45044
|
-
var
|
|
45045
|
-
if (
|
|
45046
|
-
|
|
45047
|
-
var pos = func.parameters.indexOf(declaration);
|
|
45048
|
-
return declaration.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos);
|
|
45049
|
-
}
|
|
45082
|
+
var type_1 = getParameterTypeOfTypeTag(func, declaration);
|
|
45083
|
+
if (type_1)
|
|
45084
|
+
return type_1;
|
|
45050
45085
|
}
|
|
45051
45086
|
var type = declaration.symbol.escapedName === "this" ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
|
|
45052
45087
|
if (type) {
|
|
@@ -45060,7 +45095,7 @@ var ts;
|
|
|
45060
45095
|
return containerObjectType;
|
|
45061
45096
|
}
|
|
45062
45097
|
}
|
|
45063
|
-
var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration));
|
|
45098
|
+
var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration, checkMode));
|
|
45064
45099
|
return addOptionality(type, isProperty, isOptional);
|
|
45065
45100
|
}
|
|
45066
45101
|
if (ts.isPropertyDeclaration(declaration) && (noImplicitAny || ts.isInJSFile(declaration))) {
|
|
@@ -45393,7 +45428,7 @@ var ts;
|
|
|
45393
45428
|
function getTypeFromBindingElement(element, includePatternInType, reportErrors) {
|
|
45394
45429
|
if (element.initializer) {
|
|
45395
45430
|
var contextualType = ts.isBindingPattern(element.name) ? getTypeFromBindingPattern(element.name, true, false) : unknownType;
|
|
45396
|
-
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, contextualType)));
|
|
45431
|
+
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0, contextualType)));
|
|
45397
45432
|
}
|
|
45398
45433
|
if (ts.isBindingPattern(element.name)) {
|
|
45399
45434
|
return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors);
|
|
@@ -45459,7 +45494,7 @@ var ts;
|
|
|
45459
45494
|
: getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
|
|
45460
45495
|
}
|
|
45461
45496
|
function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) {
|
|
45462
|
-
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, true), declaration, reportErrors);
|
|
45497
|
+
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, true, 0), declaration, reportErrors);
|
|
45463
45498
|
}
|
|
45464
45499
|
function isGlobalSymbolConstructor(node) {
|
|
45465
45500
|
var symbol = getSymbolOfNode(node);
|
|
@@ -45538,8 +45573,8 @@ var ts;
|
|
|
45538
45573
|
if (typeNode === undefined) {
|
|
45539
45574
|
return useUnknownInCatchVariables ? unknownType : anyType;
|
|
45540
45575
|
}
|
|
45541
|
-
var
|
|
45542
|
-
return isTypeAny(
|
|
45576
|
+
var type_2 = getTypeOfNode(typeNode);
|
|
45577
|
+
return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType;
|
|
45543
45578
|
}
|
|
45544
45579
|
if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
|
|
45545
45580
|
if (!declaration.statements.length) {
|
|
@@ -45670,9 +45705,11 @@ var ts;
|
|
|
45670
45705
|
if (writing === void 0) { writing = false; }
|
|
45671
45706
|
var getter = ts.getDeclarationOfKind(symbol, 171);
|
|
45672
45707
|
var setter = ts.getDeclarationOfKind(symbol, 172);
|
|
45673
|
-
|
|
45674
|
-
|
|
45675
|
-
|
|
45708
|
+
if (writing) {
|
|
45709
|
+
var setterType_1 = getAnnotatedAccessorType(setter);
|
|
45710
|
+
if (setterType_1) {
|
|
45711
|
+
return instantiateTypeIfNeeded(setterType_1, symbol);
|
|
45712
|
+
}
|
|
45676
45713
|
}
|
|
45677
45714
|
if (getter && ts.isInJSFile(getter)) {
|
|
45678
45715
|
var jsDocType = getTypeForDeclarationFromJSDocComment(getter);
|
|
@@ -45684,6 +45721,7 @@ var ts;
|
|
|
45684
45721
|
if (getterType) {
|
|
45685
45722
|
return instantiateTypeIfNeeded(getterType, symbol);
|
|
45686
45723
|
}
|
|
45724
|
+
var setterType = getAnnotatedAccessorType(setter);
|
|
45687
45725
|
if (setterType) {
|
|
45688
45726
|
return setterType;
|
|
45689
45727
|
}
|
|
@@ -45751,11 +45789,11 @@ var ts;
|
|
|
45751
45789
|
return errorType;
|
|
45752
45790
|
}
|
|
45753
45791
|
var exportEquals = getMergedSymbol(symbol.exports.get("export="));
|
|
45754
|
-
var
|
|
45792
|
+
var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
|
|
45755
45793
|
if (!popTypeResolution()) {
|
|
45756
45794
|
return reportCircularityError(symbol);
|
|
45757
45795
|
}
|
|
45758
|
-
return
|
|
45796
|
+
return type_3;
|
|
45759
45797
|
}
|
|
45760
45798
|
}
|
|
45761
45799
|
var type = createObjectType(16, symbol);
|
|
@@ -47688,10 +47726,10 @@ var ts;
|
|
|
47688
47726
|
var baseTypes = [];
|
|
47689
47727
|
var different = false;
|
|
47690
47728
|
for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
|
|
47691
|
-
var
|
|
47692
|
-
var baseType = getBaseConstraint(
|
|
47729
|
+
var type_4 = types_7[_i];
|
|
47730
|
+
var baseType = getBaseConstraint(type_4);
|
|
47693
47731
|
if (baseType) {
|
|
47694
|
-
if (baseType !==
|
|
47732
|
+
if (baseType !== type_4) {
|
|
47695
47733
|
different = true;
|
|
47696
47734
|
}
|
|
47697
47735
|
baseTypes.push(baseType);
|
|
@@ -48301,6 +48339,13 @@ var ts;
|
|
|
48301
48339
|
var typeTag = ts.getJSDocTypeTag(node);
|
|
48302
48340
|
return (typeTag === null || typeTag === void 0 ? void 0 : typeTag.typeExpression) && getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression));
|
|
48303
48341
|
}
|
|
48342
|
+
function getParameterTypeOfTypeTag(func, parameter) {
|
|
48343
|
+
var signature = getSignatureOfTypeTag(func);
|
|
48344
|
+
if (!signature)
|
|
48345
|
+
return undefined;
|
|
48346
|
+
var pos = func.parameters.indexOf(parameter);
|
|
48347
|
+
return parameter.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos);
|
|
48348
|
+
}
|
|
48304
48349
|
function getReturnTypeOfTypeTag(node) {
|
|
48305
48350
|
var signature = getSignatureOfTypeTag(node);
|
|
48306
48351
|
return signature && getReturnTypeOfSignature(signature);
|
|
@@ -52562,9 +52607,9 @@ var ts;
|
|
|
52562
52607
|
isEnumTypeRelatedTo(getParentOfSymbol(source.symbol), getParentOfSymbol(target.symbol), errorReporter))
|
|
52563
52608
|
return true;
|
|
52564
52609
|
}
|
|
52565
|
-
if (s & 32768 && (!strictNullChecks || t & (32768 | 16384)))
|
|
52610
|
+
if (s & 32768 && (!strictNullChecks && !(t & 3145728) || t & (32768 | 16384)))
|
|
52566
52611
|
return true;
|
|
52567
|
-
if (s & 65536 && (!strictNullChecks || t & 65536))
|
|
52612
|
+
if (s & 65536 && (!strictNullChecks && !(t & 3145728) || t & 65536))
|
|
52568
52613
|
return true;
|
|
52569
52614
|
if (s & 524288 && t & 67108864)
|
|
52570
52615
|
return true;
|
|
@@ -53775,6 +53820,9 @@ var ts;
|
|
|
53775
53820
|
}
|
|
53776
53821
|
if (ts.getObjectFlags(source) & 4 && ts.getObjectFlags(target) & 4 && source.target === target.target &&
|
|
53777
53822
|
!isTupleType(source) && !(ts.getObjectFlags(source) & 4096 || ts.getObjectFlags(target) & 4096)) {
|
|
53823
|
+
if (isEmptyArrayLiteralType(source)) {
|
|
53824
|
+
return -1;
|
|
53825
|
+
}
|
|
53778
53826
|
var variances = getVariances(source.target);
|
|
53779
53827
|
if (variances === ts.emptyArray) {
|
|
53780
53828
|
return 1;
|
|
@@ -54010,6 +54058,10 @@ var ts;
|
|
|
54010
54058
|
}
|
|
54011
54059
|
return 0;
|
|
54012
54060
|
}
|
|
54061
|
+
if ((relation === subtypeRelation || relation === strictSubtypeRelation) &&
|
|
54062
|
+
!!(sourcePropFlags & 64) && !(targetPropFlags & 64)) {
|
|
54063
|
+
return 0;
|
|
54064
|
+
}
|
|
54013
54065
|
var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState);
|
|
54014
54066
|
if (!related) {
|
|
54015
54067
|
if (reportErrors) {
|
|
@@ -58415,16 +58467,18 @@ var ts;
|
|
|
58415
58467
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
58416
58468
|
return !!(type.flags & 465829888 && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304));
|
|
58417
58469
|
}
|
|
58418
|
-
function
|
|
58470
|
+
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
58419
58471
|
var contextualType = (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
|
|
58420
58472
|
!((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
|
|
58421
|
-
|
|
58473
|
+
(checkMode && checkMode & 32 ?
|
|
58474
|
+
getContextualType(node, 8)
|
|
58475
|
+
: getContextualType(node));
|
|
58422
58476
|
return contextualType && !isGenericType(contextualType);
|
|
58423
58477
|
}
|
|
58424
58478
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
58425
58479
|
var substituteConstraints = !(checkMode && checkMode & 2) &&
|
|
58426
58480
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
58427
|
-
(isConstraintPosition(type, reference) ||
|
|
58481
|
+
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
58428
58482
|
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t; }) : type;
|
|
58429
58483
|
}
|
|
58430
58484
|
function isExportOrExportExpression(location) {
|
|
@@ -58466,7 +58520,7 @@ var ts;
|
|
|
58466
58520
|
var links = getNodeLinks(location);
|
|
58467
58521
|
if (!(links.flags & 268435456)) {
|
|
58468
58522
|
links.flags |= 268435456;
|
|
58469
|
-
var parentType = getTypeForBindingElementParent(parent);
|
|
58523
|
+
var parentType = getTypeForBindingElementParent(parent, 0);
|
|
58470
58524
|
links.flags &= ~268435456;
|
|
58471
58525
|
if (parentType && parentType.flags & 1048576 && !(parent.kind === 163 && isSymbolAssigned(symbol))) {
|
|
58472
58526
|
var pattern = declaration.parent;
|
|
@@ -59137,7 +59191,7 @@ var ts;
|
|
|
59137
59191
|
var parent = declaration.parent.parent;
|
|
59138
59192
|
var name = declaration.propertyName || declaration.name;
|
|
59139
59193
|
var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
|
|
59140
|
-
parent.kind !== 202 && parent.initializer && checkDeclarationInitializer(parent);
|
|
59194
|
+
parent.kind !== 202 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 32 : 0);
|
|
59141
59195
|
if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
|
|
59142
59196
|
return undefined;
|
|
59143
59197
|
if (parent.name.kind === 201) {
|
|
@@ -63144,8 +63198,8 @@ var ts;
|
|
|
63144
63198
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
63145
63199
|
var synthType = type;
|
|
63146
63200
|
if (!synthType.defaultOnlyType) {
|
|
63147
|
-
var
|
|
63148
|
-
synthType.defaultOnlyType =
|
|
63201
|
+
var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
63202
|
+
synthType.defaultOnlyType = type_5;
|
|
63149
63203
|
}
|
|
63150
63204
|
return synthType.defaultOnlyType;
|
|
63151
63205
|
}
|
|
@@ -63811,11 +63865,11 @@ var ts;
|
|
|
63811
63865
|
var operandType = getTypeOfExpression(node.expression.expression);
|
|
63812
63866
|
var witnesses = getSwitchClauseTypeOfWitnesses(node, false);
|
|
63813
63867
|
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, true);
|
|
63814
|
-
var
|
|
63815
|
-
if (
|
|
63868
|
+
var type_6 = getBaseConstraintOfType(operandType) || operandType;
|
|
63869
|
+
if (type_6.flags & 3) {
|
|
63816
63870
|
return (556800 & notEqualFacts_1) === 556800;
|
|
63817
63871
|
}
|
|
63818
|
-
return !!(filterType(
|
|
63872
|
+
return !!(filterType(type_6, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072);
|
|
63819
63873
|
}
|
|
63820
63874
|
var type = getTypeOfExpression(node.expression);
|
|
63821
63875
|
if (!isLiteralType(type)) {
|
|
@@ -65106,11 +65160,11 @@ var ts;
|
|
|
65106
65160
|
}
|
|
65107
65161
|
}
|
|
65108
65162
|
function checkExpressionCached(node, checkMode) {
|
|
65163
|
+
if (checkMode && checkMode !== 0) {
|
|
65164
|
+
return checkExpression(node, checkMode);
|
|
65165
|
+
}
|
|
65109
65166
|
var links = getNodeLinks(node);
|
|
65110
65167
|
if (!links.resolvedType) {
|
|
65111
|
-
if (checkMode && checkMode !== 0) {
|
|
65112
|
-
return checkExpression(node, checkMode);
|
|
65113
|
-
}
|
|
65114
65168
|
var saveFlowLoopStart = flowLoopStart;
|
|
65115
65169
|
var saveFlowTypeCache = flowTypeCache;
|
|
65116
65170
|
flowLoopStart = flowLoopCount;
|
|
@@ -65127,10 +65181,12 @@ var ts;
|
|
|
65127
65181
|
node.kind === 228 ||
|
|
65128
65182
|
ts.isJSDocTypeAssertion(node);
|
|
65129
65183
|
}
|
|
65130
|
-
function checkDeclarationInitializer(declaration, contextualType) {
|
|
65184
|
+
function checkDeclarationInitializer(declaration, checkMode, contextualType) {
|
|
65131
65185
|
var initializer = ts.getEffectiveInitializer(declaration);
|
|
65132
65186
|
var type = getQuickTypeOfExpression(initializer) ||
|
|
65133
|
-
(contextualType ?
|
|
65187
|
+
(contextualType ?
|
|
65188
|
+
checkExpressionWithContextualType(initializer, contextualType, undefined, checkMode || 0)
|
|
65189
|
+
: checkExpressionCached(initializer, checkMode));
|
|
65134
65190
|
return ts.isParameter(declaration) && declaration.name.kind === 201 &&
|
|
65135
65191
|
isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ?
|
|
65136
65192
|
padTupleType(type, declaration.name) : type;
|
|
@@ -65698,6 +65754,7 @@ var ts;
|
|
|
65698
65754
|
}
|
|
65699
65755
|
}
|
|
65700
65756
|
checkTypeParameters(ts.getEffectiveTypeParameterDeclarations(node));
|
|
65757
|
+
checkUnmatchedJSDocParameters(node);
|
|
65701
65758
|
ts.forEach(node.parameters, checkParameter);
|
|
65702
65759
|
if (node.type) {
|
|
65703
65760
|
checkSourceElement(node.type);
|
|
@@ -66979,28 +67036,6 @@ var ts;
|
|
|
66979
67036
|
}
|
|
66980
67037
|
function checkJSDocParameterTag(node) {
|
|
66981
67038
|
checkSourceElement(node.typeExpression);
|
|
66982
|
-
if (!ts.getParameterSymbolFromJSDoc(node)) {
|
|
66983
|
-
var decl = ts.getHostSignatureFromJSDoc(node);
|
|
66984
|
-
if (decl) {
|
|
66985
|
-
var i = ts.getJSDocTags(decl).filter(ts.isJSDocParameterTag).indexOf(node);
|
|
66986
|
-
if (i > -1 && i < decl.parameters.length && ts.isBindingPattern(decl.parameters[i].name)) {
|
|
66987
|
-
return;
|
|
66988
|
-
}
|
|
66989
|
-
if (!containsArgumentsReference(decl)) {
|
|
66990
|
-
if (ts.isQualifiedName(node.name)) {
|
|
66991
|
-
error(node.name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(node.name), ts.entityNameToString(node.name.left));
|
|
66992
|
-
}
|
|
66993
|
-
else {
|
|
66994
|
-
error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(node.name));
|
|
66995
|
-
}
|
|
66996
|
-
}
|
|
66997
|
-
else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
|
|
66998
|
-
node.typeExpression && node.typeExpression.type &&
|
|
66999
|
-
!isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
|
|
67000
|
-
error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 160 ? node.name.right : node.name));
|
|
67001
|
-
}
|
|
67002
|
-
}
|
|
67003
|
-
}
|
|
67004
67039
|
}
|
|
67005
67040
|
function checkJSDocPropertyTag(node) {
|
|
67006
67041
|
checkSourceElement(node.typeExpression);
|
|
@@ -67601,7 +67636,8 @@ var ts;
|
|
|
67601
67636
|
checkComputedPropertyName(node.propertyName);
|
|
67602
67637
|
}
|
|
67603
67638
|
var parent = node.parent.parent;
|
|
67604
|
-
var
|
|
67639
|
+
var parentCheckMode = node.dotDotDotToken ? 32 : 0;
|
|
67640
|
+
var parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
67605
67641
|
var name = node.propertyName || node.name;
|
|
67606
67642
|
if (parentType && !ts.isBindingPattern(name)) {
|
|
67607
67643
|
var exprType = getLiteralTypeFromPropertyName(name);
|
|
@@ -68565,7 +68601,7 @@ var ts;
|
|
|
68565
68601
|
var declaration = catchClause.variableDeclaration;
|
|
68566
68602
|
var typeNode = ts.getEffectiveTypeAnnotationNode(ts.getRootDeclaration(declaration));
|
|
68567
68603
|
if (typeNode) {
|
|
68568
|
-
var type = getTypeForVariableLikeDeclaration(declaration, false);
|
|
68604
|
+
var type = getTypeForVariableLikeDeclaration(declaration, false, 0);
|
|
68569
68605
|
if (type && !(type.flags & 3)) {
|
|
68570
68606
|
grammarErrorOnFirstToken(typeNode, ts.Diagnostics.Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified);
|
|
68571
68607
|
}
|
|
@@ -68683,6 +68719,45 @@ var ts;
|
|
|
68683
68719
|
error(name, ts.Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ts.ModuleKind[moduleKind]);
|
|
68684
68720
|
}
|
|
68685
68721
|
}
|
|
68722
|
+
function checkUnmatchedJSDocParameters(node) {
|
|
68723
|
+
var jsdocParameters = ts.filter(ts.getJSDocTags(node), ts.isJSDocParameterTag);
|
|
68724
|
+
if (!ts.length(jsdocParameters))
|
|
68725
|
+
return;
|
|
68726
|
+
var isJs = ts.isInJSFile(node);
|
|
68727
|
+
var parameters = new ts.Set();
|
|
68728
|
+
var excludedParameters = new ts.Set();
|
|
68729
|
+
ts.forEach(node.parameters, function (_a, index) {
|
|
68730
|
+
var name = _a.name;
|
|
68731
|
+
if (ts.isIdentifier(name)) {
|
|
68732
|
+
parameters.add(name.escapedText);
|
|
68733
|
+
}
|
|
68734
|
+
if (ts.isBindingPattern(name)) {
|
|
68735
|
+
excludedParameters.add(index);
|
|
68736
|
+
}
|
|
68737
|
+
});
|
|
68738
|
+
var containsArguments = containsArgumentsReference(node);
|
|
68739
|
+
if (containsArguments) {
|
|
68740
|
+
var lastJSDocParam = ts.lastOrUndefined(jsdocParameters);
|
|
68741
|
+
if (lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
68742
|
+
lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
68743
|
+
errorOrSuggestion(isJs, lastJSDocParam.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(lastJSDocParam.name));
|
|
68744
|
+
}
|
|
68745
|
+
}
|
|
68746
|
+
else {
|
|
68747
|
+
ts.forEach(jsdocParameters, function (_a, index) {
|
|
68748
|
+
var name = _a.name;
|
|
68749
|
+
if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
|
|
68750
|
+
return;
|
|
68751
|
+
}
|
|
68752
|
+
if (ts.isQualifiedName(name)) {
|
|
68753
|
+
errorOrSuggestion(isJs, name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
|
|
68754
|
+
}
|
|
68755
|
+
else {
|
|
68756
|
+
errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
|
|
68757
|
+
}
|
|
68758
|
+
});
|
|
68759
|
+
}
|
|
68760
|
+
}
|
|
68686
68761
|
function checkTypeParameters(typeParameterDeclarations) {
|
|
68687
68762
|
if (typeParameterDeclarations) {
|
|
68688
68763
|
var seenDefault = false;
|
|
@@ -69559,7 +69634,7 @@ var ts;
|
|
|
69559
69634
|
var isAmbientExternalModule = ts.isAmbientModule(node);
|
|
69560
69635
|
var contextErrorMessage = isAmbientExternalModule
|
|
69561
69636
|
? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file
|
|
69562
|
-
: ts.Diagnostics.
|
|
69637
|
+
: ts.Diagnostics.A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module;
|
|
69563
69638
|
if (checkGrammarModuleElementContext(node, contextErrorMessage)) {
|
|
69564
69639
|
return;
|
|
69565
69640
|
}
|
|
@@ -69760,6 +69835,9 @@ var ts;
|
|
|
69760
69835
|
var name = ts.idText(node.kind === 269 ? node.propertyName || node.name : node.name);
|
|
69761
69836
|
addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name);
|
|
69762
69837
|
}
|
|
69838
|
+
if (isType && node.kind === 264 && ts.hasEffectiveModifier(node, 1)) {
|
|
69839
|
+
error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided);
|
|
69840
|
+
}
|
|
69763
69841
|
break;
|
|
69764
69842
|
}
|
|
69765
69843
|
case 274: {
|
|
@@ -69840,7 +69918,7 @@ var ts;
|
|
|
69840
69918
|
}
|
|
69841
69919
|
}
|
|
69842
69920
|
function checkImportDeclaration(node) {
|
|
69843
|
-
if (checkGrammarModuleElementContext(node, ts.Diagnostics.
|
|
69921
|
+
if (checkGrammarModuleElementContext(node, ts.isInJSFile(node) ? ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
69844
69922
|
return;
|
|
69845
69923
|
}
|
|
69846
69924
|
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasEffectiveModifiers(node)) {
|
|
@@ -69871,7 +69949,7 @@ var ts;
|
|
|
69871
69949
|
checkAssertClause(node);
|
|
69872
69950
|
}
|
|
69873
69951
|
function checkImportEqualsDeclaration(node) {
|
|
69874
|
-
if (checkGrammarModuleElementContext(node, ts.Diagnostics.
|
|
69952
|
+
if (checkGrammarModuleElementContext(node, ts.isInJSFile(node) ? ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
69875
69953
|
return;
|
|
69876
69954
|
}
|
|
69877
69955
|
checkGrammarDecoratorsAndModifiers(node);
|
|
@@ -69905,7 +69983,7 @@ var ts;
|
|
|
69905
69983
|
}
|
|
69906
69984
|
}
|
|
69907
69985
|
function checkExportDeclaration(node) {
|
|
69908
|
-
if (checkGrammarModuleElementContext(node, ts.Diagnostics.
|
|
69986
|
+
if (checkGrammarModuleElementContext(node, ts.isInJSFile(node) ? ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module : ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
69909
69987
|
return;
|
|
69910
69988
|
}
|
|
69911
69989
|
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasEffectiveModifiers(node)) {
|
|
@@ -71023,7 +71101,7 @@ var ts;
|
|
|
71023
71101
|
return errorType;
|
|
71024
71102
|
}
|
|
71025
71103
|
if (ts.isBindingPattern(node)) {
|
|
71026
|
-
return getTypeForVariableLikeDeclaration(node.parent, true) || errorType;
|
|
71104
|
+
return getTypeForVariableLikeDeclaration(node.parent, true, 0) || errorType;
|
|
71027
71105
|
}
|
|
71028
71106
|
if (isInRightSideOfImportOrExportAssignment(node)) {
|
|
71029
71107
|
var symbol = getSymbolAtLocation(node);
|
|
@@ -94349,9 +94427,9 @@ var ts;
|
|
|
94349
94427
|
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
94350
94428
|
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
94351
94429
|
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
94352
|
-
ts.Diagnostics.
|
|
94430
|
+
ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
|
|
94353
94431
|
ts.Diagnostics.An_export_declaration_cannot_have_modifiers.code,
|
|
94354
|
-
ts.Diagnostics.
|
|
94432
|
+
ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
|
|
94355
94433
|
ts.Diagnostics.An_import_declaration_cannot_have_modifiers.code,
|
|
94356
94434
|
ts.Diagnostics.An_object_member_cannot_be_declared_optional.code,
|
|
94357
94435
|
ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
|
|
@@ -95249,7 +95327,7 @@ var ts;
|
|
|
95249
95327
|
ts.Debug.assert(!!sourceFile.bindDiagnostics);
|
|
95250
95328
|
var isJs = sourceFile.scriptKind === 1 || sourceFile.scriptKind === 2;
|
|
95251
95329
|
var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
|
|
95252
|
-
var isPlainJs =
|
|
95330
|
+
var isPlainJs = ts.isPlainJsFile(sourceFile, options.checkJs);
|
|
95253
95331
|
var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
|
|
95254
95332
|
var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 || sourceFile.scriptKind === 4
|
|
95255
95333
|
|| sourceFile.scriptKind === 5 || isPlainJs || isCheckJs || sourceFile.scriptKind === 7);
|