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/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-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220211";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8069,6 +8069,7 @@ var ts;
|
|
|
8069
8069
|
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
8070
|
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
8071
|
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."),
|
|
8072
|
+
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
8073
|
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
8074
|
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
8075
|
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."),
|
|
@@ -9627,6 +9628,9 @@ var ts;
|
|
|
9627
9628
|
Add_all_missing_attributes: diag(95168, ts.DiagnosticCategory.Message, "Add_all_missing_attributes_95168", "Add all missing attributes"),
|
|
9628
9629
|
Add_undefined_to_optional_property_type: diag(95169, ts.DiagnosticCategory.Message, "Add_undefined_to_optional_property_type_95169", "Add 'undefined' to optional property type"),
|
|
9629
9630
|
Convert_named_imports_to_default_import: diag(95170, ts.DiagnosticCategory.Message, "Convert_named_imports_to_default_import_95170", "Convert named imports to default import"),
|
|
9631
|
+
Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
|
|
9632
|
+
Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
|
|
9633
|
+
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}'"),
|
|
9630
9634
|
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."),
|
|
9631
9635
|
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'."),
|
|
9632
9636
|
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?"),
|
|
@@ -54624,12 +54628,9 @@ var ts;
|
|
|
54624
54628
|
}
|
|
54625
54629
|
}
|
|
54626
54630
|
if (ts.isInJSFile(declaration)) {
|
|
54627
|
-
var
|
|
54628
|
-
if (
|
|
54629
|
-
|
|
54630
|
-
var pos = func.parameters.indexOf(declaration);
|
|
54631
|
-
return declaration.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos);
|
|
54632
|
-
}
|
|
54631
|
+
var type_1 = getParameterTypeOfTypeTag(func, declaration);
|
|
54632
|
+
if (type_1)
|
|
54633
|
+
return type_1;
|
|
54633
54634
|
}
|
|
54634
54635
|
// Use contextual parameter type if one is available
|
|
54635
54636
|
var type = declaration.symbol.escapedName === "this" /* This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
|
|
@@ -55196,9 +55197,9 @@ var ts;
|
|
|
55196
55197
|
if (typeNode === undefined) {
|
|
55197
55198
|
return useUnknownInCatchVariables ? unknownType : anyType;
|
|
55198
55199
|
}
|
|
55199
|
-
var
|
|
55200
|
+
var type_2 = getTypeOfNode(typeNode);
|
|
55200
55201
|
// an errorType will make `checkTryStatement` issue an error
|
|
55201
|
-
return isTypeAny(
|
|
55202
|
+
return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType;
|
|
55202
55203
|
}
|
|
55203
55204
|
// Handle export default expressions
|
|
55204
55205
|
if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
|
|
@@ -55427,11 +55428,11 @@ var ts;
|
|
|
55427
55428
|
return errorType;
|
|
55428
55429
|
}
|
|
55429
55430
|
var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
|
|
55430
|
-
var
|
|
55431
|
+
var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
|
|
55431
55432
|
if (!popTypeResolution()) {
|
|
55432
55433
|
return reportCircularityError(symbol);
|
|
55433
55434
|
}
|
|
55434
|
-
return
|
|
55435
|
+
return type_3;
|
|
55435
55436
|
}
|
|
55436
55437
|
}
|
|
55437
55438
|
var type = createObjectType(16 /* Anonymous */, symbol);
|
|
@@ -57663,10 +57664,10 @@ var ts;
|
|
|
57663
57664
|
var baseTypes = [];
|
|
57664
57665
|
var different = false;
|
|
57665
57666
|
for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
|
|
57666
|
-
var
|
|
57667
|
-
var baseType = getBaseConstraint(
|
|
57667
|
+
var type_4 = types_7[_i];
|
|
57668
|
+
var baseType = getBaseConstraint(type_4);
|
|
57668
57669
|
if (baseType) {
|
|
57669
|
-
if (baseType !==
|
|
57670
|
+
if (baseType !== type_4) {
|
|
57670
57671
|
different = true;
|
|
57671
57672
|
}
|
|
57672
57673
|
baseTypes.push(baseType);
|
|
@@ -58379,6 +58380,13 @@ var ts;
|
|
|
58379
58380
|
var typeTag = ts.getJSDocTypeTag(node);
|
|
58380
58381
|
return (typeTag === null || typeTag === void 0 ? void 0 : typeTag.typeExpression) && getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression));
|
|
58381
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
|
+
}
|
|
58382
58390
|
function getReturnTypeOfTypeTag(node) {
|
|
58383
58391
|
var signature = getSignatureOfTypeTag(node);
|
|
58384
58392
|
return signature && getReturnTypeOfSignature(signature);
|
|
@@ -75568,8 +75576,8 @@ var ts;
|
|
|
75568
75576
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
75569
75577
|
var synthType = type;
|
|
75570
75578
|
if (!synthType.defaultOnlyType) {
|
|
75571
|
-
var
|
|
75572
|
-
synthType.defaultOnlyType =
|
|
75579
|
+
var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
75580
|
+
synthType.defaultOnlyType = type_5;
|
|
75573
75581
|
}
|
|
75574
75582
|
return synthType.defaultOnlyType;
|
|
75575
75583
|
}
|
|
@@ -76296,12 +76304,12 @@ var ts;
|
|
|
76296
76304
|
var witnesses = getSwitchClauseTypeOfWitnesses(node, /*retainDefault*/ false);
|
|
76297
76305
|
// notEqualFacts states that the type of the switched value is not equal to every type in the switch.
|
|
76298
76306
|
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
|
|
76299
|
-
var
|
|
76307
|
+
var type_6 = getBaseConstraintOfType(operandType) || operandType;
|
|
76300
76308
|
// Take any/unknown as a special condition. Or maybe we could change `type` to a union containing all primitive types.
|
|
76301
|
-
if (
|
|
76309
|
+
if (type_6.flags & 3 /* AnyOrUnknown */) {
|
|
76302
76310
|
return (556800 /* AllTypeofNE */ & notEqualFacts_1) === 556800 /* AllTypeofNE */;
|
|
76303
76311
|
}
|
|
76304
|
-
return !!(filterType(
|
|
76312
|
+
return !!(filterType(type_6, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
|
|
76305
76313
|
}
|
|
76306
76314
|
var type = getTypeOfExpression(node.expression);
|
|
76307
76315
|
if (!isLiteralType(type)) {
|
|
@@ -78423,6 +78431,7 @@ var ts;
|
|
|
78423
78431
|
}
|
|
78424
78432
|
}
|
|
78425
78433
|
checkTypeParameters(ts.getEffectiveTypeParameterDeclarations(node));
|
|
78434
|
+
checkUnmatchedJSDocParameters(node);
|
|
78426
78435
|
ts.forEach(node.parameters, checkParameter);
|
|
78427
78436
|
// TODO(rbuckton): Should we start checking JSDoc types?
|
|
78428
78437
|
if (node.type) {
|
|
@@ -79994,31 +80003,6 @@ var ts;
|
|
|
79994
80003
|
}
|
|
79995
80004
|
function checkJSDocParameterTag(node) {
|
|
79996
80005
|
checkSourceElement(node.typeExpression);
|
|
79997
|
-
if (!ts.getParameterSymbolFromJSDoc(node)) {
|
|
79998
|
-
var decl = ts.getHostSignatureFromJSDoc(node);
|
|
79999
|
-
// don't issue an error for invalid hosts -- just functions --
|
|
80000
|
-
// and give a better error message when the host function mentions `arguments`
|
|
80001
|
-
// but the tag doesn't have an array type
|
|
80002
|
-
if (decl) {
|
|
80003
|
-
var i = ts.getJSDocTags(decl).filter(ts.isJSDocParameterTag).indexOf(node);
|
|
80004
|
-
if (i > -1 && i < decl.parameters.length && ts.isBindingPattern(decl.parameters[i].name)) {
|
|
80005
|
-
return;
|
|
80006
|
-
}
|
|
80007
|
-
if (!containsArgumentsReference(decl)) {
|
|
80008
|
-
if (ts.isQualifiedName(node.name)) {
|
|
80009
|
-
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));
|
|
80010
|
-
}
|
|
80011
|
-
else {
|
|
80012
|
-
error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(node.name));
|
|
80013
|
-
}
|
|
80014
|
-
}
|
|
80015
|
-
else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
|
|
80016
|
-
node.typeExpression && node.typeExpression.type &&
|
|
80017
|
-
!isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
|
|
80018
|
-
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));
|
|
80019
|
-
}
|
|
80020
|
-
}
|
|
80021
|
-
}
|
|
80022
80006
|
}
|
|
80023
80007
|
function checkJSDocPropertyTag(node) {
|
|
80024
80008
|
checkSourceElement(node.typeExpression);
|
|
@@ -82091,6 +82075,45 @@ var ts;
|
|
|
82091
82075
|
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
|
|
82092
82076
|
}
|
|
82093
82077
|
}
|
|
82078
|
+
function checkUnmatchedJSDocParameters(node) {
|
|
82079
|
+
var jsdocParameters = ts.filter(ts.getJSDocTags(node), ts.isJSDocParameterTag);
|
|
82080
|
+
if (!ts.length(jsdocParameters))
|
|
82081
|
+
return;
|
|
82082
|
+
var isJs = ts.isInJSFile(node);
|
|
82083
|
+
var parameters = new ts.Set();
|
|
82084
|
+
var excludedParameters = new ts.Set();
|
|
82085
|
+
ts.forEach(node.parameters, function (_a, index) {
|
|
82086
|
+
var name = _a.name;
|
|
82087
|
+
if (ts.isIdentifier(name)) {
|
|
82088
|
+
parameters.add(name.escapedText);
|
|
82089
|
+
}
|
|
82090
|
+
if (ts.isBindingPattern(name)) {
|
|
82091
|
+
excludedParameters.add(index);
|
|
82092
|
+
}
|
|
82093
|
+
});
|
|
82094
|
+
var containsArguments = containsArgumentsReference(node);
|
|
82095
|
+
if (containsArguments) {
|
|
82096
|
+
var lastJSDocParam = ts.lastOrUndefined(jsdocParameters);
|
|
82097
|
+
if (lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
82098
|
+
lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
82099
|
+
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));
|
|
82100
|
+
}
|
|
82101
|
+
}
|
|
82102
|
+
else {
|
|
82103
|
+
ts.forEach(jsdocParameters, function (_a, index) {
|
|
82104
|
+
var name = _a.name;
|
|
82105
|
+
if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
|
|
82106
|
+
return;
|
|
82107
|
+
}
|
|
82108
|
+
if (ts.isQualifiedName(name)) {
|
|
82109
|
+
errorOrSuggestion(isJs, name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
|
|
82110
|
+
}
|
|
82111
|
+
else {
|
|
82112
|
+
errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
|
|
82113
|
+
}
|
|
82114
|
+
});
|
|
82115
|
+
}
|
|
82116
|
+
}
|
|
82094
82117
|
/**
|
|
82095
82118
|
* Check each type parameter and check that type parameters have no duplicate type parameter declarations
|
|
82096
82119
|
*/
|
|
@@ -83299,6 +83322,9 @@ var ts;
|
|
|
83299
83322
|
var name = ts.idText(node.kind === 269 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
|
|
83300
83323
|
addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name);
|
|
83301
83324
|
}
|
|
83325
|
+
if (isType && node.kind === 264 /* ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* Export */)) {
|
|
83326
|
+
error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided);
|
|
83327
|
+
}
|
|
83302
83328
|
break;
|
|
83303
83329
|
}
|
|
83304
83330
|
case 274 /* ExportSpecifier */: {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.6.0-dev.
|
|
5
|
+
"version": "4.6.0-dev.20220211",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|