typescript 4.6.0-dev.20220210 → 4.6.0-dev.20220211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +70 -41
- package/lib/tsserver.js +210 -78
- package/lib/tsserverlibrary.js +210 -78
- package/lib/typescript.js +210 -78
- package/lib/typescriptServices.js +210 -78
- package/lib/typingsInstaller.js +70 -44
- 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-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220211";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -5294,6 +5294,7 @@ var ts;
|
|
|
5294
5294
|
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
5295
|
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
5296
|
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."),
|
|
5297
|
+
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
5298
|
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
5299
|
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
5300
|
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."),
|
|
@@ -6852,6 +6853,9 @@ var ts;
|
|
|
6852
6853
|
Add_all_missing_attributes: diag(95168, ts.DiagnosticCategory.Message, "Add_all_missing_attributes_95168", "Add all missing attributes"),
|
|
6853
6854
|
Add_undefined_to_optional_property_type: diag(95169, ts.DiagnosticCategory.Message, "Add_undefined_to_optional_property_type_95169", "Add 'undefined' to optional property type"),
|
|
6854
6855
|
Convert_named_imports_to_default_import: diag(95170, ts.DiagnosticCategory.Message, "Convert_named_imports_to_default_import_95170", "Convert named imports to default import"),
|
|
6856
|
+
Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
|
|
6857
|
+
Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
|
|
6858
|
+
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}'"),
|
|
6855
6859
|
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."),
|
|
6856
6860
|
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'."),
|
|
6857
6861
|
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?"),
|
|
@@ -45060,12 +45064,9 @@ var ts;
|
|
|
45060
45064
|
}
|
|
45061
45065
|
}
|
|
45062
45066
|
if (ts.isInJSFile(declaration)) {
|
|
45063
|
-
var
|
|
45064
|
-
if (
|
|
45065
|
-
|
|
45066
|
-
var pos = func.parameters.indexOf(declaration);
|
|
45067
|
-
return declaration.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos);
|
|
45068
|
-
}
|
|
45067
|
+
var type_1 = getParameterTypeOfTypeTag(func, declaration);
|
|
45068
|
+
if (type_1)
|
|
45069
|
+
return type_1;
|
|
45069
45070
|
}
|
|
45070
45071
|
var type = declaration.symbol.escapedName === "this" ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
|
|
45071
45072
|
if (type) {
|
|
@@ -45557,8 +45558,8 @@ var ts;
|
|
|
45557
45558
|
if (typeNode === undefined) {
|
|
45558
45559
|
return useUnknownInCatchVariables ? unknownType : anyType;
|
|
45559
45560
|
}
|
|
45560
|
-
var
|
|
45561
|
-
return isTypeAny(
|
|
45561
|
+
var type_2 = getTypeOfNode(typeNode);
|
|
45562
|
+
return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType;
|
|
45562
45563
|
}
|
|
45563
45564
|
if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
|
|
45564
45565
|
if (!declaration.statements.length) {
|
|
@@ -45773,11 +45774,11 @@ var ts;
|
|
|
45773
45774
|
return errorType;
|
|
45774
45775
|
}
|
|
45775
45776
|
var exportEquals = getMergedSymbol(symbol.exports.get("export="));
|
|
45776
|
-
var
|
|
45777
|
+
var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
|
|
45777
45778
|
if (!popTypeResolution()) {
|
|
45778
45779
|
return reportCircularityError(symbol);
|
|
45779
45780
|
}
|
|
45780
|
-
return
|
|
45781
|
+
return type_3;
|
|
45781
45782
|
}
|
|
45782
45783
|
}
|
|
45783
45784
|
var type = createObjectType(16, symbol);
|
|
@@ -47710,10 +47711,10 @@ var ts;
|
|
|
47710
47711
|
var baseTypes = [];
|
|
47711
47712
|
var different = false;
|
|
47712
47713
|
for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
|
|
47713
|
-
var
|
|
47714
|
-
var baseType = getBaseConstraint(
|
|
47714
|
+
var type_4 = types_7[_i];
|
|
47715
|
+
var baseType = getBaseConstraint(type_4);
|
|
47715
47716
|
if (baseType) {
|
|
47716
|
-
if (baseType !==
|
|
47717
|
+
if (baseType !== type_4) {
|
|
47717
47718
|
different = true;
|
|
47718
47719
|
}
|
|
47719
47720
|
baseTypes.push(baseType);
|
|
@@ -48323,6 +48324,13 @@ var ts;
|
|
|
48323
48324
|
var typeTag = ts.getJSDocTypeTag(node);
|
|
48324
48325
|
return (typeTag === null || typeTag === void 0 ? void 0 : typeTag.typeExpression) && getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression));
|
|
48325
48326
|
}
|
|
48327
|
+
function getParameterTypeOfTypeTag(func, parameter) {
|
|
48328
|
+
var signature = getSignatureOfTypeTag(func);
|
|
48329
|
+
if (!signature)
|
|
48330
|
+
return undefined;
|
|
48331
|
+
var pos = func.parameters.indexOf(parameter);
|
|
48332
|
+
return parameter.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos);
|
|
48333
|
+
}
|
|
48326
48334
|
function getReturnTypeOfTypeTag(node) {
|
|
48327
48335
|
var signature = getSignatureOfTypeTag(node);
|
|
48328
48336
|
return signature && getReturnTypeOfSignature(signature);
|
|
@@ -63168,8 +63176,8 @@ var ts;
|
|
|
63168
63176
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
63169
63177
|
var synthType = type;
|
|
63170
63178
|
if (!synthType.defaultOnlyType) {
|
|
63171
|
-
var
|
|
63172
|
-
synthType.defaultOnlyType =
|
|
63179
|
+
var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
63180
|
+
synthType.defaultOnlyType = type_5;
|
|
63173
63181
|
}
|
|
63174
63182
|
return synthType.defaultOnlyType;
|
|
63175
63183
|
}
|
|
@@ -63835,11 +63843,11 @@ var ts;
|
|
|
63835
63843
|
var operandType = getTypeOfExpression(node.expression.expression);
|
|
63836
63844
|
var witnesses = getSwitchClauseTypeOfWitnesses(node, false);
|
|
63837
63845
|
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, true);
|
|
63838
|
-
var
|
|
63839
|
-
if (
|
|
63846
|
+
var type_6 = getBaseConstraintOfType(operandType) || operandType;
|
|
63847
|
+
if (type_6.flags & 3) {
|
|
63840
63848
|
return (556800 & notEqualFacts_1) === 556800;
|
|
63841
63849
|
}
|
|
63842
|
-
return !!(filterType(
|
|
63850
|
+
return !!(filterType(type_6, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072);
|
|
63843
63851
|
}
|
|
63844
63852
|
var type = getTypeOfExpression(node.expression);
|
|
63845
63853
|
if (!isLiteralType(type)) {
|
|
@@ -65724,6 +65732,7 @@ var ts;
|
|
|
65724
65732
|
}
|
|
65725
65733
|
}
|
|
65726
65734
|
checkTypeParameters(ts.getEffectiveTypeParameterDeclarations(node));
|
|
65735
|
+
checkUnmatchedJSDocParameters(node);
|
|
65727
65736
|
ts.forEach(node.parameters, checkParameter);
|
|
65728
65737
|
if (node.type) {
|
|
65729
65738
|
checkSourceElement(node.type);
|
|
@@ -67005,28 +67014,6 @@ var ts;
|
|
|
67005
67014
|
}
|
|
67006
67015
|
function checkJSDocParameterTag(node) {
|
|
67007
67016
|
checkSourceElement(node.typeExpression);
|
|
67008
|
-
if (!ts.getParameterSymbolFromJSDoc(node)) {
|
|
67009
|
-
var decl = ts.getHostSignatureFromJSDoc(node);
|
|
67010
|
-
if (decl) {
|
|
67011
|
-
var i = ts.getJSDocTags(decl).filter(ts.isJSDocParameterTag).indexOf(node);
|
|
67012
|
-
if (i > -1 && i < decl.parameters.length && ts.isBindingPattern(decl.parameters[i].name)) {
|
|
67013
|
-
return;
|
|
67014
|
-
}
|
|
67015
|
-
if (!containsArgumentsReference(decl)) {
|
|
67016
|
-
if (ts.isQualifiedName(node.name)) {
|
|
67017
|
-
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));
|
|
67018
|
-
}
|
|
67019
|
-
else {
|
|
67020
|
-
error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(node.name));
|
|
67021
|
-
}
|
|
67022
|
-
}
|
|
67023
|
-
else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
|
|
67024
|
-
node.typeExpression && node.typeExpression.type &&
|
|
67025
|
-
!isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
|
|
67026
|
-
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));
|
|
67027
|
-
}
|
|
67028
|
-
}
|
|
67029
|
-
}
|
|
67030
67017
|
}
|
|
67031
67018
|
function checkJSDocPropertyTag(node) {
|
|
67032
67019
|
checkSourceElement(node.typeExpression);
|
|
@@ -68710,6 +68697,45 @@ var ts;
|
|
|
68710
68697
|
error(name, ts.Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ts.ModuleKind[moduleKind]);
|
|
68711
68698
|
}
|
|
68712
68699
|
}
|
|
68700
|
+
function checkUnmatchedJSDocParameters(node) {
|
|
68701
|
+
var jsdocParameters = ts.filter(ts.getJSDocTags(node), ts.isJSDocParameterTag);
|
|
68702
|
+
if (!ts.length(jsdocParameters))
|
|
68703
|
+
return;
|
|
68704
|
+
var isJs = ts.isInJSFile(node);
|
|
68705
|
+
var parameters = new ts.Set();
|
|
68706
|
+
var excludedParameters = new ts.Set();
|
|
68707
|
+
ts.forEach(node.parameters, function (_a, index) {
|
|
68708
|
+
var name = _a.name;
|
|
68709
|
+
if (ts.isIdentifier(name)) {
|
|
68710
|
+
parameters.add(name.escapedText);
|
|
68711
|
+
}
|
|
68712
|
+
if (ts.isBindingPattern(name)) {
|
|
68713
|
+
excludedParameters.add(index);
|
|
68714
|
+
}
|
|
68715
|
+
});
|
|
68716
|
+
var containsArguments = containsArgumentsReference(node);
|
|
68717
|
+
if (containsArguments) {
|
|
68718
|
+
var lastJSDocParam = ts.lastOrUndefined(jsdocParameters);
|
|
68719
|
+
if (lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
68720
|
+
lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
68721
|
+
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));
|
|
68722
|
+
}
|
|
68723
|
+
}
|
|
68724
|
+
else {
|
|
68725
|
+
ts.forEach(jsdocParameters, function (_a, index) {
|
|
68726
|
+
var name = _a.name;
|
|
68727
|
+
if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
|
|
68728
|
+
return;
|
|
68729
|
+
}
|
|
68730
|
+
if (ts.isQualifiedName(name)) {
|
|
68731
|
+
errorOrSuggestion(isJs, name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
|
|
68732
|
+
}
|
|
68733
|
+
else {
|
|
68734
|
+
errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
|
|
68735
|
+
}
|
|
68736
|
+
});
|
|
68737
|
+
}
|
|
68738
|
+
}
|
|
68713
68739
|
function checkTypeParameters(typeParameterDeclarations) {
|
|
68714
68740
|
if (typeParameterDeclarations) {
|
|
68715
68741
|
var seenDefault = false;
|
|
@@ -69787,6 +69813,9 @@ var ts;
|
|
|
69787
69813
|
var name = ts.idText(node.kind === 269 ? node.propertyName || node.name : node.name);
|
|
69788
69814
|
addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name);
|
|
69789
69815
|
}
|
|
69816
|
+
if (isType && node.kind === 264 && ts.hasEffectiveModifier(node, 1)) {
|
|
69817
|
+
error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided);
|
|
69818
|
+
}
|
|
69790
69819
|
break;
|
|
69791
69820
|
}
|
|
69792
69821
|
case 274: {
|