@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/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220211";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -1263,11 +1263,11 @@ var ts;
|
|
|
1263
1263
|
return result;
|
|
1264
1264
|
}
|
|
1265
1265
|
ts.getAllKeys = getAllKeys;
|
|
1266
|
-
function getOwnValues(
|
|
1266
|
+
function getOwnValues(collection) {
|
|
1267
1267
|
var values = [];
|
|
1268
|
-
for (var key in
|
|
1269
|
-
if (hasOwnProperty.call(
|
|
1270
|
-
values.push(
|
|
1268
|
+
for (var key in collection) {
|
|
1269
|
+
if (hasOwnProperty.call(collection, key)) {
|
|
1270
|
+
values.push(collection[key]);
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
1273
1273
|
return values;
|
|
@@ -7625,18 +7625,6 @@ var ts;
|
|
|
7625
7625
|
return getCanonicalFileName(nonCanonicalizedPath);
|
|
7626
7626
|
}
|
|
7627
7627
|
ts.toPath = toPath;
|
|
7628
|
-
function normalizePathAndParts(path) {
|
|
7629
|
-
path = normalizeSlashes(path);
|
|
7630
|
-
var _a = reducePathComponents(getPathComponents(path)), root = _a[0], parts = _a.slice(1);
|
|
7631
|
-
if (parts.length) {
|
|
7632
|
-
var joinedParts = root + parts.join(ts.directorySeparator);
|
|
7633
|
-
return { path: hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(joinedParts) : joinedParts, parts: parts };
|
|
7634
|
-
}
|
|
7635
|
-
else {
|
|
7636
|
-
return { path: root, parts: parts };
|
|
7637
|
-
}
|
|
7638
|
-
}
|
|
7639
|
-
ts.normalizePathAndParts = normalizePathAndParts;
|
|
7640
7628
|
function removeTrailingDirectorySeparator(path) {
|
|
7641
7629
|
if (hasTrailingDirectorySeparator(path)) {
|
|
7642
7630
|
return path.substr(0, path.length - 1);
|
|
@@ -8034,10 +8022,10 @@ var ts;
|
|
|
8034
8022
|
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."),
|
|
8035
8023
|
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."),
|
|
8036
8024
|
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."),
|
|
8037
|
-
|
|
8038
|
-
|
|
8025
|
+
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."),
|
|
8026
|
+
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."),
|
|
8039
8027
|
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."),
|
|
8040
|
-
|
|
8028
|
+
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."),
|
|
8041
8029
|
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'."),
|
|
8042
8030
|
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'."),
|
|
8043
8031
|
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."),
|
|
@@ -8069,6 +8057,7 @@ var ts;
|
|
|
8069
8057
|
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."),
|
|
8070
8058
|
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."),
|
|
8071
8059
|
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."),
|
|
8060
|
+
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."),
|
|
8072
8061
|
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."),
|
|
8073
8062
|
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."),
|
|
8074
8063
|
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."),
|
|
@@ -8205,6 +8194,8 @@ var ts;
|
|
|
8205
8194
|
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."),
|
|
8206
8195
|
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."),
|
|
8207
8196
|
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
8197
|
+
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."),
|
|
8198
|
+
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."),
|
|
8208
8199
|
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."),
|
|
8209
8200
|
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."),
|
|
8210
8201
|
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.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
@@ -9624,6 +9615,10 @@ var ts;
|
|
|
9624
9615
|
Add_missing_attributes: diag(95167, ts.DiagnosticCategory.Message, "Add_missing_attributes_95167", "Add missing attributes"),
|
|
9625
9616
|
Add_all_missing_attributes: diag(95168, ts.DiagnosticCategory.Message, "Add_all_missing_attributes_95168", "Add all missing attributes"),
|
|
9626
9617
|
Add_undefined_to_optional_property_type: diag(95169, ts.DiagnosticCategory.Message, "Add_undefined_to_optional_property_type_95169", "Add 'undefined' to optional property type"),
|
|
9618
|
+
Convert_named_imports_to_default_import: diag(95170, ts.DiagnosticCategory.Message, "Convert_named_imports_to_default_import_95170", "Convert named imports to default import"),
|
|
9619
|
+
Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
|
|
9620
|
+
Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
|
|
9621
|
+
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}'"),
|
|
9627
9622
|
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."),
|
|
9628
9623
|
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'."),
|
|
9629
9624
|
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?"),
|
|
@@ -13885,6 +13880,10 @@ var ts;
|
|
|
13885
13880
|
return undefined;
|
|
13886
13881
|
}
|
|
13887
13882
|
ts.getDeclarationOfKind = getDeclarationOfKind;
|
|
13883
|
+
function getDeclarationsOfKind(symbol, kind) {
|
|
13884
|
+
return ts.filter(symbol.declarations || ts.emptyArray, function (d) { return d.kind === kind; });
|
|
13885
|
+
}
|
|
13886
|
+
ts.getDeclarationsOfKind = getDeclarationsOfKind;
|
|
13888
13887
|
function createSymbolTable(symbols) {
|
|
13889
13888
|
var result = new ts.Map();
|
|
13890
13889
|
if (symbols) {
|
|
@@ -14120,6 +14119,10 @@ var ts;
|
|
|
14120
14119
|
return getSourceFileOfNode(module.valueDeclaration || getNonAugmentationDeclaration(module));
|
|
14121
14120
|
}
|
|
14122
14121
|
ts.getSourceFileOfModule = getSourceFileOfModule;
|
|
14122
|
+
function isPlainJsFile(file, checkJs) {
|
|
14123
|
+
return !!file && (file.scriptKind === 1 /* JS */ || file.scriptKind === 2 /* JSX */) && !file.checkJsDirective && checkJs === undefined;
|
|
14124
|
+
}
|
|
14125
|
+
ts.isPlainJsFile = isPlainJsFile;
|
|
14123
14126
|
function isStatementWithLocals(node) {
|
|
14124
14127
|
switch (node.kind) {
|
|
14125
14128
|
case 234 /* Block */:
|
|
@@ -41695,7 +41698,7 @@ var ts;
|
|
|
41695
41698
|
result_4 = searchResult && searchResult.value;
|
|
41696
41699
|
}
|
|
41697
41700
|
else {
|
|
41698
|
-
var candidate =
|
|
41701
|
+
var candidate = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName).path;
|
|
41699
41702
|
result_4 = nodeLoadModuleByRelativeName(Extensions.DtsOnly, candidate, /*onlyRecordFailures*/ false, moduleResolutionState, /*considerPackageJson*/ true);
|
|
41700
41703
|
}
|
|
41701
41704
|
return resolvedTypeScriptOnly(result_4);
|
|
@@ -42398,13 +42401,25 @@ var ts;
|
|
|
42398
42401
|
return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
|
|
42399
42402
|
}
|
|
42400
42403
|
else {
|
|
42401
|
-
var _a =
|
|
42404
|
+
var _a = normalizePathForCJSResolution(containingDirectory, moduleName), candidate = _a.path, parts = _a.parts;
|
|
42402
42405
|
var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, /*onlyRecordFailures*/ false, state, /*considerPackageJson*/ true);
|
|
42403
42406
|
// Treat explicit "node_modules" import as an external library import.
|
|
42404
42407
|
return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: ts.contains(parts, "node_modules") });
|
|
42405
42408
|
}
|
|
42406
42409
|
}
|
|
42407
42410
|
}
|
|
42411
|
+
// If you import from "." inside a containing directory "/foo", the result of `normalizePath`
|
|
42412
|
+
// would be "/foo", but this loses the information that `foo` is a directory and we intended
|
|
42413
|
+
// to look inside of it. The Node CommonJS resolution algorithm doesn't call this out
|
|
42414
|
+
// (https://nodejs.org/api/modules.html#all-together), but it seems that module paths ending
|
|
42415
|
+
// in `.` are actually normalized to `./` before proceeding with the resolution algorithm.
|
|
42416
|
+
function normalizePathForCJSResolution(containingDirectory, moduleName) {
|
|
42417
|
+
var combined = ts.combinePaths(containingDirectory, moduleName);
|
|
42418
|
+
var parts = ts.getPathComponents(combined);
|
|
42419
|
+
var lastPart = ts.lastOrUndefined(parts);
|
|
42420
|
+
var path = lastPart === "." || lastPart === ".." ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(combined)) : ts.normalizePath(combined);
|
|
42421
|
+
return { path: path, parts: parts };
|
|
42422
|
+
}
|
|
42408
42423
|
function realPath(path, host, traceEnabled) {
|
|
42409
42424
|
if (!host.realpath) {
|
|
42410
42425
|
return path;
|
|
@@ -44152,7 +44167,7 @@ var ts;
|
|
|
44152
44167
|
return ts.isDottedName(expr)
|
|
44153
44168
|
|| (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
|
|
44154
44169
|
|| ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 /* CommaToken */ && isNarrowableReference(expr.right)
|
|
44155
|
-
|| ts.isElementAccessExpression(expr) && ts.isStringOrNumericLiteralLike(expr.argumentExpression) && isNarrowableReference(expr.expression)
|
|
44170
|
+
|| ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isIdentifier(expr.argumentExpression)) && isNarrowableReference(expr.expression)
|
|
44156
44171
|
|| ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
|
|
44157
44172
|
}
|
|
44158
44173
|
function containsNarrowableReference(expr) {
|
|
@@ -46897,6 +46912,9 @@ var ts;
|
|
|
46897
46912
|
CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
46898
46913
|
CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
46899
46914
|
CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
|
|
46915
|
+
CheckMode[CheckMode["RestBindingElement"] = 32] = "RestBindingElement";
|
|
46916
|
+
// e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
|
|
46917
|
+
// we need to preserve generic types instead of substituting them for constraints
|
|
46900
46918
|
})(CheckMode || (CheckMode = {}));
|
|
46901
46919
|
var SignatureCheckMode;
|
|
46902
46920
|
(function (SignatureCheckMode) {
|
|
@@ -47949,13 +47967,13 @@ var ts;
|
|
|
47949
47967
|
else { // error
|
|
47950
47968
|
var isEitherEnum = !!(target.flags & 384 /* Enum */ || source.flags & 384 /* Enum */);
|
|
47951
47969
|
var isEitherBlockScoped_1 = !!(target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */);
|
|
47952
|
-
var message = isEitherEnum
|
|
47953
|
-
? ts.Diagnostics.
|
|
47954
|
-
: isEitherBlockScoped_1
|
|
47955
|
-
? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0
|
|
47970
|
+
var message = isEitherEnum ? ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations
|
|
47971
|
+
: isEitherBlockScoped_1 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0
|
|
47956
47972
|
: ts.Diagnostics.Duplicate_identifier_0;
|
|
47957
47973
|
var sourceSymbolFile = source.declarations && ts.getSourceFileOfNode(source.declarations[0]);
|
|
47958
47974
|
var targetSymbolFile = target.declarations && ts.getSourceFileOfNode(target.declarations[0]);
|
|
47975
|
+
var isSourcePlainJs = ts.isPlainJsFile(sourceSymbolFile, compilerOptions.checkJs);
|
|
47976
|
+
var isTargetPlainJs = ts.isPlainJsFile(targetSymbolFile, compilerOptions.checkJs);
|
|
47959
47977
|
var symbolName_1 = symbolToString(source);
|
|
47960
47978
|
// Collect top-level duplicate identifier errors into one mapping, so we can then merge their diagnostics if there are a bunch
|
|
47961
47979
|
if (sourceSymbolFile && targetSymbolFile && amalgamatedDuplicates && !isEitherEnum && sourceSymbolFile !== targetSymbolFile) {
|
|
@@ -47967,12 +47985,16 @@ var ts;
|
|
|
47967
47985
|
var conflictingSymbolInfo = ts.getOrUpdate(filesDuplicates.conflictingSymbols, symbolName_1, function () {
|
|
47968
47986
|
return ({ isBlockScoped: isEitherBlockScoped_1, firstFileLocations: [], secondFileLocations: [] });
|
|
47969
47987
|
});
|
|
47970
|
-
|
|
47971
|
-
|
|
47988
|
+
if (!isSourcePlainJs)
|
|
47989
|
+
addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source);
|
|
47990
|
+
if (!isTargetPlainJs)
|
|
47991
|
+
addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target);
|
|
47972
47992
|
}
|
|
47973
47993
|
else {
|
|
47974
|
-
|
|
47975
|
-
|
|
47994
|
+
if (!isSourcePlainJs)
|
|
47995
|
+
addDuplicateDeclarationErrorsForSymbols(source, message, symbolName_1, target);
|
|
47996
|
+
if (!isTargetPlainJs)
|
|
47997
|
+
addDuplicateDeclarationErrorsForSymbols(target, message, symbolName_1, source);
|
|
47976
47998
|
}
|
|
47977
47999
|
}
|
|
47978
48000
|
return target;
|
|
@@ -48429,6 +48451,8 @@ var ts;
|
|
|
48429
48451
|
// type parameters are visible in parameter list, return type and type parameter list
|
|
48430
48452
|
? lastLocation === location.type ||
|
|
48431
48453
|
lastLocation.kind === 163 /* Parameter */ ||
|
|
48454
|
+
lastLocation.kind === 338 /* JSDocParameterTag */ ||
|
|
48455
|
+
lastLocation.kind === 339 /* JSDocReturnTag */ ||
|
|
48432
48456
|
lastLocation.kind === 162 /* TypeParameter */
|
|
48433
48457
|
// local types not visible outside the function body
|
|
48434
48458
|
: false;
|
|
@@ -48688,9 +48712,9 @@ var ts;
|
|
|
48688
48712
|
lastSelfReferenceLocation = location;
|
|
48689
48713
|
}
|
|
48690
48714
|
lastLocation = location;
|
|
48691
|
-
location = ts.isJSDocTemplateTag(location) ?
|
|
48692
|
-
ts.
|
|
48693
|
-
|
|
48715
|
+
location = ts.isJSDocTemplateTag(location) ? ts.getEffectiveContainerForJSDocTemplateTag(location) || location.parent :
|
|
48716
|
+
ts.isJSDocParameterTag(location) || ts.isJSDocReturnTag(location) ? ts.getHostSignatureFromJSDoc(location) || location.parent :
|
|
48717
|
+
location.parent;
|
|
48694
48718
|
}
|
|
48695
48719
|
// We just climbed up parents looking for the name, meaning that we started in a descendant node of `lastLocation`.
|
|
48696
48720
|
// If `result === lastSelfReferenceLocation.symbol`, that means that we are somewhere inside `lastSelfReferenceLocation` looking up a name, and resolving to `lastLocation` itself.
|
|
@@ -49824,16 +49848,20 @@ var ts;
|
|
|
49824
49848
|
return;
|
|
49825
49849
|
}
|
|
49826
49850
|
var host = ts.getJSDocHost(node);
|
|
49827
|
-
if (host &&
|
|
49828
|
-
|
|
49829
|
-
ts.isBinaryExpression(host.expression) &&
|
|
49830
|
-
ts.getAssignmentDeclarationKind(host.expression) === 3 /* PrototypeProperty */) {
|
|
49831
|
-
// X.prototype.m = /** @param {K} p */ function () { } <-- look for K on X's declaration
|
|
49851
|
+
if (host && ts.isExpressionStatement(host) && ts.isPrototypePropertyAssignment(host.expression)) {
|
|
49852
|
+
// /** @param {K} p */ X.prototype.m = function () { } <-- look for K on X's declaration
|
|
49832
49853
|
var symbol = getSymbolOfNode(host.expression.left);
|
|
49833
49854
|
if (symbol) {
|
|
49834
49855
|
return getDeclarationOfJSPrototypeContainer(symbol);
|
|
49835
49856
|
}
|
|
49836
49857
|
}
|
|
49858
|
+
if (host && ts.isFunctionExpression(host) && ts.isPrototypePropertyAssignment(host.parent) && ts.isExpressionStatement(host.parent.parent)) {
|
|
49859
|
+
// X.prototype.m = /** @param {K} p */ function () { } <-- look for K on X's declaration
|
|
49860
|
+
var symbol = getSymbolOfNode(host.parent.left);
|
|
49861
|
+
if (symbol) {
|
|
49862
|
+
return getDeclarationOfJSPrototypeContainer(symbol);
|
|
49863
|
+
}
|
|
49864
|
+
}
|
|
49837
49865
|
if (host && (ts.isObjectLiteralMethod(host) || ts.isPropertyAssignment(host)) &&
|
|
49838
49866
|
ts.isBinaryExpression(host.parent.parent) &&
|
|
49839
49867
|
ts.getAssignmentDeclarationKind(host.parent.parent) === 6 /* Prototype */) {
|
|
@@ -54320,9 +54348,12 @@ var ts;
|
|
|
54320
54348
|
}
|
|
54321
54349
|
// Return the type of a binding element parent. We check SymbolLinks first to see if a type has been
|
|
54322
54350
|
// assigned by contextual typing.
|
|
54323
|
-
function getTypeForBindingElementParent(node) {
|
|
54351
|
+
function getTypeForBindingElementParent(node, checkMode) {
|
|
54352
|
+
if (checkMode !== 0 /* Normal */) {
|
|
54353
|
+
return getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false, checkMode);
|
|
54354
|
+
}
|
|
54324
54355
|
var symbol = getSymbolOfNode(node);
|
|
54325
|
-
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
|
|
54356
|
+
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false, checkMode);
|
|
54326
54357
|
}
|
|
54327
54358
|
function getRestType(source, properties, symbol) {
|
|
54328
54359
|
source = filterType(source, function (t) { return !(t.flags & 98304 /* Nullable */); });
|
|
@@ -54440,7 +54471,8 @@ var ts;
|
|
|
54440
54471
|
}
|
|
54441
54472
|
/** Return the inferred type for a binding element */
|
|
54442
54473
|
function getTypeForBindingElement(declaration) {
|
|
54443
|
-
var
|
|
54474
|
+
var checkMode = declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
|
|
54475
|
+
var parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
54444
54476
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
54445
54477
|
}
|
|
54446
54478
|
function getBindingElementTypeFromParentType(declaration, parentType) {
|
|
@@ -54512,9 +54544,9 @@ var ts;
|
|
|
54512
54544
|
if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
|
|
54513
54545
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
54514
54546
|
// undefined from the final type.
|
|
54515
|
-
return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration)) & 32768 /* Undefined */) ? getNonUndefinedType(type) : type;
|
|
54547
|
+
return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 32768 /* Undefined */) ? getNonUndefinedType(type) : type;
|
|
54516
54548
|
}
|
|
54517
|
-
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration)], 2 /* Subtype */));
|
|
54549
|
+
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
54518
54550
|
}
|
|
54519
54551
|
function getTypeForDeclarationFromJSDocComment(declaration) {
|
|
54520
54552
|
var jsdocType = ts.getJSDocType(declaration);
|
|
@@ -54537,11 +54569,11 @@ var ts;
|
|
|
54537
54569
|
return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type;
|
|
54538
54570
|
}
|
|
54539
54571
|
// Return the inferred type for a variable, parameter, or property declaration
|
|
54540
|
-
function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
|
|
54572
|
+
function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) {
|
|
54541
54573
|
// A variable declared in a for..in statement is of type string, or of type keyof T when the
|
|
54542
54574
|
// right hand expression is of a type parameter type.
|
|
54543
54575
|
if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 242 /* ForInStatement */) {
|
|
54544
|
-
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
|
|
54576
|
+
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode)));
|
|
54545
54577
|
return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType;
|
|
54546
54578
|
}
|
|
54547
54579
|
if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* ForOfStatement */) {
|
|
@@ -54596,12 +54628,9 @@ var ts;
|
|
|
54596
54628
|
}
|
|
54597
54629
|
}
|
|
54598
54630
|
if (ts.isInJSFile(declaration)) {
|
|
54599
|
-
var
|
|
54600
|
-
if (
|
|
54601
|
-
|
|
54602
|
-
var pos = func.parameters.indexOf(declaration);
|
|
54603
|
-
return declaration.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos);
|
|
54604
|
-
}
|
|
54631
|
+
var type_1 = getParameterTypeOfTypeTag(func, declaration);
|
|
54632
|
+
if (type_1)
|
|
54633
|
+
return type_1;
|
|
54605
54634
|
}
|
|
54606
54635
|
// Use contextual parameter type if one is available
|
|
54607
54636
|
var type = declaration.symbol.escapedName === "this" /* This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
|
|
@@ -54618,7 +54647,7 @@ var ts;
|
|
|
54618
54647
|
return containerObjectType;
|
|
54619
54648
|
}
|
|
54620
54649
|
}
|
|
54621
|
-
var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration));
|
|
54650
|
+
var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration, checkMode));
|
|
54622
54651
|
return addOptionality(type, isProperty, isOptional);
|
|
54623
54652
|
}
|
|
54624
54653
|
if (ts.isPropertyDeclaration(declaration) && (noImplicitAny || ts.isInJSFile(declaration))) {
|
|
@@ -54990,7 +55019,7 @@ var ts;
|
|
|
54990
55019
|
// contextual type or, if the element itself is a binding pattern, with the type implied by that binding
|
|
54991
55020
|
// pattern.
|
|
54992
55021
|
var contextualType = ts.isBindingPattern(element.name) ? getTypeFromBindingPattern(element.name, /*includePatternInType*/ true, /*reportErrors*/ false) : unknownType;
|
|
54993
|
-
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, contextualType)));
|
|
55022
|
+
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType)));
|
|
54994
55023
|
}
|
|
54995
55024
|
if (ts.isBindingPattern(element.name)) {
|
|
54996
55025
|
return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors);
|
|
@@ -55079,7 +55108,7 @@ var ts;
|
|
|
55079
55108
|
// binding pattern [x, s = ""]. Because the contextual type is a tuple type, the resulting type of [1, "one"] is the
|
|
55080
55109
|
// tuple type [number, string]. Thus, the type inferred for 'x' is number and the type inferred for 's' is string.
|
|
55081
55110
|
function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) {
|
|
55082
|
-
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true), declaration, reportErrors);
|
|
55111
|
+
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true, 0 /* Normal */), declaration, reportErrors);
|
|
55083
55112
|
}
|
|
55084
55113
|
function isGlobalSymbolConstructor(node) {
|
|
55085
55114
|
var symbol = getSymbolOfNode(node);
|
|
@@ -55168,9 +55197,9 @@ var ts;
|
|
|
55168
55197
|
if (typeNode === undefined) {
|
|
55169
55198
|
return useUnknownInCatchVariables ? unknownType : anyType;
|
|
55170
55199
|
}
|
|
55171
|
-
var
|
|
55200
|
+
var type_2 = getTypeOfNode(typeNode);
|
|
55172
55201
|
// an errorType will make `checkTryStatement` issue an error
|
|
55173
|
-
return isTypeAny(
|
|
55202
|
+
return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType;
|
|
55174
55203
|
}
|
|
55175
55204
|
// Handle export default expressions
|
|
55176
55205
|
if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
|
|
@@ -55308,10 +55337,12 @@ var ts;
|
|
|
55308
55337
|
if (writing === void 0) { writing = false; }
|
|
55309
55338
|
var getter = ts.getDeclarationOfKind(symbol, 171 /* GetAccessor */);
|
|
55310
55339
|
var setter = ts.getDeclarationOfKind(symbol, 172 /* SetAccessor */);
|
|
55311
|
-
var setterType = getAnnotatedAccessorType(setter);
|
|
55312
55340
|
// For write operations, prioritize type annotations on the setter
|
|
55313
|
-
if (writing
|
|
55314
|
-
|
|
55341
|
+
if (writing) {
|
|
55342
|
+
var setterType_1 = getAnnotatedAccessorType(setter);
|
|
55343
|
+
if (setterType_1) {
|
|
55344
|
+
return instantiateTypeIfNeeded(setterType_1, symbol);
|
|
55345
|
+
}
|
|
55315
55346
|
}
|
|
55316
55347
|
// Else defer to the getter type
|
|
55317
55348
|
if (getter && ts.isInJSFile(getter)) {
|
|
@@ -55326,6 +55357,7 @@ var ts;
|
|
|
55326
55357
|
return instantiateTypeIfNeeded(getterType, symbol);
|
|
55327
55358
|
}
|
|
55328
55359
|
// If the user didn't specify a return type, try to use the set-accessor's parameter type.
|
|
55360
|
+
var setterType = getAnnotatedAccessorType(setter);
|
|
55329
55361
|
if (setterType) {
|
|
55330
55362
|
return setterType;
|
|
55331
55363
|
}
|
|
@@ -55396,11 +55428,11 @@ var ts;
|
|
|
55396
55428
|
return errorType;
|
|
55397
55429
|
}
|
|
55398
55430
|
var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
|
|
55399
|
-
var
|
|
55431
|
+
var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
|
|
55400
55432
|
if (!popTypeResolution()) {
|
|
55401
55433
|
return reportCircularityError(symbol);
|
|
55402
55434
|
}
|
|
55403
|
-
return
|
|
55435
|
+
return type_3;
|
|
55404
55436
|
}
|
|
55405
55437
|
}
|
|
55406
55438
|
var type = createObjectType(16 /* Anonymous */, symbol);
|
|
@@ -55474,6 +55506,39 @@ var ts;
|
|
|
55474
55506
|
}
|
|
55475
55507
|
return links.type;
|
|
55476
55508
|
}
|
|
55509
|
+
function getWriteTypeOfSymbolWithDeferredType(symbol) {
|
|
55510
|
+
var links = getSymbolLinks(symbol);
|
|
55511
|
+
if (!links.writeType && links.deferralWriteConstituents) {
|
|
55512
|
+
ts.Debug.assertIsDefined(links.deferralParent);
|
|
55513
|
+
ts.Debug.assertIsDefined(links.deferralConstituents);
|
|
55514
|
+
links.writeType = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);
|
|
55515
|
+
}
|
|
55516
|
+
return links.writeType;
|
|
55517
|
+
}
|
|
55518
|
+
/**
|
|
55519
|
+
* Distinct write types come only from set accessors, but union and intersection
|
|
55520
|
+
* properties deriving from set accessors will either pre-compute or defer the
|
|
55521
|
+
* union or intersection of the writeTypes of their constituents. To account for
|
|
55522
|
+
* this, we will assume that any deferred type or transient symbol may have a
|
|
55523
|
+
* `writeType` (or a deferred write type ready to be computed) that should be
|
|
55524
|
+
* used before looking for set accessor declarations.
|
|
55525
|
+
*/
|
|
55526
|
+
function getWriteTypeOfSymbol(symbol) {
|
|
55527
|
+
var checkFlags = ts.getCheckFlags(symbol);
|
|
55528
|
+
if (checkFlags & 65536 /* DeferredType */) {
|
|
55529
|
+
var writeType = getWriteTypeOfSymbolWithDeferredType(symbol);
|
|
55530
|
+
if (writeType) {
|
|
55531
|
+
return writeType;
|
|
55532
|
+
}
|
|
55533
|
+
}
|
|
55534
|
+
if (symbol.flags & 33554432 /* Transient */) {
|
|
55535
|
+
var writeType = symbol.writeType;
|
|
55536
|
+
if (writeType) {
|
|
55537
|
+
return writeType;
|
|
55538
|
+
}
|
|
55539
|
+
}
|
|
55540
|
+
return getSetAccessorTypeOfSymbol(symbol);
|
|
55541
|
+
}
|
|
55477
55542
|
function getSetAccessorTypeOfSymbol(symbol) {
|
|
55478
55543
|
if (symbol.flags & 98304 /* Accessor */) {
|
|
55479
55544
|
var type = getTypeOfSetAccessor(symbol);
|
|
@@ -57599,10 +57664,10 @@ var ts;
|
|
|
57599
57664
|
var baseTypes = [];
|
|
57600
57665
|
var different = false;
|
|
57601
57666
|
for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
|
|
57602
|
-
var
|
|
57603
|
-
var baseType = getBaseConstraint(
|
|
57667
|
+
var type_4 = types_7[_i];
|
|
57668
|
+
var baseType = getBaseConstraint(type_4);
|
|
57604
57669
|
if (baseType) {
|
|
57605
|
-
if (baseType !==
|
|
57670
|
+
if (baseType !== type_4) {
|
|
57606
57671
|
different = true;
|
|
57607
57672
|
}
|
|
57608
57673
|
baseTypes.push(baseType);
|
|
@@ -57844,6 +57909,7 @@ var ts;
|
|
|
57844
57909
|
var firstType;
|
|
57845
57910
|
var nameType;
|
|
57846
57911
|
var propTypes = [];
|
|
57912
|
+
var writeTypes;
|
|
57847
57913
|
var firstValueDeclaration;
|
|
57848
57914
|
var hasNonUniformValueDeclaration = false;
|
|
57849
57915
|
for (var _d = 0, props_1 = props; _d < props_1.length; _d++) {
|
|
@@ -57860,6 +57926,10 @@ var ts;
|
|
|
57860
57926
|
firstType = type;
|
|
57861
57927
|
nameType = getSymbolLinks(prop).nameType;
|
|
57862
57928
|
}
|
|
57929
|
+
var writeType = getWriteTypeOfSymbol(prop);
|
|
57930
|
+
if (writeTypes || writeType !== type) {
|
|
57931
|
+
writeTypes = ts.append(!writeTypes ? propTypes.slice() : writeTypes, writeType);
|
|
57932
|
+
}
|
|
57863
57933
|
else if (type !== firstType) {
|
|
57864
57934
|
checkFlags |= 64 /* HasNonUniformType */;
|
|
57865
57935
|
}
|
|
@@ -57888,9 +57958,13 @@ var ts;
|
|
|
57888
57958
|
result.checkFlags |= 65536 /* DeferredType */;
|
|
57889
57959
|
result.deferralParent = containingType;
|
|
57890
57960
|
result.deferralConstituents = propTypes;
|
|
57961
|
+
result.deferralWriteConstituents = writeTypes;
|
|
57891
57962
|
}
|
|
57892
57963
|
else {
|
|
57893
57964
|
result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
|
|
57965
|
+
if (writeTypes) {
|
|
57966
|
+
result.writeType = isUnion ? getUnionType(writeTypes) : getIntersectionType(writeTypes);
|
|
57967
|
+
}
|
|
57894
57968
|
}
|
|
57895
57969
|
return result;
|
|
57896
57970
|
}
|
|
@@ -58306,6 +58380,13 @@ var ts;
|
|
|
58306
58380
|
var typeTag = ts.getJSDocTypeTag(node);
|
|
58307
58381
|
return (typeTag === null || typeTag === void 0 ? void 0 : typeTag.typeExpression) && getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression));
|
|
58308
58382
|
}
|
|
58383
|
+
function getParameterTypeOfTypeTag(func, parameter) {
|
|
58384
|
+
var signature = getSignatureOfTypeTag(func);
|
|
58385
|
+
if (!signature)
|
|
58386
|
+
return undefined;
|
|
58387
|
+
var pos = func.parameters.indexOf(parameter);
|
|
58388
|
+
return parameter.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos);
|
|
58389
|
+
}
|
|
58309
58390
|
function getReturnTypeOfTypeTag(node) {
|
|
58310
58391
|
var signature = getSignatureOfTypeTag(node);
|
|
58311
58392
|
return signature && getReturnTypeOfSignature(signature);
|
|
@@ -59032,7 +59113,7 @@ var ts;
|
|
|
59032
59113
|
}
|
|
59033
59114
|
function getImpliedConstraint(type, checkNode, extendsNode) {
|
|
59034
59115
|
return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) :
|
|
59035
|
-
getActualTypeVariable(getTypeFromTypeNode(checkNode)) === type ? getTypeFromTypeNode(extendsNode) :
|
|
59116
|
+
getActualTypeVariable(getTypeFromTypeNode(checkNode)) === getActualTypeVariable(type) ? getTypeFromTypeNode(extendsNode) :
|
|
59036
59117
|
undefined;
|
|
59037
59118
|
}
|
|
59038
59119
|
function getConditionalFlowTypeOfType(type, node) {
|
|
@@ -59498,7 +59579,7 @@ var ts;
|
|
|
59498
59579
|
}
|
|
59499
59580
|
}
|
|
59500
59581
|
var fixedLength = properties.length;
|
|
59501
|
-
var lengthSymbol = createSymbol(4 /* Property */, "length"
|
|
59582
|
+
var lengthSymbol = createSymbol(4 /* Property */, "length");
|
|
59502
59583
|
if (combinedFlags & 12 /* Variable */) {
|
|
59503
59584
|
lengthSymbol.type = numberType;
|
|
59504
59585
|
}
|
|
@@ -67713,8 +67794,9 @@ var ts;
|
|
|
67713
67794
|
return isMatchingReference(source.expression, target);
|
|
67714
67795
|
case 205 /* PropertyAccessExpression */:
|
|
67715
67796
|
case 206 /* ElementAccessExpression */:
|
|
67716
|
-
|
|
67717
|
-
|
|
67797
|
+
var sourcePropertyName = getAccessedPropertyName(source);
|
|
67798
|
+
var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined;
|
|
67799
|
+
return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName &&
|
|
67718
67800
|
isMatchingReference(source.expression, target.expression);
|
|
67719
67801
|
case 160 /* QualifiedName */:
|
|
67720
67802
|
return ts.isAccessExpression(target) &&
|
|
@@ -67726,12 +67808,49 @@ var ts;
|
|
|
67726
67808
|
return false;
|
|
67727
67809
|
}
|
|
67728
67810
|
function getAccessedPropertyName(access) {
|
|
67729
|
-
|
|
67730
|
-
|
|
67731
|
-
|
|
67732
|
-
|
|
67733
|
-
|
|
67734
|
-
|
|
67811
|
+
if (ts.isPropertyAccessExpression(access)) {
|
|
67812
|
+
return access.name.escapedText;
|
|
67813
|
+
}
|
|
67814
|
+
if (ts.isElementAccessExpression(access)) {
|
|
67815
|
+
return tryGetElementAccessExpressionName(access);
|
|
67816
|
+
}
|
|
67817
|
+
if (ts.isBindingElement(access)) {
|
|
67818
|
+
var name = getDestructuringPropertyName(access);
|
|
67819
|
+
return name ? ts.escapeLeadingUnderscores(name) : undefined;
|
|
67820
|
+
}
|
|
67821
|
+
if (ts.isParameter(access)) {
|
|
67822
|
+
return ("" + access.parent.parameters.indexOf(access));
|
|
67823
|
+
}
|
|
67824
|
+
return undefined;
|
|
67825
|
+
}
|
|
67826
|
+
function tryGetNameFromType(type) {
|
|
67827
|
+
return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName :
|
|
67828
|
+
type.flags & 384 /* StringOrNumberLiteral */ ? ts.escapeLeadingUnderscores("" + type.value) : undefined;
|
|
67829
|
+
}
|
|
67830
|
+
function tryGetElementAccessExpressionName(node) {
|
|
67831
|
+
if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
|
|
67832
|
+
return ts.escapeLeadingUnderscores(node.argumentExpression.text);
|
|
67833
|
+
}
|
|
67834
|
+
if (ts.isIdentifier(node.argumentExpression)) {
|
|
67835
|
+
var symbol = getResolvedSymbol(node.argumentExpression);
|
|
67836
|
+
if (!isConstVariable(symbol))
|
|
67837
|
+
return undefined;
|
|
67838
|
+
var declaration = symbol.valueDeclaration;
|
|
67839
|
+
if (declaration === undefined)
|
|
67840
|
+
return undefined;
|
|
67841
|
+
var type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
67842
|
+
if (type) {
|
|
67843
|
+
var name = tryGetNameFromType(type);
|
|
67844
|
+
if (name !== undefined) {
|
|
67845
|
+
return name;
|
|
67846
|
+
}
|
|
67847
|
+
}
|
|
67848
|
+
if (ts.hasOnlyExpressionInitializer(declaration)) {
|
|
67849
|
+
var initializer = ts.getEffectiveInitializer(declaration);
|
|
67850
|
+
return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
|
|
67851
|
+
}
|
|
67852
|
+
}
|
|
67853
|
+
return undefined;
|
|
67735
67854
|
}
|
|
67736
67855
|
function containsMatchingReference(source, target) {
|
|
67737
67856
|
while (ts.isAccessExpression(source)) {
|
|
@@ -69841,12 +69960,16 @@ var ts;
|
|
|
69841
69960
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
69842
69961
|
return !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
69843
69962
|
}
|
|
69844
|
-
function
|
|
69963
|
+
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
69845
69964
|
// Computing the contextual type for a child of a JSX element involves resolving the type of the
|
|
69846
69965
|
// element's tag name, so we exclude that here to avoid circularities.
|
|
69966
|
+
// If check mode has `CheckMode.RestBindingElement`, we skip binding pattern contextual types,
|
|
69967
|
+
// as we want the type of a rest element to be generic when possible.
|
|
69847
69968
|
var contextualType = (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
|
|
69848
69969
|
!((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
|
|
69849
|
-
|
|
69970
|
+
(checkMode && checkMode & 32 /* RestBindingElement */ ?
|
|
69971
|
+
getContextualType(node, 8 /* SkipBindingPatterns */)
|
|
69972
|
+
: getContextualType(node));
|
|
69850
69973
|
return contextualType && !isGenericType(contextualType);
|
|
69851
69974
|
}
|
|
69852
69975
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
@@ -69859,7 +69982,7 @@ var ts;
|
|
|
69859
69982
|
// 'string | undefined' to give control flow analysis the opportunity to narrow to type 'string'.
|
|
69860
69983
|
var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
|
|
69861
69984
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
69862
|
-
(isConstraintPosition(type, reference) ||
|
|
69985
|
+
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
69863
69986
|
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t; }) : type;
|
|
69864
69987
|
}
|
|
69865
69988
|
function isExportOrExportExpression(location) {
|
|
@@ -69927,7 +70050,7 @@ var ts;
|
|
|
69927
70050
|
var links = getNodeLinks(location);
|
|
69928
70051
|
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
69929
70052
|
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
69930
|
-
var parentType = getTypeForBindingElementParent(parent);
|
|
70053
|
+
var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
69931
70054
|
links.flags &= ~268435456 /* InCheckIdentifier */;
|
|
69932
70055
|
if (parentType && parentType.flags & 1048576 /* Union */ && !(parent.kind === 163 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
69933
70056
|
var pattern = declaration.parent;
|
|
@@ -70780,7 +70903,7 @@ var ts;
|
|
|
70780
70903
|
var parent = declaration.parent.parent;
|
|
70781
70904
|
var name = declaration.propertyName || declaration.name;
|
|
70782
70905
|
var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
|
|
70783
|
-
parent.kind !== 202 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent);
|
|
70906
|
+
parent.kind !== 202 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */);
|
|
70784
70907
|
if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
|
|
70785
70908
|
return undefined;
|
|
70786
70909
|
if (parent.name.kind === 201 /* ArrayBindingPattern */) {
|
|
@@ -73021,7 +73144,7 @@ var ts;
|
|
|
73021
73144
|
error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, ts.idText(right));
|
|
73022
73145
|
return errorType;
|
|
73023
73146
|
}
|
|
73024
|
-
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writing ?
|
|
73147
|
+
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writing ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
|
|
73025
73148
|
}
|
|
73026
73149
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
73027
73150
|
}
|
|
@@ -75491,8 +75614,8 @@ var ts;
|
|
|
75491
75614
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
75492
75615
|
var synthType = type;
|
|
75493
75616
|
if (!synthType.defaultOnlyType) {
|
|
75494
|
-
var
|
|
75495
|
-
synthType.defaultOnlyType =
|
|
75617
|
+
var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
75618
|
+
synthType.defaultOnlyType = type_5;
|
|
75496
75619
|
}
|
|
75497
75620
|
return synthType.defaultOnlyType;
|
|
75498
75621
|
}
|
|
@@ -75946,7 +76069,7 @@ var ts;
|
|
|
75946
76069
|
var links = getSymbolLinks(parameter);
|
|
75947
76070
|
if (!links.type) {
|
|
75948
76071
|
var declaration = parameter.valueDeclaration;
|
|
75949
|
-
links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*
|
|
76072
|
+
links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
|
|
75950
76073
|
if (declaration.name.kind !== 79 /* Identifier */) {
|
|
75951
76074
|
// if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
|
|
75952
76075
|
if (links.type === unknownType) {
|
|
@@ -76219,12 +76342,12 @@ var ts;
|
|
|
76219
76342
|
var witnesses = getSwitchClauseTypeOfWitnesses(node, /*retainDefault*/ false);
|
|
76220
76343
|
// notEqualFacts states that the type of the switched value is not equal to every type in the switch.
|
|
76221
76344
|
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
|
|
76222
|
-
var
|
|
76345
|
+
var type_6 = getBaseConstraintOfType(operandType) || operandType;
|
|
76223
76346
|
// Take any/unknown as a special condition. Or maybe we could change `type` to a union containing all primitive types.
|
|
76224
|
-
if (
|
|
76347
|
+
if (type_6.flags & 3 /* AnyOrUnknown */) {
|
|
76225
76348
|
return (556800 /* AllTypeofNE */ & notEqualFacts_1) === 556800 /* AllTypeofNE */;
|
|
76226
76349
|
}
|
|
76227
|
-
return !!(filterType(
|
|
76350
|
+
return !!(filterType(type_6, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
|
|
76228
76351
|
}
|
|
76229
76352
|
var type = getTypeOfExpression(node.expression);
|
|
76230
76353
|
if (!isLiteralType(type)) {
|
|
@@ -77677,11 +77800,11 @@ var ts;
|
|
|
77677
77800
|
}
|
|
77678
77801
|
}
|
|
77679
77802
|
function checkExpressionCached(node, checkMode) {
|
|
77803
|
+
if (checkMode && checkMode !== 0 /* Normal */) {
|
|
77804
|
+
return checkExpression(node, checkMode);
|
|
77805
|
+
}
|
|
77680
77806
|
var links = getNodeLinks(node);
|
|
77681
77807
|
if (!links.resolvedType) {
|
|
77682
|
-
if (checkMode && checkMode !== 0 /* Normal */) {
|
|
77683
|
-
return checkExpression(node, checkMode);
|
|
77684
|
-
}
|
|
77685
77808
|
// When computing a type that we're going to cache, we need to ignore any ongoing control flow
|
|
77686
77809
|
// analysis because variables may have transient types in indeterminable states. Moving flowLoopStart
|
|
77687
77810
|
// to the top of the stack ensures all transient types are computed from a known point.
|
|
@@ -77701,10 +77824,12 @@ var ts;
|
|
|
77701
77824
|
node.kind === 228 /* AsExpression */ ||
|
|
77702
77825
|
ts.isJSDocTypeAssertion(node);
|
|
77703
77826
|
}
|
|
77704
|
-
function checkDeclarationInitializer(declaration, contextualType) {
|
|
77827
|
+
function checkDeclarationInitializer(declaration, checkMode, contextualType) {
|
|
77705
77828
|
var initializer = ts.getEffectiveInitializer(declaration);
|
|
77706
77829
|
var type = getQuickTypeOfExpression(initializer) ||
|
|
77707
|
-
(contextualType ?
|
|
77830
|
+
(contextualType ?
|
|
77831
|
+
checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* Normal */)
|
|
77832
|
+
: checkExpressionCached(initializer, checkMode));
|
|
77708
77833
|
return ts.isParameter(declaration) && declaration.name.kind === 201 /* ArrayBindingPattern */ &&
|
|
77709
77834
|
isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ?
|
|
77710
77835
|
padTupleType(type, declaration.name) : type;
|
|
@@ -78344,6 +78469,7 @@ var ts;
|
|
|
78344
78469
|
}
|
|
78345
78470
|
}
|
|
78346
78471
|
checkTypeParameters(ts.getEffectiveTypeParameterDeclarations(node));
|
|
78472
|
+
checkUnmatchedJSDocParameters(node);
|
|
78347
78473
|
ts.forEach(node.parameters, checkParameter);
|
|
78348
78474
|
// TODO(rbuckton): Should we start checking JSDoc types?
|
|
78349
78475
|
if (node.type) {
|
|
@@ -79915,31 +80041,6 @@ var ts;
|
|
|
79915
80041
|
}
|
|
79916
80042
|
function checkJSDocParameterTag(node) {
|
|
79917
80043
|
checkSourceElement(node.typeExpression);
|
|
79918
|
-
if (!ts.getParameterSymbolFromJSDoc(node)) {
|
|
79919
|
-
var decl = ts.getHostSignatureFromJSDoc(node);
|
|
79920
|
-
// don't issue an error for invalid hosts -- just functions --
|
|
79921
|
-
// and give a better error message when the host function mentions `arguments`
|
|
79922
|
-
// but the tag doesn't have an array type
|
|
79923
|
-
if (decl) {
|
|
79924
|
-
var i = ts.getJSDocTags(decl).filter(ts.isJSDocParameterTag).indexOf(node);
|
|
79925
|
-
if (i > -1 && i < decl.parameters.length && ts.isBindingPattern(decl.parameters[i].name)) {
|
|
79926
|
-
return;
|
|
79927
|
-
}
|
|
79928
|
-
if (!containsArgumentsReference(decl)) {
|
|
79929
|
-
if (ts.isQualifiedName(node.name)) {
|
|
79930
|
-
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));
|
|
79931
|
-
}
|
|
79932
|
-
else {
|
|
79933
|
-
error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(node.name));
|
|
79934
|
-
}
|
|
79935
|
-
}
|
|
79936
|
-
else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
|
|
79937
|
-
node.typeExpression && node.typeExpression.type &&
|
|
79938
|
-
!isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
|
|
79939
|
-
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 /* QualifiedName */ ? node.name.right : node.name));
|
|
79940
|
-
}
|
|
79941
|
-
}
|
|
79942
|
-
}
|
|
79943
80044
|
}
|
|
79944
80045
|
function checkJSDocPropertyTag(node) {
|
|
79945
80046
|
checkSourceElement(node.typeExpression);
|
|
@@ -80641,7 +80742,8 @@ var ts;
|
|
|
80641
80742
|
}
|
|
80642
80743
|
// check private/protected variable access
|
|
80643
80744
|
var parent = node.parent.parent;
|
|
80644
|
-
var
|
|
80745
|
+
var parentCheckMode = node.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
|
|
80746
|
+
var parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
80645
80747
|
var name = node.propertyName || node.name;
|
|
80646
80748
|
if (parentType && !ts.isBindingPattern(name)) {
|
|
80647
80749
|
var exprType = getLiteralTypeFromPropertyName(name);
|
|
@@ -81880,7 +81982,7 @@ var ts;
|
|
|
81880
81982
|
var declaration = catchClause.variableDeclaration;
|
|
81881
81983
|
var typeNode = ts.getEffectiveTypeAnnotationNode(ts.getRootDeclaration(declaration));
|
|
81882
81984
|
if (typeNode) {
|
|
81883
|
-
var type = getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ false);
|
|
81985
|
+
var type = getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ false, 0 /* Normal */);
|
|
81884
81986
|
if (type && !(type.flags & 3 /* AnyOrUnknown */)) {
|
|
81885
81987
|
grammarErrorOnFirstToken(typeNode, ts.Diagnostics.Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified);
|
|
81886
81988
|
}
|
|
@@ -82011,6 +82113,45 @@ var ts;
|
|
|
82011
82113
|
error(name, ts.Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ts.ModuleKind[moduleKind]); // https://github.com/Microsoft/TypeScript/issues/17494
|
|
82012
82114
|
}
|
|
82013
82115
|
}
|
|
82116
|
+
function checkUnmatchedJSDocParameters(node) {
|
|
82117
|
+
var jsdocParameters = ts.filter(ts.getJSDocTags(node), ts.isJSDocParameterTag);
|
|
82118
|
+
if (!ts.length(jsdocParameters))
|
|
82119
|
+
return;
|
|
82120
|
+
var isJs = ts.isInJSFile(node);
|
|
82121
|
+
var parameters = new ts.Set();
|
|
82122
|
+
var excludedParameters = new ts.Set();
|
|
82123
|
+
ts.forEach(node.parameters, function (_a, index) {
|
|
82124
|
+
var name = _a.name;
|
|
82125
|
+
if (ts.isIdentifier(name)) {
|
|
82126
|
+
parameters.add(name.escapedText);
|
|
82127
|
+
}
|
|
82128
|
+
if (ts.isBindingPattern(name)) {
|
|
82129
|
+
excludedParameters.add(index);
|
|
82130
|
+
}
|
|
82131
|
+
});
|
|
82132
|
+
var containsArguments = containsArgumentsReference(node);
|
|
82133
|
+
if (containsArguments) {
|
|
82134
|
+
var lastJSDocParam = ts.lastOrUndefined(jsdocParameters);
|
|
82135
|
+
if (lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
82136
|
+
lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
82137
|
+
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));
|
|
82138
|
+
}
|
|
82139
|
+
}
|
|
82140
|
+
else {
|
|
82141
|
+
ts.forEach(jsdocParameters, function (_a, index) {
|
|
82142
|
+
var name = _a.name;
|
|
82143
|
+
if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
|
|
82144
|
+
return;
|
|
82145
|
+
}
|
|
82146
|
+
if (ts.isQualifiedName(name)) {
|
|
82147
|
+
errorOrSuggestion(isJs, name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
|
|
82148
|
+
}
|
|
82149
|
+
else {
|
|
82150
|
+
errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
|
|
82151
|
+
}
|
|
82152
|
+
});
|
|
82153
|
+
}
|
|
82154
|
+
}
|
|
82014
82155
|
/**
|
|
82015
82156
|
* Check each type parameter and check that type parameters have no duplicate type parameter declarations
|
|
82016
82157
|
*/
|
|
@@ -82627,7 +82768,7 @@ var ts;
|
|
|
82627
82768
|
}
|
|
82628
82769
|
if (!ts.isStatic(member) && isPropertyWithoutInitializer(member)) {
|
|
82629
82770
|
var propName = member.name;
|
|
82630
|
-
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName)) {
|
|
82771
|
+
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
82631
82772
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
82632
82773
|
if (!(type.flags & 3 /* AnyOrUnknown */ || getFalsyFlags(type) & 32768 /* Undefined */)) {
|
|
82633
82774
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
@@ -82662,7 +82803,9 @@ var ts;
|
|
|
82662
82803
|
return false;
|
|
82663
82804
|
}
|
|
82664
82805
|
function isPropertyInitializedInConstructor(propName, propType, constructor) {
|
|
82665
|
-
var reference = ts.
|
|
82806
|
+
var reference = ts.isComputedPropertyName(propName)
|
|
82807
|
+
? ts.factory.createElementAccessExpression(ts.factory.createThis(), propName.expression)
|
|
82808
|
+
: ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
|
|
82666
82809
|
ts.setParent(reference.expression, reference);
|
|
82667
82810
|
ts.setParent(reference, constructor);
|
|
82668
82811
|
reference.flowNode = constructor.returnFlowNode;
|
|
@@ -82986,7 +83129,7 @@ var ts;
|
|
|
82986
83129
|
var isAmbientExternalModule = ts.isAmbientModule(node);
|
|
82987
83130
|
var contextErrorMessage = isAmbientExternalModule
|
|
82988
83131
|
? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file
|
|
82989
|
-
: ts.Diagnostics.
|
|
83132
|
+
: ts.Diagnostics.A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module;
|
|
82990
83133
|
if (checkGrammarModuleElementContext(node, contextErrorMessage)) {
|
|
82991
83134
|
// If we hit a module declaration in an illegal context, just bail out to avoid cascading errors.
|
|
82992
83135
|
return;
|
|
@@ -83219,6 +83362,9 @@ var ts;
|
|
|
83219
83362
|
var name = ts.idText(node.kind === 269 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
|
|
83220
83363
|
addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name);
|
|
83221
83364
|
}
|
|
83365
|
+
if (isType && node.kind === 264 /* ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* Export */)) {
|
|
83366
|
+
error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided);
|
|
83367
|
+
}
|
|
83222
83368
|
break;
|
|
83223
83369
|
}
|
|
83224
83370
|
case 274 /* ExportSpecifier */: {
|
|
@@ -83302,7 +83448,7 @@ var ts;
|
|
|
83302
83448
|
}
|
|
83303
83449
|
}
|
|
83304
83450
|
function checkImportDeclaration(node) {
|
|
83305
|
-
if (checkGrammarModuleElementContext(node, ts.Diagnostics.
|
|
83451
|
+
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)) {
|
|
83306
83452
|
// If we hit an import declaration in an illegal context, just bail out to avoid cascading errors.
|
|
83307
83453
|
return;
|
|
83308
83454
|
}
|
|
@@ -83335,7 +83481,7 @@ var ts;
|
|
|
83335
83481
|
checkAssertClause(node);
|
|
83336
83482
|
}
|
|
83337
83483
|
function checkImportEqualsDeclaration(node) {
|
|
83338
|
-
if (checkGrammarModuleElementContext(node, ts.Diagnostics.
|
|
83484
|
+
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)) {
|
|
83339
83485
|
// If we hit an import declaration in an illegal context, just bail out to avoid cascading errors.
|
|
83340
83486
|
return;
|
|
83341
83487
|
}
|
|
@@ -83372,7 +83518,7 @@ var ts;
|
|
|
83372
83518
|
}
|
|
83373
83519
|
}
|
|
83374
83520
|
function checkExportDeclaration(node) {
|
|
83375
|
-
if (checkGrammarModuleElementContext(node, ts.Diagnostics.
|
|
83521
|
+
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)) {
|
|
83376
83522
|
// If we hit an export in an illegal context, just bail out to avoid cascading errors.
|
|
83377
83523
|
return;
|
|
83378
83524
|
}
|
|
@@ -84606,7 +84752,7 @@ var ts;
|
|
|
84606
84752
|
return errorType;
|
|
84607
84753
|
}
|
|
84608
84754
|
if (ts.isBindingPattern(node)) {
|
|
84609
|
-
return getTypeForVariableLikeDeclaration(node.parent, /*includeOptionality*/ true) || errorType;
|
|
84755
|
+
return getTypeForVariableLikeDeclaration(node.parent, /*includeOptionality*/ true, 0 /* Normal */) || errorType;
|
|
84610
84756
|
}
|
|
84611
84757
|
if (isInRightSideOfImportOrExportAssignment(node)) {
|
|
84612
84758
|
var symbol = getSymbolAtLocation(node);
|
|
@@ -114353,9 +114499,9 @@ var ts;
|
|
|
114353
114499
|
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
114354
114500
|
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
114355
114501
|
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
114356
|
-
ts.Diagnostics.
|
|
114502
|
+
ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
|
|
114357
114503
|
ts.Diagnostics.An_export_declaration_cannot_have_modifiers.code,
|
|
114358
|
-
ts.Diagnostics.
|
|
114504
|
+
ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
|
|
114359
114505
|
ts.Diagnostics.An_import_declaration_cannot_have_modifiers.code,
|
|
114360
114506
|
ts.Diagnostics.An_object_member_cannot_be_declared_optional.code,
|
|
114361
114507
|
ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
|
|
@@ -115423,7 +115569,7 @@ var ts;
|
|
|
115423
115569
|
ts.Debug.assert(!!sourceFile.bindDiagnostics);
|
|
115424
115570
|
var isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
115425
115571
|
var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
|
|
115426
|
-
var isPlainJs =
|
|
115572
|
+
var isPlainJs = ts.isPlainJsFile(sourceFile, options.checkJs);
|
|
115427
115573
|
var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
|
|
115428
115574
|
// By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External
|
|
115429
115575
|
// - plain JS: .js files with no // ts-check and checkJs: undefined
|