@typescript-deploys/pr-build 4.6.0-pr-47717-6 → 4.6.0-pr-45974-9
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 +1 -2
- package/lib/de/diagnosticMessages.generated.json +6 -5
- package/lib/es/diagnosticMessages.generated.json +6 -5
- package/lib/fr/diagnosticMessages.generated.json +1 -2
- package/lib/it/diagnosticMessages.generated.json +1 -2
- package/lib/ja/diagnosticMessages.generated.json +6 -5
- package/lib/ko/diagnosticMessages.generated.json +6 -5
- package/lib/pl/diagnosticMessages.generated.json +1 -2
- package/lib/pt-br/diagnosticMessages.generated.json +6 -5
- package/lib/ru/diagnosticMessages.generated.json +6 -5
- package/lib/tr/diagnosticMessages.generated.json +6 -5
- package/lib/tsc.js +254 -124
- package/lib/tsserver.js +599 -215
- package/lib/tsserverlibrary.js +599 -215
- package/lib/typescript.js +596 -213
- package/lib/typescriptServices.js +596 -213
- package/lib/typingsInstaller.js +275 -129
- package/lib/zh-cn/diagnosticMessages.generated.json +6 -5
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -2
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.6";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220211";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -1087,11 +1087,11 @@ var ts;
|
|
|
1087
1087
|
return result;
|
|
1088
1088
|
}
|
|
1089
1089
|
ts.getAllKeys = getAllKeys;
|
|
1090
|
-
function getOwnValues(
|
|
1090
|
+
function getOwnValues(collection) {
|
|
1091
1091
|
var values = [];
|
|
1092
|
-
for (var key in
|
|
1093
|
-
if (hasOwnProperty.call(
|
|
1094
|
-
values.push(
|
|
1092
|
+
for (var key in collection) {
|
|
1093
|
+
if (hasOwnProperty.call(collection, key)) {
|
|
1094
|
+
values.push(collection[key]);
|
|
1095
1095
|
}
|
|
1096
1096
|
}
|
|
1097
1097
|
return values;
|
|
@@ -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),
|
|
@@ -6849,6 +6840,10 @@ var ts;
|
|
|
6849
6840
|
Add_missing_attributes: diag(95167, ts.DiagnosticCategory.Message, "Add_missing_attributes_95167", "Add missing attributes"),
|
|
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"),
|
|
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}'"),
|
|
6852
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."),
|
|
6853
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'."),
|
|
6854
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?"),
|
|
@@ -10515,6 +10510,10 @@ var ts;
|
|
|
10515
10510
|
return undefined;
|
|
10516
10511
|
}
|
|
10517
10512
|
ts.getDeclarationOfKind = getDeclarationOfKind;
|
|
10513
|
+
function getDeclarationsOfKind(symbol, kind) {
|
|
10514
|
+
return ts.filter(symbol.declarations || ts.emptyArray, function (d) { return d.kind === kind; });
|
|
10515
|
+
}
|
|
10516
|
+
ts.getDeclarationsOfKind = getDeclarationsOfKind;
|
|
10518
10517
|
function createSymbolTable(symbols) {
|
|
10519
10518
|
var result = new ts.Map();
|
|
10520
10519
|
if (symbols) {
|
|
@@ -10734,6 +10733,10 @@ var ts;
|
|
|
10734
10733
|
return getSourceFileOfNode(module.valueDeclaration || getNonAugmentationDeclaration(module));
|
|
10735
10734
|
}
|
|
10736
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;
|
|
10737
10740
|
function isStatementWithLocals(node) {
|
|
10738
10741
|
switch (node.kind) {
|
|
10739
10742
|
case 234:
|
|
@@ -34019,7 +34022,7 @@ var ts;
|
|
|
34019
34022
|
result_4 = searchResult && searchResult.value;
|
|
34020
34023
|
}
|
|
34021
34024
|
else {
|
|
34022
|
-
var candidate =
|
|
34025
|
+
var candidate = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName).path;
|
|
34023
34026
|
result_4 = nodeLoadModuleByRelativeName(Extensions.DtsOnly, candidate, false, moduleResolutionState, true);
|
|
34024
34027
|
}
|
|
34025
34028
|
return resolvedTypeScriptOnly(result_4);
|
|
@@ -34595,12 +34598,19 @@ var ts;
|
|
|
34595
34598
|
return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
|
|
34596
34599
|
}
|
|
34597
34600
|
else {
|
|
34598
|
-
var _a =
|
|
34601
|
+
var _a = normalizePathForCJSResolution(containingDirectory, moduleName), candidate = _a.path, parts = _a.parts;
|
|
34599
34602
|
var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, false, state, true);
|
|
34600
34603
|
return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: ts.contains(parts, "node_modules") });
|
|
34601
34604
|
}
|
|
34602
34605
|
}
|
|
34603
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
|
+
}
|
|
34604
34614
|
function realPath(path, host, traceEnabled) {
|
|
34605
34615
|
if (!host.realpath) {
|
|
34606
34616
|
return path;
|
|
@@ -36103,7 +36113,7 @@ var ts;
|
|
|
36103
36113
|
return ts.isDottedName(expr)
|
|
36104
36114
|
|| (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
|
|
36105
36115
|
|| ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 && isNarrowableReference(expr.right)
|
|
36106
|
-
|| ts.isElementAccessExpression(expr) && ts.isStringOrNumericLiteralLike(expr.argumentExpression) && isNarrowableReference(expr.expression)
|
|
36116
|
+
|| ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isIdentifier(expr.argumentExpression)) && isNarrowableReference(expr.expression)
|
|
36107
36117
|
|| ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
|
|
36108
36118
|
}
|
|
36109
36119
|
function containsNarrowableReference(expr) {
|
|
@@ -39324,13 +39334,13 @@ var ts;
|
|
|
39324
39334
|
else {
|
|
39325
39335
|
var isEitherEnum = !!(target.flags & 384 || source.flags & 384);
|
|
39326
39336
|
var isEitherBlockScoped_1 = !!(target.flags & 2 || source.flags & 2);
|
|
39327
|
-
var message = isEitherEnum
|
|
39328
|
-
? ts.Diagnostics.
|
|
39329
|
-
: isEitherBlockScoped_1
|
|
39330
|
-
? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0
|
|
39337
|
+
var message = isEitherEnum ? ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations
|
|
39338
|
+
: isEitherBlockScoped_1 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0
|
|
39331
39339
|
: ts.Diagnostics.Duplicate_identifier_0;
|
|
39332
39340
|
var sourceSymbolFile = source.declarations && ts.getSourceFileOfNode(source.declarations[0]);
|
|
39333
39341
|
var targetSymbolFile = target.declarations && ts.getSourceFileOfNode(target.declarations[0]);
|
|
39342
|
+
var isSourcePlainJs = ts.isPlainJsFile(sourceSymbolFile, compilerOptions.checkJs);
|
|
39343
|
+
var isTargetPlainJs = ts.isPlainJsFile(targetSymbolFile, compilerOptions.checkJs);
|
|
39334
39344
|
var symbolName_1 = symbolToString(source);
|
|
39335
39345
|
if (sourceSymbolFile && targetSymbolFile && amalgamatedDuplicates && !isEitherEnum && sourceSymbolFile !== targetSymbolFile) {
|
|
39336
39346
|
var firstFile_1 = ts.comparePaths(sourceSymbolFile.path, targetSymbolFile.path) === -1 ? sourceSymbolFile : targetSymbolFile;
|
|
@@ -39341,12 +39351,16 @@ var ts;
|
|
|
39341
39351
|
var conflictingSymbolInfo = ts.getOrUpdate(filesDuplicates.conflictingSymbols, symbolName_1, function () {
|
|
39342
39352
|
return ({ isBlockScoped: isEitherBlockScoped_1, firstFileLocations: [], secondFileLocations: [] });
|
|
39343
39353
|
});
|
|
39344
|
-
|
|
39345
|
-
|
|
39354
|
+
if (!isSourcePlainJs)
|
|
39355
|
+
addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source);
|
|
39356
|
+
if (!isTargetPlainJs)
|
|
39357
|
+
addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target);
|
|
39346
39358
|
}
|
|
39347
39359
|
else {
|
|
39348
|
-
|
|
39349
|
-
|
|
39360
|
+
if (!isSourcePlainJs)
|
|
39361
|
+
addDuplicateDeclarationErrorsForSymbols(source, message, symbolName_1, target);
|
|
39362
|
+
if (!isTargetPlainJs)
|
|
39363
|
+
addDuplicateDeclarationErrorsForSymbols(target, message, symbolName_1, source);
|
|
39350
39364
|
}
|
|
39351
39365
|
}
|
|
39352
39366
|
return target;
|
|
@@ -39727,6 +39741,8 @@ var ts;
|
|
|
39727
39741
|
useResult = result.flags & 262144
|
|
39728
39742
|
? lastLocation === location.type ||
|
|
39729
39743
|
lastLocation.kind === 163 ||
|
|
39744
|
+
lastLocation.kind === 338 ||
|
|
39745
|
+
lastLocation.kind === 339 ||
|
|
39730
39746
|
lastLocation.kind === 162
|
|
39731
39747
|
: false;
|
|
39732
39748
|
}
|
|
@@ -39915,9 +39931,9 @@ var ts;
|
|
|
39915
39931
|
lastSelfReferenceLocation = location;
|
|
39916
39932
|
}
|
|
39917
39933
|
lastLocation = location;
|
|
39918
|
-
location = ts.isJSDocTemplateTag(location) ?
|
|
39919
|
-
ts.
|
|
39920
|
-
|
|
39934
|
+
location = ts.isJSDocTemplateTag(location) ? ts.getEffectiveContainerForJSDocTemplateTag(location) || location.parent :
|
|
39935
|
+
ts.isJSDocParameterTag(location) || ts.isJSDocReturnTag(location) ? ts.getHostSignatureFromJSDoc(location) || location.parent :
|
|
39936
|
+
location.parent;
|
|
39921
39937
|
}
|
|
39922
39938
|
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
|
|
39923
39939
|
result.isReferenced |= meaning;
|
|
@@ -40909,15 +40925,18 @@ var ts;
|
|
|
40909
40925
|
return;
|
|
40910
40926
|
}
|
|
40911
40927
|
var host = ts.getJSDocHost(node);
|
|
40912
|
-
if (host &&
|
|
40913
|
-
ts.isExpressionStatement(host) &&
|
|
40914
|
-
ts.isBinaryExpression(host.expression) &&
|
|
40915
|
-
ts.getAssignmentDeclarationKind(host.expression) === 3) {
|
|
40928
|
+
if (host && ts.isExpressionStatement(host) && ts.isPrototypePropertyAssignment(host.expression)) {
|
|
40916
40929
|
var symbol = getSymbolOfNode(host.expression.left);
|
|
40917
40930
|
if (symbol) {
|
|
40918
40931
|
return getDeclarationOfJSPrototypeContainer(symbol);
|
|
40919
40932
|
}
|
|
40920
40933
|
}
|
|
40934
|
+
if (host && ts.isFunctionExpression(host) && ts.isPrototypePropertyAssignment(host.parent) && ts.isExpressionStatement(host.parent.parent)) {
|
|
40935
|
+
var symbol = getSymbolOfNode(host.parent.left);
|
|
40936
|
+
if (symbol) {
|
|
40937
|
+
return getDeclarationOfJSPrototypeContainer(symbol);
|
|
40938
|
+
}
|
|
40939
|
+
}
|
|
40921
40940
|
if (host && (ts.isObjectLiteralMethod(host) || ts.isPropertyAssignment(host)) &&
|
|
40922
40941
|
ts.isBinaryExpression(host.parent.parent) &&
|
|
40923
40942
|
ts.getAssignmentDeclarationKind(host.parent.parent) === 6) {
|
|
@@ -44800,9 +44819,12 @@ var ts;
|
|
|
44800
44819
|
function isErrorType(type) {
|
|
44801
44820
|
return type === errorType || !!(type.flags & 1 && type.aliasSymbol);
|
|
44802
44821
|
}
|
|
44803
|
-
function getTypeForBindingElementParent(node) {
|
|
44822
|
+
function getTypeForBindingElementParent(node, checkMode) {
|
|
44823
|
+
if (checkMode !== 0) {
|
|
44824
|
+
return getTypeForVariableLikeDeclaration(node, false, checkMode);
|
|
44825
|
+
}
|
|
44804
44826
|
var symbol = getSymbolOfNode(node);
|
|
44805
|
-
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false);
|
|
44827
|
+
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false, checkMode);
|
|
44806
44828
|
}
|
|
44807
44829
|
function getRestType(source, properties, symbol) {
|
|
44808
44830
|
source = filterType(source, function (t) { return !(t.flags & 98304); });
|
|
@@ -44907,7 +44929,8 @@ var ts;
|
|
|
44907
44929
|
return type.flags & (128 | 256) ? "" + type.value : undefined;
|
|
44908
44930
|
}
|
|
44909
44931
|
function getTypeForBindingElement(declaration) {
|
|
44910
|
-
var
|
|
44932
|
+
var checkMode = declaration.dotDotDotToken ? 32 : 0;
|
|
44933
|
+
var parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
44911
44934
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
44912
44935
|
}
|
|
44913
44936
|
function getBindingElementTypeFromParentType(declaration, parentType) {
|
|
@@ -44967,9 +44990,9 @@ var ts;
|
|
|
44967
44990
|
return type;
|
|
44968
44991
|
}
|
|
44969
44992
|
if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
|
|
44970
|
-
return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration)) & 32768) ? getNonUndefinedType(type) : type;
|
|
44993
|
+
return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration, 0)) & 32768) ? getNonUndefinedType(type) : type;
|
|
44971
44994
|
}
|
|
44972
|
-
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration)], 2));
|
|
44995
|
+
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0)], 2));
|
|
44973
44996
|
}
|
|
44974
44997
|
function getTypeForDeclarationFromJSDocComment(declaration) {
|
|
44975
44998
|
var jsdocType = ts.getJSDocType(declaration);
|
|
@@ -44991,9 +45014,9 @@ var ts;
|
|
|
44991
45014
|
if (isOptional === void 0) { isOptional = true; }
|
|
44992
45015
|
return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type;
|
|
44993
45016
|
}
|
|
44994
|
-
function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
|
|
45017
|
+
function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) {
|
|
44995
45018
|
if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 242) {
|
|
44996
|
-
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
|
|
45019
|
+
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, checkMode)));
|
|
44997
45020
|
return indexType.flags & (262144 | 4194304) ? getExtractStringType(indexType) : stringType;
|
|
44998
45021
|
}
|
|
44999
45022
|
if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243) {
|
|
@@ -45036,12 +45059,9 @@ var ts;
|
|
|
45036
45059
|
}
|
|
45037
45060
|
}
|
|
45038
45061
|
if (ts.isInJSFile(declaration)) {
|
|
45039
|
-
var
|
|
45040
|
-
if (
|
|
45041
|
-
|
|
45042
|
-
var pos = func.parameters.indexOf(declaration);
|
|
45043
|
-
return declaration.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos);
|
|
45044
|
-
}
|
|
45062
|
+
var type_1 = getParameterTypeOfTypeTag(func, declaration);
|
|
45063
|
+
if (type_1)
|
|
45064
|
+
return type_1;
|
|
45045
45065
|
}
|
|
45046
45066
|
var type = declaration.symbol.escapedName === "this" ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
|
|
45047
45067
|
if (type) {
|
|
@@ -45055,7 +45075,7 @@ var ts;
|
|
|
45055
45075
|
return containerObjectType;
|
|
45056
45076
|
}
|
|
45057
45077
|
}
|
|
45058
|
-
var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration));
|
|
45078
|
+
var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration, checkMode));
|
|
45059
45079
|
return addOptionality(type, isProperty, isOptional);
|
|
45060
45080
|
}
|
|
45061
45081
|
if (ts.isPropertyDeclaration(declaration) && (noImplicitAny || ts.isInJSFile(declaration))) {
|
|
@@ -45388,7 +45408,7 @@ var ts;
|
|
|
45388
45408
|
function getTypeFromBindingElement(element, includePatternInType, reportErrors) {
|
|
45389
45409
|
if (element.initializer) {
|
|
45390
45410
|
var contextualType = ts.isBindingPattern(element.name) ? getTypeFromBindingPattern(element.name, true, false) : unknownType;
|
|
45391
|
-
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, contextualType)));
|
|
45411
|
+
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0, contextualType)));
|
|
45392
45412
|
}
|
|
45393
45413
|
if (ts.isBindingPattern(element.name)) {
|
|
45394
45414
|
return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors);
|
|
@@ -45454,7 +45474,7 @@ var ts;
|
|
|
45454
45474
|
: getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
|
|
45455
45475
|
}
|
|
45456
45476
|
function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) {
|
|
45457
|
-
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, true), declaration, reportErrors);
|
|
45477
|
+
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, true, 0), declaration, reportErrors);
|
|
45458
45478
|
}
|
|
45459
45479
|
function isGlobalSymbolConstructor(node) {
|
|
45460
45480
|
var symbol = getSymbolOfNode(node);
|
|
@@ -45533,8 +45553,8 @@ var ts;
|
|
|
45533
45553
|
if (typeNode === undefined) {
|
|
45534
45554
|
return useUnknownInCatchVariables ? unknownType : anyType;
|
|
45535
45555
|
}
|
|
45536
|
-
var
|
|
45537
|
-
return isTypeAny(
|
|
45556
|
+
var type_2 = getTypeOfNode(typeNode);
|
|
45557
|
+
return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType;
|
|
45538
45558
|
}
|
|
45539
45559
|
if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
|
|
45540
45560
|
if (!declaration.statements.length) {
|
|
@@ -45665,9 +45685,11 @@ var ts;
|
|
|
45665
45685
|
if (writing === void 0) { writing = false; }
|
|
45666
45686
|
var getter = ts.getDeclarationOfKind(symbol, 171);
|
|
45667
45687
|
var setter = ts.getDeclarationOfKind(symbol, 172);
|
|
45668
|
-
|
|
45669
|
-
|
|
45670
|
-
|
|
45688
|
+
if (writing) {
|
|
45689
|
+
var setterType_1 = getAnnotatedAccessorType(setter);
|
|
45690
|
+
if (setterType_1) {
|
|
45691
|
+
return instantiateTypeIfNeeded(setterType_1, symbol);
|
|
45692
|
+
}
|
|
45671
45693
|
}
|
|
45672
45694
|
if (getter && ts.isInJSFile(getter)) {
|
|
45673
45695
|
var jsDocType = getTypeForDeclarationFromJSDocComment(getter);
|
|
@@ -45679,6 +45701,7 @@ var ts;
|
|
|
45679
45701
|
if (getterType) {
|
|
45680
45702
|
return instantiateTypeIfNeeded(getterType, symbol);
|
|
45681
45703
|
}
|
|
45704
|
+
var setterType = getAnnotatedAccessorType(setter);
|
|
45682
45705
|
if (setterType) {
|
|
45683
45706
|
return setterType;
|
|
45684
45707
|
}
|
|
@@ -45746,11 +45769,11 @@ var ts;
|
|
|
45746
45769
|
return errorType;
|
|
45747
45770
|
}
|
|
45748
45771
|
var exportEquals = getMergedSymbol(symbol.exports.get("export="));
|
|
45749
|
-
var
|
|
45772
|
+
var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
|
|
45750
45773
|
if (!popTypeResolution()) {
|
|
45751
45774
|
return reportCircularityError(symbol);
|
|
45752
45775
|
}
|
|
45753
|
-
return
|
|
45776
|
+
return type_3;
|
|
45754
45777
|
}
|
|
45755
45778
|
}
|
|
45756
45779
|
var type = createObjectType(16, symbol);
|
|
@@ -45814,6 +45837,31 @@ var ts;
|
|
|
45814
45837
|
}
|
|
45815
45838
|
return links.type;
|
|
45816
45839
|
}
|
|
45840
|
+
function getWriteTypeOfSymbolWithDeferredType(symbol) {
|
|
45841
|
+
var links = getSymbolLinks(symbol);
|
|
45842
|
+
if (!links.writeType && links.deferralWriteConstituents) {
|
|
45843
|
+
ts.Debug.assertIsDefined(links.deferralParent);
|
|
45844
|
+
ts.Debug.assertIsDefined(links.deferralConstituents);
|
|
45845
|
+
links.writeType = links.deferralParent.flags & 1048576 ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);
|
|
45846
|
+
}
|
|
45847
|
+
return links.writeType;
|
|
45848
|
+
}
|
|
45849
|
+
function getWriteTypeOfSymbol(symbol) {
|
|
45850
|
+
var checkFlags = ts.getCheckFlags(symbol);
|
|
45851
|
+
if (checkFlags & 65536) {
|
|
45852
|
+
var writeType = getWriteTypeOfSymbolWithDeferredType(symbol);
|
|
45853
|
+
if (writeType) {
|
|
45854
|
+
return writeType;
|
|
45855
|
+
}
|
|
45856
|
+
}
|
|
45857
|
+
if (symbol.flags & 33554432) {
|
|
45858
|
+
var writeType = symbol.writeType;
|
|
45859
|
+
if (writeType) {
|
|
45860
|
+
return writeType;
|
|
45861
|
+
}
|
|
45862
|
+
}
|
|
45863
|
+
return getSetAccessorTypeOfSymbol(symbol);
|
|
45864
|
+
}
|
|
45817
45865
|
function getSetAccessorTypeOfSymbol(symbol) {
|
|
45818
45866
|
if (symbol.flags & 98304) {
|
|
45819
45867
|
var type = getTypeOfSetAccessor(symbol);
|
|
@@ -47658,10 +47706,10 @@ var ts;
|
|
|
47658
47706
|
var baseTypes = [];
|
|
47659
47707
|
var different = false;
|
|
47660
47708
|
for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
|
|
47661
|
-
var
|
|
47662
|
-
var baseType = getBaseConstraint(
|
|
47709
|
+
var type_4 = types_7[_i];
|
|
47710
|
+
var baseType = getBaseConstraint(type_4);
|
|
47663
47711
|
if (baseType) {
|
|
47664
|
-
if (baseType !==
|
|
47712
|
+
if (baseType !== type_4) {
|
|
47665
47713
|
different = true;
|
|
47666
47714
|
}
|
|
47667
47715
|
baseTypes.push(baseType);
|
|
@@ -47867,6 +47915,7 @@ var ts;
|
|
|
47867
47915
|
var firstType;
|
|
47868
47916
|
var nameType;
|
|
47869
47917
|
var propTypes = [];
|
|
47918
|
+
var writeTypes;
|
|
47870
47919
|
var firstValueDeclaration;
|
|
47871
47920
|
var hasNonUniformValueDeclaration = false;
|
|
47872
47921
|
for (var _d = 0, props_1 = props; _d < props_1.length; _d++) {
|
|
@@ -47883,6 +47932,10 @@ var ts;
|
|
|
47883
47932
|
firstType = type;
|
|
47884
47933
|
nameType = getSymbolLinks(prop).nameType;
|
|
47885
47934
|
}
|
|
47935
|
+
var writeType = getWriteTypeOfSymbol(prop);
|
|
47936
|
+
if (writeTypes || writeType !== type) {
|
|
47937
|
+
writeTypes = ts.append(!writeTypes ? propTypes.slice() : writeTypes, writeType);
|
|
47938
|
+
}
|
|
47886
47939
|
else if (type !== firstType) {
|
|
47887
47940
|
checkFlags |= 64;
|
|
47888
47941
|
}
|
|
@@ -47909,9 +47962,13 @@ var ts;
|
|
|
47909
47962
|
result.checkFlags |= 65536;
|
|
47910
47963
|
result.deferralParent = containingType;
|
|
47911
47964
|
result.deferralConstituents = propTypes;
|
|
47965
|
+
result.deferralWriteConstituents = writeTypes;
|
|
47912
47966
|
}
|
|
47913
47967
|
else {
|
|
47914
47968
|
result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
|
|
47969
|
+
if (writeTypes) {
|
|
47970
|
+
result.writeType = isUnion ? getUnionType(writeTypes) : getIntersectionType(writeTypes);
|
|
47971
|
+
}
|
|
47915
47972
|
}
|
|
47916
47973
|
return result;
|
|
47917
47974
|
}
|
|
@@ -48262,6 +48319,13 @@ var ts;
|
|
|
48262
48319
|
var typeTag = ts.getJSDocTypeTag(node);
|
|
48263
48320
|
return (typeTag === null || typeTag === void 0 ? void 0 : typeTag.typeExpression) && getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression));
|
|
48264
48321
|
}
|
|
48322
|
+
function getParameterTypeOfTypeTag(func, parameter) {
|
|
48323
|
+
var signature = getSignatureOfTypeTag(func);
|
|
48324
|
+
if (!signature)
|
|
48325
|
+
return undefined;
|
|
48326
|
+
var pos = func.parameters.indexOf(parameter);
|
|
48327
|
+
return parameter.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos);
|
|
48328
|
+
}
|
|
48265
48329
|
function getReturnTypeOfTypeTag(node) {
|
|
48266
48330
|
var signature = getSignatureOfTypeTag(node);
|
|
48267
48331
|
return signature && getReturnTypeOfSignature(signature);
|
|
@@ -48919,7 +48983,7 @@ var ts;
|
|
|
48919
48983
|
}
|
|
48920
48984
|
function getImpliedConstraint(type, checkNode, extendsNode) {
|
|
48921
48985
|
return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) :
|
|
48922
|
-
getActualTypeVariable(getTypeFromTypeNode(checkNode)) === type ? getTypeFromTypeNode(extendsNode) :
|
|
48986
|
+
getActualTypeVariable(getTypeFromTypeNode(checkNode)) === getActualTypeVariable(type) ? getTypeFromTypeNode(extendsNode) :
|
|
48923
48987
|
undefined;
|
|
48924
48988
|
}
|
|
48925
48989
|
function getConditionalFlowTypeOfType(type, node) {
|
|
@@ -49346,7 +49410,7 @@ var ts;
|
|
|
49346
49410
|
}
|
|
49347
49411
|
}
|
|
49348
49412
|
var fixedLength = properties.length;
|
|
49349
|
-
var lengthSymbol = createSymbol(4, "length"
|
|
49413
|
+
var lengthSymbol = createSymbol(4, "length");
|
|
49350
49414
|
if (combinedFlags & 12) {
|
|
49351
49415
|
lengthSymbol.type = numberType;
|
|
49352
49416
|
}
|
|
@@ -56498,8 +56562,9 @@ var ts;
|
|
|
56498
56562
|
return isMatchingReference(source.expression, target);
|
|
56499
56563
|
case 205:
|
|
56500
56564
|
case 206:
|
|
56501
|
-
|
|
56502
|
-
|
|
56565
|
+
var sourcePropertyName = getAccessedPropertyName(source);
|
|
56566
|
+
var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined;
|
|
56567
|
+
return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName &&
|
|
56503
56568
|
isMatchingReference(source.expression, target.expression);
|
|
56504
56569
|
case 160:
|
|
56505
56570
|
return ts.isAccessExpression(target) &&
|
|
@@ -56511,12 +56576,49 @@ var ts;
|
|
|
56511
56576
|
return false;
|
|
56512
56577
|
}
|
|
56513
56578
|
function getAccessedPropertyName(access) {
|
|
56514
|
-
|
|
56515
|
-
|
|
56516
|
-
|
|
56517
|
-
|
|
56518
|
-
|
|
56519
|
-
|
|
56579
|
+
if (ts.isPropertyAccessExpression(access)) {
|
|
56580
|
+
return access.name.escapedText;
|
|
56581
|
+
}
|
|
56582
|
+
if (ts.isElementAccessExpression(access)) {
|
|
56583
|
+
return tryGetElementAccessExpressionName(access);
|
|
56584
|
+
}
|
|
56585
|
+
if (ts.isBindingElement(access)) {
|
|
56586
|
+
var name = getDestructuringPropertyName(access);
|
|
56587
|
+
return name ? ts.escapeLeadingUnderscores(name) : undefined;
|
|
56588
|
+
}
|
|
56589
|
+
if (ts.isParameter(access)) {
|
|
56590
|
+
return ("" + access.parent.parameters.indexOf(access));
|
|
56591
|
+
}
|
|
56592
|
+
return undefined;
|
|
56593
|
+
}
|
|
56594
|
+
function tryGetNameFromType(type) {
|
|
56595
|
+
return type.flags & 8192 ? type.escapedName :
|
|
56596
|
+
type.flags & 384 ? ts.escapeLeadingUnderscores("" + type.value) : undefined;
|
|
56597
|
+
}
|
|
56598
|
+
function tryGetElementAccessExpressionName(node) {
|
|
56599
|
+
if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
|
|
56600
|
+
return ts.escapeLeadingUnderscores(node.argumentExpression.text);
|
|
56601
|
+
}
|
|
56602
|
+
if (ts.isIdentifier(node.argumentExpression)) {
|
|
56603
|
+
var symbol = getResolvedSymbol(node.argumentExpression);
|
|
56604
|
+
if (!isConstVariable(symbol))
|
|
56605
|
+
return undefined;
|
|
56606
|
+
var declaration = symbol.valueDeclaration;
|
|
56607
|
+
if (declaration === undefined)
|
|
56608
|
+
return undefined;
|
|
56609
|
+
var type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
56610
|
+
if (type) {
|
|
56611
|
+
var name = tryGetNameFromType(type);
|
|
56612
|
+
if (name !== undefined) {
|
|
56613
|
+
return name;
|
|
56614
|
+
}
|
|
56615
|
+
}
|
|
56616
|
+
if (ts.hasOnlyExpressionInitializer(declaration)) {
|
|
56617
|
+
var initializer = ts.getEffectiveInitializer(declaration);
|
|
56618
|
+
return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
|
|
56619
|
+
}
|
|
56620
|
+
}
|
|
56621
|
+
return undefined;
|
|
56520
56622
|
}
|
|
56521
56623
|
function containsMatchingReference(source, target) {
|
|
56522
56624
|
while (ts.isAccessExpression(source)) {
|
|
@@ -58376,16 +58478,18 @@ var ts;
|
|
|
58376
58478
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
58377
58479
|
return !!(type.flags & 465829888 && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304));
|
|
58378
58480
|
}
|
|
58379
|
-
function
|
|
58481
|
+
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
58380
58482
|
var contextualType = (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
|
|
58381
58483
|
!((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
|
|
58382
|
-
|
|
58484
|
+
(checkMode && checkMode & 32 ?
|
|
58485
|
+
getContextualType(node, 8)
|
|
58486
|
+
: getContextualType(node));
|
|
58383
58487
|
return contextualType && !isGenericType(contextualType);
|
|
58384
58488
|
}
|
|
58385
58489
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
58386
58490
|
var substituteConstraints = !(checkMode && checkMode & 2) &&
|
|
58387
58491
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
58388
|
-
(isConstraintPosition(type, reference) ||
|
|
58492
|
+
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
58389
58493
|
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t; }) : type;
|
|
58390
58494
|
}
|
|
58391
58495
|
function isExportOrExportExpression(location) {
|
|
@@ -58427,7 +58531,7 @@ var ts;
|
|
|
58427
58531
|
var links = getNodeLinks(location);
|
|
58428
58532
|
if (!(links.flags & 268435456)) {
|
|
58429
58533
|
links.flags |= 268435456;
|
|
58430
|
-
var parentType = getTypeForBindingElementParent(parent);
|
|
58534
|
+
var parentType = getTypeForBindingElementParent(parent, 0);
|
|
58431
58535
|
links.flags &= ~268435456;
|
|
58432
58536
|
if (parentType && parentType.flags & 1048576 && !(parent.kind === 163 && isSymbolAssigned(symbol))) {
|
|
58433
58537
|
var pattern = declaration.parent;
|
|
@@ -59098,7 +59202,7 @@ var ts;
|
|
|
59098
59202
|
var parent = declaration.parent.parent;
|
|
59099
59203
|
var name = declaration.propertyName || declaration.name;
|
|
59100
59204
|
var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
|
|
59101
|
-
parent.kind !== 202 && parent.initializer && checkDeclarationInitializer(parent);
|
|
59205
|
+
parent.kind !== 202 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 32 : 0);
|
|
59102
59206
|
if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
|
|
59103
59207
|
return undefined;
|
|
59104
59208
|
if (parent.name.kind === 201) {
|
|
@@ -61013,7 +61117,7 @@ var ts;
|
|
|
61013
61117
|
error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, ts.idText(right));
|
|
61014
61118
|
return errorType;
|
|
61015
61119
|
}
|
|
61016
|
-
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writing ?
|
|
61120
|
+
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writing ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
|
|
61017
61121
|
}
|
|
61018
61122
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
61019
61123
|
}
|
|
@@ -63105,8 +63209,8 @@ var ts;
|
|
|
63105
63209
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
63106
63210
|
var synthType = type;
|
|
63107
63211
|
if (!synthType.defaultOnlyType) {
|
|
63108
|
-
var
|
|
63109
|
-
synthType.defaultOnlyType =
|
|
63212
|
+
var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
63213
|
+
synthType.defaultOnlyType = type_5;
|
|
63110
63214
|
}
|
|
63111
63215
|
return synthType.defaultOnlyType;
|
|
63112
63216
|
}
|
|
@@ -63772,11 +63876,11 @@ var ts;
|
|
|
63772
63876
|
var operandType = getTypeOfExpression(node.expression.expression);
|
|
63773
63877
|
var witnesses = getSwitchClauseTypeOfWitnesses(node, false);
|
|
63774
63878
|
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, true);
|
|
63775
|
-
var
|
|
63776
|
-
if (
|
|
63879
|
+
var type_6 = getBaseConstraintOfType(operandType) || operandType;
|
|
63880
|
+
if (type_6.flags & 3) {
|
|
63777
63881
|
return (556800 & notEqualFacts_1) === 556800;
|
|
63778
63882
|
}
|
|
63779
|
-
return !!(filterType(
|
|
63883
|
+
return !!(filterType(type_6, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072);
|
|
63780
63884
|
}
|
|
63781
63885
|
var type = getTypeOfExpression(node.expression);
|
|
63782
63886
|
if (!isLiteralType(type)) {
|
|
@@ -65067,11 +65171,11 @@ var ts;
|
|
|
65067
65171
|
}
|
|
65068
65172
|
}
|
|
65069
65173
|
function checkExpressionCached(node, checkMode) {
|
|
65174
|
+
if (checkMode && checkMode !== 0) {
|
|
65175
|
+
return checkExpression(node, checkMode);
|
|
65176
|
+
}
|
|
65070
65177
|
var links = getNodeLinks(node);
|
|
65071
65178
|
if (!links.resolvedType) {
|
|
65072
|
-
if (checkMode && checkMode !== 0) {
|
|
65073
|
-
return checkExpression(node, checkMode);
|
|
65074
|
-
}
|
|
65075
65179
|
var saveFlowLoopStart = flowLoopStart;
|
|
65076
65180
|
var saveFlowTypeCache = flowTypeCache;
|
|
65077
65181
|
flowLoopStart = flowLoopCount;
|
|
@@ -65088,10 +65192,12 @@ var ts;
|
|
|
65088
65192
|
node.kind === 228 ||
|
|
65089
65193
|
ts.isJSDocTypeAssertion(node);
|
|
65090
65194
|
}
|
|
65091
|
-
function checkDeclarationInitializer(declaration, contextualType) {
|
|
65195
|
+
function checkDeclarationInitializer(declaration, checkMode, contextualType) {
|
|
65092
65196
|
var initializer = ts.getEffectiveInitializer(declaration);
|
|
65093
65197
|
var type = getQuickTypeOfExpression(initializer) ||
|
|
65094
|
-
(contextualType ?
|
|
65198
|
+
(contextualType ?
|
|
65199
|
+
checkExpressionWithContextualType(initializer, contextualType, undefined, checkMode || 0)
|
|
65200
|
+
: checkExpressionCached(initializer, checkMode));
|
|
65095
65201
|
return ts.isParameter(declaration) && declaration.name.kind === 201 &&
|
|
65096
65202
|
isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ?
|
|
65097
65203
|
padTupleType(type, declaration.name) : type;
|
|
@@ -65659,6 +65765,7 @@ var ts;
|
|
|
65659
65765
|
}
|
|
65660
65766
|
}
|
|
65661
65767
|
checkTypeParameters(ts.getEffectiveTypeParameterDeclarations(node));
|
|
65768
|
+
checkUnmatchedJSDocParameters(node);
|
|
65662
65769
|
ts.forEach(node.parameters, checkParameter);
|
|
65663
65770
|
if (node.type) {
|
|
65664
65771
|
checkSourceElement(node.type);
|
|
@@ -66940,28 +67047,6 @@ var ts;
|
|
|
66940
67047
|
}
|
|
66941
67048
|
function checkJSDocParameterTag(node) {
|
|
66942
67049
|
checkSourceElement(node.typeExpression);
|
|
66943
|
-
if (!ts.getParameterSymbolFromJSDoc(node)) {
|
|
66944
|
-
var decl = ts.getHostSignatureFromJSDoc(node);
|
|
66945
|
-
if (decl) {
|
|
66946
|
-
var i = ts.getJSDocTags(decl).filter(ts.isJSDocParameterTag).indexOf(node);
|
|
66947
|
-
if (i > -1 && i < decl.parameters.length && ts.isBindingPattern(decl.parameters[i].name)) {
|
|
66948
|
-
return;
|
|
66949
|
-
}
|
|
66950
|
-
if (!containsArgumentsReference(decl)) {
|
|
66951
|
-
if (ts.isQualifiedName(node.name)) {
|
|
66952
|
-
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));
|
|
66953
|
-
}
|
|
66954
|
-
else {
|
|
66955
|
-
error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(node.name));
|
|
66956
|
-
}
|
|
66957
|
-
}
|
|
66958
|
-
else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
|
|
66959
|
-
node.typeExpression && node.typeExpression.type &&
|
|
66960
|
-
!isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
|
|
66961
|
-
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));
|
|
66962
|
-
}
|
|
66963
|
-
}
|
|
66964
|
-
}
|
|
66965
67050
|
}
|
|
66966
67051
|
function checkJSDocPropertyTag(node) {
|
|
66967
67052
|
checkSourceElement(node.typeExpression);
|
|
@@ -67562,7 +67647,8 @@ var ts;
|
|
|
67562
67647
|
checkComputedPropertyName(node.propertyName);
|
|
67563
67648
|
}
|
|
67564
67649
|
var parent = node.parent.parent;
|
|
67565
|
-
var
|
|
67650
|
+
var parentCheckMode = node.dotDotDotToken ? 32 : 0;
|
|
67651
|
+
var parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
67566
67652
|
var name = node.propertyName || node.name;
|
|
67567
67653
|
if (parentType && !ts.isBindingPattern(name)) {
|
|
67568
67654
|
var exprType = getLiteralTypeFromPropertyName(name);
|
|
@@ -68526,7 +68612,7 @@ var ts;
|
|
|
68526
68612
|
var declaration = catchClause.variableDeclaration;
|
|
68527
68613
|
var typeNode = ts.getEffectiveTypeAnnotationNode(ts.getRootDeclaration(declaration));
|
|
68528
68614
|
if (typeNode) {
|
|
68529
|
-
var type = getTypeForVariableLikeDeclaration(declaration, false);
|
|
68615
|
+
var type = getTypeForVariableLikeDeclaration(declaration, false, 0);
|
|
68530
68616
|
if (type && !(type.flags & 3)) {
|
|
68531
68617
|
grammarErrorOnFirstToken(typeNode, ts.Diagnostics.Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified);
|
|
68532
68618
|
}
|
|
@@ -68644,6 +68730,45 @@ var ts;
|
|
|
68644
68730
|
error(name, ts.Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ts.ModuleKind[moduleKind]);
|
|
68645
68731
|
}
|
|
68646
68732
|
}
|
|
68733
|
+
function checkUnmatchedJSDocParameters(node) {
|
|
68734
|
+
var jsdocParameters = ts.filter(ts.getJSDocTags(node), ts.isJSDocParameterTag);
|
|
68735
|
+
if (!ts.length(jsdocParameters))
|
|
68736
|
+
return;
|
|
68737
|
+
var isJs = ts.isInJSFile(node);
|
|
68738
|
+
var parameters = new ts.Set();
|
|
68739
|
+
var excludedParameters = new ts.Set();
|
|
68740
|
+
ts.forEach(node.parameters, function (_a, index) {
|
|
68741
|
+
var name = _a.name;
|
|
68742
|
+
if (ts.isIdentifier(name)) {
|
|
68743
|
+
parameters.add(name.escapedText);
|
|
68744
|
+
}
|
|
68745
|
+
if (ts.isBindingPattern(name)) {
|
|
68746
|
+
excludedParameters.add(index);
|
|
68747
|
+
}
|
|
68748
|
+
});
|
|
68749
|
+
var containsArguments = containsArgumentsReference(node);
|
|
68750
|
+
if (containsArguments) {
|
|
68751
|
+
var lastJSDocParam = ts.lastOrUndefined(jsdocParameters);
|
|
68752
|
+
if (lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
68753
|
+
lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
68754
|
+
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));
|
|
68755
|
+
}
|
|
68756
|
+
}
|
|
68757
|
+
else {
|
|
68758
|
+
ts.forEach(jsdocParameters, function (_a, index) {
|
|
68759
|
+
var name = _a.name;
|
|
68760
|
+
if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
|
|
68761
|
+
return;
|
|
68762
|
+
}
|
|
68763
|
+
if (ts.isQualifiedName(name)) {
|
|
68764
|
+
errorOrSuggestion(isJs, name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
|
|
68765
|
+
}
|
|
68766
|
+
else {
|
|
68767
|
+
errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
|
|
68768
|
+
}
|
|
68769
|
+
});
|
|
68770
|
+
}
|
|
68771
|
+
}
|
|
68647
68772
|
function checkTypeParameters(typeParameterDeclarations) {
|
|
68648
68773
|
if (typeParameterDeclarations) {
|
|
68649
68774
|
var seenDefault = false;
|
|
@@ -69183,7 +69308,7 @@ var ts;
|
|
|
69183
69308
|
}
|
|
69184
69309
|
if (!ts.isStatic(member) && isPropertyWithoutInitializer(member)) {
|
|
69185
69310
|
var propName = member.name;
|
|
69186
|
-
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName)) {
|
|
69311
|
+
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
69187
69312
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
69188
69313
|
if (!(type.flags & 3 || getFalsyFlags(type) & 32768)) {
|
|
69189
69314
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
@@ -69217,7 +69342,9 @@ var ts;
|
|
|
69217
69342
|
return false;
|
|
69218
69343
|
}
|
|
69219
69344
|
function isPropertyInitializedInConstructor(propName, propType, constructor) {
|
|
69220
|
-
var reference = ts.
|
|
69345
|
+
var reference = ts.isComputedPropertyName(propName)
|
|
69346
|
+
? ts.factory.createElementAccessExpression(ts.factory.createThis(), propName.expression)
|
|
69347
|
+
: ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
|
|
69221
69348
|
ts.setParent(reference.expression, reference);
|
|
69222
69349
|
ts.setParent(reference, constructor);
|
|
69223
69350
|
reference.flowNode = constructor.returnFlowNode;
|
|
@@ -69520,7 +69647,7 @@ var ts;
|
|
|
69520
69647
|
var isAmbientExternalModule = ts.isAmbientModule(node);
|
|
69521
69648
|
var contextErrorMessage = isAmbientExternalModule
|
|
69522
69649
|
? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file
|
|
69523
|
-
: ts.Diagnostics.
|
|
69650
|
+
: ts.Diagnostics.A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module;
|
|
69524
69651
|
if (checkGrammarModuleElementContext(node, contextErrorMessage)) {
|
|
69525
69652
|
return;
|
|
69526
69653
|
}
|
|
@@ -69721,6 +69848,9 @@ var ts;
|
|
|
69721
69848
|
var name = ts.idText(node.kind === 269 ? node.propertyName || node.name : node.name);
|
|
69722
69849
|
addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name);
|
|
69723
69850
|
}
|
|
69851
|
+
if (isType && node.kind === 264 && ts.hasEffectiveModifier(node, 1)) {
|
|
69852
|
+
error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided);
|
|
69853
|
+
}
|
|
69724
69854
|
break;
|
|
69725
69855
|
}
|
|
69726
69856
|
case 274: {
|
|
@@ -69801,7 +69931,7 @@ var ts;
|
|
|
69801
69931
|
}
|
|
69802
69932
|
}
|
|
69803
69933
|
function checkImportDeclaration(node) {
|
|
69804
|
-
if (checkGrammarModuleElementContext(node, ts.Diagnostics.
|
|
69934
|
+
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)) {
|
|
69805
69935
|
return;
|
|
69806
69936
|
}
|
|
69807
69937
|
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasEffectiveModifiers(node)) {
|
|
@@ -69832,7 +69962,7 @@ var ts;
|
|
|
69832
69962
|
checkAssertClause(node);
|
|
69833
69963
|
}
|
|
69834
69964
|
function checkImportEqualsDeclaration(node) {
|
|
69835
|
-
if (checkGrammarModuleElementContext(node, ts.Diagnostics.
|
|
69965
|
+
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)) {
|
|
69836
69966
|
return;
|
|
69837
69967
|
}
|
|
69838
69968
|
checkGrammarDecoratorsAndModifiers(node);
|
|
@@ -69866,7 +69996,7 @@ var ts;
|
|
|
69866
69996
|
}
|
|
69867
69997
|
}
|
|
69868
69998
|
function checkExportDeclaration(node) {
|
|
69869
|
-
if (checkGrammarModuleElementContext(node, ts.Diagnostics.
|
|
69999
|
+
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)) {
|
|
69870
70000
|
return;
|
|
69871
70001
|
}
|
|
69872
70002
|
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasEffectiveModifiers(node)) {
|
|
@@ -70984,7 +71114,7 @@ var ts;
|
|
|
70984
71114
|
return errorType;
|
|
70985
71115
|
}
|
|
70986
71116
|
if (ts.isBindingPattern(node)) {
|
|
70987
|
-
return getTypeForVariableLikeDeclaration(node.parent, true) || errorType;
|
|
71117
|
+
return getTypeForVariableLikeDeclaration(node.parent, true, 0) || errorType;
|
|
70988
71118
|
}
|
|
70989
71119
|
if (isInRightSideOfImportOrExportAssignment(node)) {
|
|
70990
71120
|
var symbol = getSymbolAtLocation(node);
|
|
@@ -94310,9 +94440,9 @@ var ts;
|
|
|
94310
94440
|
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
94311
94441
|
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
94312
94442
|
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
94313
|
-
ts.Diagnostics.
|
|
94443
|
+
ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
|
|
94314
94444
|
ts.Diagnostics.An_export_declaration_cannot_have_modifiers.code,
|
|
94315
|
-
ts.Diagnostics.
|
|
94445
|
+
ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
|
|
94316
94446
|
ts.Diagnostics.An_import_declaration_cannot_have_modifiers.code,
|
|
94317
94447
|
ts.Diagnostics.An_object_member_cannot_be_declared_optional.code,
|
|
94318
94448
|
ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
|
|
@@ -95210,7 +95340,7 @@ var ts;
|
|
|
95210
95340
|
ts.Debug.assert(!!sourceFile.bindDiagnostics);
|
|
95211
95341
|
var isJs = sourceFile.scriptKind === 1 || sourceFile.scriptKind === 2;
|
|
95212
95342
|
var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
|
|
95213
|
-
var isPlainJs =
|
|
95343
|
+
var isPlainJs = ts.isPlainJsFile(sourceFile, options.checkJs);
|
|
95214
95344
|
var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
|
|
95215
95345
|
var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 || sourceFile.scriptKind === 4
|
|
95216
95346
|
|| sourceFile.scriptKind === 5 || isPlainJs || isCheckJs || sourceFile.scriptKind === 7);
|