typescript 4.7.0-dev.20220216 → 4.7.0-dev.20220220
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 +5 -1
- package/lib/de/diagnosticMessages.generated.json +5 -1
- package/lib/es/diagnosticMessages.generated.json +5 -1
- package/lib/fr/diagnosticMessages.generated.json +5 -1
- package/lib/it/diagnosticMessages.generated.json +5 -1
- package/lib/ja/diagnosticMessages.generated.json +5 -1
- package/lib/ko/diagnosticMessages.generated.json +5 -1
- package/lib/lib.es2015.core.d.ts +3 -3
- package/lib/lib.es2021.intl.d.ts +6 -6
- package/lib/lib.es5.d.ts +3 -1
- package/lib/lib.esnext.intl.d.ts +4 -4
- package/lib/pl/diagnosticMessages.generated.json +5 -1
- package/lib/pt-br/diagnosticMessages.generated.json +5 -1
- package/lib/ru/diagnosticMessages.generated.json +5 -1
- package/lib/tr/diagnosticMessages.generated.json +5 -1
- package/lib/tsc.js +296 -212
- package/lib/tsserver.js +366 -262
- package/lib/tsserverlibrary.d.ts +7 -7
- package/lib/tsserverlibrary.js +360 -257
- package/lib/typescript.d.ts +7 -7
- package/lib/typescript.js +360 -257
- package/lib/typescriptServices.d.ts +7 -7
- package/lib/typescriptServices.js +360 -257
- package/lib/typingsInstaller.js +322 -244
- package/lib/zh-cn/diagnosticMessages.generated.json +5 -1
- package/lib/zh-tw/diagnosticMessages.generated.json +5 -1
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220220";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -2617,7 +2617,7 @@ var ts;
|
|
|
2617
2617
|
Debug.checkEachDefined = checkEachDefined;
|
|
2618
2618
|
function assertNever(member, message, stackCrawlMark) {
|
|
2619
2619
|
if (message === void 0) { message = "Illegal value:"; }
|
|
2620
|
-
var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos")
|
|
2620
|
+
var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
|
|
2621
2621
|
return fail(message + " " + detail, stackCrawlMark || assertNever);
|
|
2622
2622
|
}
|
|
2623
2623
|
Debug.assertNever = assertNever;
|
|
@@ -5114,13 +5114,14 @@ var ts;
|
|
|
5114
5114
|
// Flags that require TypeFlags.Object
|
|
5115
5115
|
ObjectFlags[ObjectFlags["ContainsSpread"] = 4194304] = "ContainsSpread";
|
|
5116
5116
|
ObjectFlags[ObjectFlags["ObjectRestType"] = 8388608] = "ObjectRestType";
|
|
5117
|
+
ObjectFlags[ObjectFlags["InstantiationExpressionType"] = 16777216] = "InstantiationExpressionType";
|
|
5117
5118
|
/* @internal */
|
|
5118
|
-
ObjectFlags[ObjectFlags["IsClassInstanceClone"] =
|
|
5119
|
+
ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 33554432] = "IsClassInstanceClone";
|
|
5119
5120
|
// Flags that require TypeFlags.Object and ObjectFlags.Reference
|
|
5120
5121
|
/* @internal */
|
|
5121
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] =
|
|
5122
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 67108864] = "IdenticalBaseTypeCalculated";
|
|
5122
5123
|
/* @internal */
|
|
5123
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] =
|
|
5124
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 134217728] = "IdenticalBaseTypeExists";
|
|
5124
5125
|
// Flags that require TypeFlags.UnionOrIntersection or TypeFlags.Substitution
|
|
5125
5126
|
/* @internal */
|
|
5126
5127
|
ObjectFlags[ObjectFlags["IsGenericTypeComputed"] = 4194304] = "IsGenericTypeComputed";
|
|
@@ -8338,7 +8339,6 @@ var ts;
|
|
|
8338
8339
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
8339
8340
|
Unexpected_token_Did_you_mean_or_gt: diag(1382, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_gt_1382", "Unexpected token. Did you mean `{'>'}` or `>`?"),
|
|
8340
8341
|
Only_named_exports_may_use_export_type: diag(1383, ts.DiagnosticCategory.Error, "Only_named_exports_may_use_export_type_1383", "Only named exports may use 'export type'."),
|
|
8341
|
-
A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list: diag(1384, ts.DiagnosticCategory.Error, "A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list_1384", "A 'new' expression with type arguments must always be followed by a parenthesized argument list."),
|
|
8342
8342
|
Function_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1385, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385", "Function type notation must be parenthesized when used in a union type."),
|
|
8343
8343
|
Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1386, ts.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386", "Constructor type notation must be parenthesized when used in a union type."),
|
|
8344
8344
|
Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
|
|
@@ -8724,6 +8724,7 @@ var ts;
|
|
|
8724
8724
|
Cannot_assign_to_0_because_it_is_an_import: diag(2632, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_an_import_2632", "Cannot assign to '{0}' because it is an import."),
|
|
8725
8725
|
JSX_property_access_expressions_cannot_include_JSX_namespace_names: diag(2633, ts.DiagnosticCategory.Error, "JSX_property_access_expressions_cannot_include_JSX_namespace_names_2633", "JSX property access expressions cannot include JSX namespace names"),
|
|
8726
8726
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8727
|
+
Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
|
|
8727
8728
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
|
|
8728
8729
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
|
|
8729
8730
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
|
|
@@ -9769,7 +9770,7 @@ var ts;
|
|
|
9769
9770
|
Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"),
|
|
9770
9771
|
Wrap_invalid_character_in_an_expression_container: diag(95108, ts.DiagnosticCategory.Message, "Wrap_invalid_character_in_an_expression_container_95108", "Wrap invalid character in an expression container"),
|
|
9771
9772
|
Wrap_all_invalid_characters_in_an_expression_container: diag(95109, ts.DiagnosticCategory.Message, "Wrap_all_invalid_characters_in_an_expression_container_95109", "Wrap all invalid characters in an expression container"),
|
|
9772
|
-
|
|
9773
|
+
Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file: diag(95110, ts.DiagnosticCategory.Message, "Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file_95110", "Visit https://aka.ms/tsconfig to read more about this file"),
|
|
9773
9774
|
Add_a_return_statement: diag(95111, ts.DiagnosticCategory.Message, "Add_a_return_statement_95111", "Add a return statement"),
|
|
9774
9775
|
Remove_braces_from_arrow_function_body: diag(95112, ts.DiagnosticCategory.Message, "Remove_braces_from_arrow_function_body_95112", "Remove braces from arrow function body"),
|
|
9775
9776
|
Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal: diag(95113, ts.DiagnosticCategory.Message, "Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal_95113", "Wrap the following body with parentheses which should be an object literal"),
|
|
@@ -13615,6 +13616,7 @@ var ts;
|
|
|
13615
13616
|
case 110 /* TrueKeyword */:
|
|
13616
13617
|
case 106 /* SuperKeyword */:
|
|
13617
13618
|
case 229 /* NonNullExpression */:
|
|
13619
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
13618
13620
|
case 230 /* MetaProperty */:
|
|
13619
13621
|
case 100 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
|
|
13620
13622
|
return true;
|
|
@@ -15328,7 +15330,7 @@ var ts;
|
|
|
15328
15330
|
case 114 /* VoidKeyword */:
|
|
15329
15331
|
return node.parent.kind !== 216 /* VoidExpression */;
|
|
15330
15332
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15331
|
-
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
|
15333
|
+
return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
|
15332
15334
|
case 162 /* TypeParameter */:
|
|
15333
15335
|
return node.parent.kind === 194 /* MappedType */ || node.parent.kind === 189 /* InferType */;
|
|
15334
15336
|
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
|
@@ -15365,7 +15367,7 @@ var ts;
|
|
|
15365
15367
|
}
|
|
15366
15368
|
switch (parent.kind) {
|
|
15367
15369
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15368
|
-
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15370
|
+
return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15369
15371
|
case 162 /* TypeParameter */:
|
|
15370
15372
|
return node === parent.constraint;
|
|
15371
15373
|
case 342 /* JSDocTemplateTag */:
|
|
@@ -16068,7 +16070,7 @@ var ts;
|
|
|
16068
16070
|
case 296 /* SpreadAssignment */:
|
|
16069
16071
|
return true;
|
|
16070
16072
|
case 227 /* ExpressionWithTypeArguments */:
|
|
16071
|
-
return parent.expression === node &&
|
|
16073
|
+
return parent.expression === node && !isPartOfTypeNode(parent);
|
|
16072
16074
|
case 295 /* ShorthandPropertyAssignment */:
|
|
16073
16075
|
return parent.objectAssignmentInitializer === node;
|
|
16074
16076
|
default:
|
|
@@ -23055,16 +23057,18 @@ var ts;
|
|
|
23055
23057
|
return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type);
|
|
23056
23058
|
}
|
|
23057
23059
|
// @api
|
|
23058
|
-
function createTypeQueryNode(exprName) {
|
|
23060
|
+
function createTypeQueryNode(exprName, typeArguments) {
|
|
23059
23061
|
var node = createBaseNode(180 /* TypeQuery */);
|
|
23060
23062
|
node.exprName = exprName;
|
|
23063
|
+
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
23061
23064
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
23062
23065
|
return node;
|
|
23063
23066
|
}
|
|
23064
23067
|
// @api
|
|
23065
|
-
function updateTypeQueryNode(node, exprName) {
|
|
23068
|
+
function updateTypeQueryNode(node, exprName, typeArguments) {
|
|
23066
23069
|
return node.exprName !== exprName
|
|
23067
|
-
|
|
23070
|
+
|| node.typeArguments !== typeArguments
|
|
23071
|
+
? update(createTypeQueryNode(exprName, typeArguments), node)
|
|
23068
23072
|
: node;
|
|
23069
23073
|
}
|
|
23070
23074
|
// @api
|
|
@@ -30188,7 +30192,8 @@ var ts;
|
|
|
30188
30192
|
visitNode(cbNode, node.parameterName) ||
|
|
30189
30193
|
visitNode(cbNode, node.type);
|
|
30190
30194
|
case 180 /* TypeQuery */:
|
|
30191
|
-
return visitNode(cbNode, node.exprName)
|
|
30195
|
+
return visitNode(cbNode, node.exprName) ||
|
|
30196
|
+
visitNodes(cbNode, cbNodes, node.typeArguments);
|
|
30192
30197
|
case 181 /* TypeLiteral */:
|
|
30193
30198
|
return visitNodes(cbNode, cbNodes, node.members);
|
|
30194
30199
|
case 182 /* ArrayType */:
|
|
@@ -32721,7 +32726,9 @@ var ts;
|
|
|
32721
32726
|
function parseTypeQuery() {
|
|
32722
32727
|
var pos = getNodePos();
|
|
32723
32728
|
parseExpected(112 /* TypeOfKeyword */);
|
|
32724
|
-
|
|
32729
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
32730
|
+
var typeArguments = tryParseTypeArguments();
|
|
32731
|
+
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
32725
32732
|
}
|
|
32726
32733
|
function parseTypeParameter() {
|
|
32727
32734
|
var pos = getNodePos();
|
|
@@ -34791,20 +34798,30 @@ var ts;
|
|
|
34791
34798
|
expression = parsePropertyAccessExpressionRest(pos, expression, questionDotToken);
|
|
34792
34799
|
continue;
|
|
34793
34800
|
}
|
|
34794
|
-
if (!questionDotToken && token() === 53 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
|
|
34795
|
-
nextToken();
|
|
34796
|
-
expression = finishNode(factory.createNonNullExpression(expression), pos);
|
|
34797
|
-
continue;
|
|
34798
|
-
}
|
|
34799
34801
|
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
|
|
34800
34802
|
if ((questionDotToken || !inDecoratorContext()) && parseOptional(22 /* OpenBracketToken */)) {
|
|
34801
34803
|
expression = parseElementAccessExpressionRest(pos, expression, questionDotToken);
|
|
34802
34804
|
continue;
|
|
34803
34805
|
}
|
|
34804
34806
|
if (isTemplateStartOfTaggedTemplate()) {
|
|
34805
|
-
|
|
34807
|
+
// Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments
|
|
34808
|
+
expression = !questionDotToken && expression.kind === 227 /* ExpressionWithTypeArguments */ ?
|
|
34809
|
+
parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) :
|
|
34810
|
+
parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined);
|
|
34806
34811
|
continue;
|
|
34807
34812
|
}
|
|
34813
|
+
if (!questionDotToken) {
|
|
34814
|
+
if (token() === 53 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
|
|
34815
|
+
nextToken();
|
|
34816
|
+
expression = finishNode(factory.createNonNullExpression(expression), pos);
|
|
34817
|
+
continue;
|
|
34818
|
+
}
|
|
34819
|
+
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34820
|
+
if (typeArguments) {
|
|
34821
|
+
expression = finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
34822
|
+
continue;
|
|
34823
|
+
}
|
|
34824
|
+
}
|
|
34808
34825
|
return expression;
|
|
34809
34826
|
}
|
|
34810
34827
|
}
|
|
@@ -34824,38 +34841,30 @@ var ts;
|
|
|
34824
34841
|
function parseCallExpressionRest(pos, expression) {
|
|
34825
34842
|
while (true) {
|
|
34826
34843
|
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
|
|
34844
|
+
var typeArguments = void 0;
|
|
34827
34845
|
var questionDotToken = parseOptionalToken(28 /* QuestionDotToken */);
|
|
34828
|
-
|
|
34829
|
-
|
|
34830
|
-
|
|
34831
|
-
|
|
34832
|
-
// keep checking for postfix expressions. Otherwise, it's just a '<' that's
|
|
34833
|
-
// part of an arithmetic expression. Break out so we consume it higher in the
|
|
34834
|
-
// stack.
|
|
34835
|
-
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34836
|
-
if (typeArguments) {
|
|
34837
|
-
if (isTemplateStartOfTaggedTemplate()) {
|
|
34838
|
-
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
|
|
34839
|
-
continue;
|
|
34840
|
-
}
|
|
34841
|
-
var argumentList = parseArgumentList();
|
|
34842
|
-
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34843
|
-
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
|
|
34844
|
-
factory.createCallExpression(expression, typeArguments, argumentList);
|
|
34845
|
-
expression = finishNode(callExpr, pos);
|
|
34846
|
+
if (questionDotToken) {
|
|
34847
|
+
typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34848
|
+
if (isTemplateStartOfTaggedTemplate()) {
|
|
34849
|
+
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
|
|
34846
34850
|
continue;
|
|
34847
34851
|
}
|
|
34848
34852
|
}
|
|
34849
|
-
|
|
34853
|
+
if (typeArguments || token() === 20 /* OpenParenToken */) {
|
|
34854
|
+
// Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments
|
|
34855
|
+
if (!questionDotToken && expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
34856
|
+
typeArguments = expression.typeArguments;
|
|
34857
|
+
expression = expression.expression;
|
|
34858
|
+
}
|
|
34850
34859
|
var argumentList = parseArgumentList();
|
|
34851
34860
|
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34852
|
-
factory.createCallChain(expression, questionDotToken,
|
|
34853
|
-
factory.createCallExpression(expression,
|
|
34861
|
+
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
|
|
34862
|
+
factory.createCallExpression(expression, typeArguments, argumentList);
|
|
34854
34863
|
expression = finishNode(callExpr, pos);
|
|
34855
34864
|
continue;
|
|
34856
34865
|
}
|
|
34857
34866
|
if (questionDotToken) {
|
|
34858
|
-
// We failed to parse anything, so report a missing identifier here.
|
|
34867
|
+
// We parsed `?.` but then failed to parse anything, so report a missing identifier here.
|
|
34859
34868
|
var name = createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.Identifier_expected);
|
|
34860
34869
|
expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos);
|
|
34861
34870
|
}
|
|
@@ -34883,21 +34892,25 @@ var ts;
|
|
|
34883
34892
|
// If it doesn't have the closing `>` then it's definitely not an type argument list.
|
|
34884
34893
|
return undefined;
|
|
34885
34894
|
}
|
|
34886
|
-
//
|
|
34887
|
-
//
|
|
34888
|
-
|
|
34889
|
-
|
|
34890
|
-
|
|
34895
|
+
// We successfully parsed a type argument list. The next token determines whether we want to
|
|
34896
|
+
// treat it as such. If the type argument list is followed by `(` or a template literal, as in
|
|
34897
|
+
// `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
|
|
34898
|
+
// it as a relational expression.
|
|
34899
|
+
return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined;
|
|
34891
34900
|
}
|
|
34892
34901
|
function canFollowTypeArgumentsInExpression() {
|
|
34893
34902
|
switch (token()) {
|
|
34903
|
+
// These tokens can follow a type argument list in a call expression.
|
|
34894
34904
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
34895
34905
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
34896
34906
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
34897
|
-
//
|
|
34898
|
-
//
|
|
34907
|
+
// These tokens can't follow in a call expression, nor can they start an
|
|
34908
|
+
// expression. So, consider the type argument list part of an instantiation
|
|
34909
|
+
// expression.
|
|
34899
34910
|
// falls through
|
|
34911
|
+
case 27 /* CommaToken */: // foo<x>,
|
|
34900
34912
|
case 24 /* DotToken */: // foo<x>.
|
|
34913
|
+
case 28 /* QuestionDotToken */: // foo<x>?.
|
|
34901
34914
|
case 21 /* CloseParenToken */: // foo<x>)
|
|
34902
34915
|
case 23 /* CloseBracketToken */: // foo<x>]
|
|
34903
34916
|
case 58 /* ColonToken */: // foo<x>:
|
|
@@ -34915,20 +34928,10 @@ var ts;
|
|
|
34915
34928
|
case 51 /* BarToken */: // foo<x> |
|
|
34916
34929
|
case 19 /* CloseBraceToken */: // foo<x> }
|
|
34917
34930
|
case 1 /* EndOfFileToken */: // foo<x>
|
|
34918
|
-
// these cases can't legally follow a type arg list. However, they're not legal
|
|
34919
|
-
// expressions either. The user is probably in the middle of a generic type. So
|
|
34920
|
-
// treat it as such.
|
|
34921
34931
|
return true;
|
|
34922
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
34923
|
-
case 18 /* OpenBraceToken */: // foo<x> {
|
|
34924
|
-
// We don't want to treat these as type arguments. Otherwise we'll parse this
|
|
34925
|
-
// as an invocation expression. Instead, we want to parse out the expression
|
|
34926
|
-
// in isolation from the type arguments.
|
|
34927
|
-
// falls through
|
|
34928
|
-
default:
|
|
34929
|
-
// Anything else treat as an expression.
|
|
34930
|
-
return false;
|
|
34931
34932
|
}
|
|
34933
|
+
// Treat anything else as an expression.
|
|
34934
|
+
return false;
|
|
34932
34935
|
}
|
|
34933
34936
|
function parsePrimaryExpression() {
|
|
34934
34937
|
switch (token()) {
|
|
@@ -35109,26 +35112,15 @@ var ts;
|
|
|
35109
35112
|
return finishNode(factory.createMetaProperty(103 /* NewKeyword */, name), pos);
|
|
35110
35113
|
}
|
|
35111
35114
|
var expressionPos = getNodePos();
|
|
35112
|
-
var expression = parsePrimaryExpression();
|
|
35115
|
+
var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false);
|
|
35113
35116
|
var typeArguments;
|
|
35114
|
-
|
|
35115
|
-
|
|
35116
|
-
typeArguments =
|
|
35117
|
-
|
|
35118
|
-
ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
|
|
35119
|
-
expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
|
|
35120
|
-
typeArguments = undefined;
|
|
35121
|
-
}
|
|
35122
|
-
break;
|
|
35123
|
-
}
|
|
35124
|
-
var argumentsArray;
|
|
35125
|
-
if (token() === 20 /* OpenParenToken */) {
|
|
35126
|
-
argumentsArray = parseArgumentList();
|
|
35127
|
-
}
|
|
35128
|
-
else if (typeArguments) {
|
|
35129
|
-
parseErrorAt(pos, scanner.getStartPos(), ts.Diagnostics.A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list);
|
|
35117
|
+
// Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments
|
|
35118
|
+
if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
35119
|
+
typeArguments = expression.typeArguments;
|
|
35120
|
+
expression = expression.expression;
|
|
35130
35121
|
}
|
|
35131
|
-
|
|
35122
|
+
var argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : undefined;
|
|
35123
|
+
return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos);
|
|
35132
35124
|
}
|
|
35133
35125
|
// STATEMENTS
|
|
35134
35126
|
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
|
|
@@ -36217,6 +36209,9 @@ var ts;
|
|
|
36217
36209
|
function parseExpressionWithTypeArguments() {
|
|
36218
36210
|
var pos = getNodePos();
|
|
36219
36211
|
var expression = parseLeftHandSideExpressionOrHigher();
|
|
36212
|
+
if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
36213
|
+
return expression;
|
|
36214
|
+
}
|
|
36220
36215
|
var typeArguments = tryParseTypeArguments();
|
|
36221
36216
|
return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
36222
36217
|
}
|
|
@@ -40662,7 +40657,7 @@ var ts;
|
|
|
40662
40657
|
var result = [];
|
|
40663
40658
|
result.push("{");
|
|
40664
40659
|
result.push(tab + "\"compilerOptions\": {");
|
|
40665
|
-
result.push("" + tab + tab + "/* " + ts.getLocaleSpecificMessage(ts.Diagnostics.
|
|
40660
|
+
result.push("" + tab + tab + "/* " + ts.getLocaleSpecificMessage(ts.Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file) + " */");
|
|
40666
40661
|
result.push("");
|
|
40667
40662
|
// Print out each row, aligning all the descriptions on the same column.
|
|
40668
40663
|
for (var _a = 0, entries_2 = entries; _a < entries_2.length; _a++) {
|
|
@@ -51225,7 +51220,7 @@ var ts;
|
|
|
51225
51220
|
// get symbol of the first identifier of the entityName
|
|
51226
51221
|
var meaning;
|
|
51227
51222
|
if (entityName.parent.kind === 180 /* TypeQuery */ ||
|
|
51228
|
-
ts.
|
|
51223
|
+
entityName.parent.kind === 227 /* ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) ||
|
|
51229
51224
|
entityName.parent.kind === 161 /* ComputedPropertyName */) {
|
|
51230
51225
|
// Typeof value
|
|
51231
51226
|
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
@@ -51336,7 +51331,7 @@ var ts;
|
|
|
51336
51331
|
return flags & 814775659 /* NodeBuilderFlagsMask */;
|
|
51337
51332
|
}
|
|
51338
51333
|
function isClassInstanceSide(type) {
|
|
51339
|
-
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) &
|
|
51334
|
+
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 33554432 /* IsClassInstanceClone */)));
|
|
51340
51335
|
}
|
|
51341
51336
|
function createNodeBuilder() {
|
|
51342
51337
|
return {
|
|
@@ -55265,7 +55260,7 @@ var ts;
|
|
|
55265
55260
|
members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
|
|
55266
55261
|
result.objectFlags |= (ts.getObjectFlags(type) & 8192 /* JSLiteral */); // Propagate JSLiteral flag
|
|
55267
55262
|
if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
|
|
55268
|
-
result.objectFlags |=
|
|
55263
|
+
result.objectFlags |= 33554432 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
|
|
55269
55264
|
}
|
|
55270
55265
|
return result;
|
|
55271
55266
|
}
|
|
@@ -57311,87 +57306,87 @@ var ts;
|
|
|
57311
57306
|
* Converts an AnonymousType to a ResolvedType.
|
|
57312
57307
|
*/
|
|
57313
57308
|
function resolveAnonymousTypeMembers(type) {
|
|
57314
|
-
var symbol = getMergedSymbol(type.symbol);
|
|
57315
57309
|
if (type.target) {
|
|
57316
57310
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57317
|
-
var
|
|
57311
|
+
var members_6 = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
|
|
57318
57312
|
var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper);
|
|
57319
57313
|
var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper);
|
|
57320
|
-
var
|
|
57321
|
-
setStructuredTypeMembers(type,
|
|
57314
|
+
var indexInfos_1 = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
|
|
57315
|
+
setStructuredTypeMembers(type, members_6, callSignatures, constructSignatures, indexInfos_1);
|
|
57316
|
+
return;
|
|
57322
57317
|
}
|
|
57323
|
-
|
|
57318
|
+
var symbol = getMergedSymbol(type.symbol);
|
|
57319
|
+
if (symbol.flags & 2048 /* TypeLiteral */) {
|
|
57324
57320
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57325
|
-
var
|
|
57326
|
-
var callSignatures = getSignaturesOfSymbol(
|
|
57327
|
-
var constructSignatures = getSignaturesOfSymbol(
|
|
57328
|
-
var
|
|
57329
|
-
setStructuredTypeMembers(type,
|
|
57321
|
+
var members_7 = getMembersOfSymbol(symbol);
|
|
57322
|
+
var callSignatures = getSignaturesOfSymbol(members_7.get("__call" /* Call */));
|
|
57323
|
+
var constructSignatures = getSignaturesOfSymbol(members_7.get("__new" /* New */));
|
|
57324
|
+
var indexInfos_2 = getIndexInfosOfSymbol(symbol);
|
|
57325
|
+
setStructuredTypeMembers(type, members_7, callSignatures, constructSignatures, indexInfos_2);
|
|
57326
|
+
return;
|
|
57330
57327
|
}
|
|
57331
|
-
|
|
57332
|
-
|
|
57333
|
-
|
|
57334
|
-
|
|
57335
|
-
|
|
57336
|
-
|
|
57337
|
-
|
|
57338
|
-
|
|
57339
|
-
|
|
57340
|
-
|
|
57341
|
-
|
|
57342
|
-
|
|
57343
|
-
|
|
57344
|
-
members = varsOnly_1;
|
|
57345
|
-
}
|
|
57328
|
+
// Combinations of function, class, enum and module
|
|
57329
|
+
var members = emptySymbols;
|
|
57330
|
+
var indexInfos;
|
|
57331
|
+
if (symbol.exports) {
|
|
57332
|
+
members = getExportsOfSymbol(symbol);
|
|
57333
|
+
if (symbol === globalThisSymbol) {
|
|
57334
|
+
var varsOnly_1 = new ts.Map();
|
|
57335
|
+
members.forEach(function (p) {
|
|
57336
|
+
if (!(p.flags & 418 /* BlockScoped */)) {
|
|
57337
|
+
varsOnly_1.set(p.escapedName, p);
|
|
57338
|
+
}
|
|
57339
|
+
});
|
|
57340
|
+
members = varsOnly_1;
|
|
57346
57341
|
}
|
|
57347
|
-
|
|
57348
|
-
|
|
57349
|
-
|
|
57350
|
-
|
|
57351
|
-
|
|
57352
|
-
|
|
57353
|
-
|
|
57354
|
-
|
|
57355
|
-
|
|
57356
|
-
else if (baseConstructorType === anyType) {
|
|
57357
|
-
baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
|
|
57358
|
-
}
|
|
57342
|
+
}
|
|
57343
|
+
var baseConstructorIndexInfo;
|
|
57344
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57345
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57346
|
+
var classType = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57347
|
+
var baseConstructorType = getBaseConstructorTypeOfClass(classType);
|
|
57348
|
+
if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
|
|
57349
|
+
members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
|
|
57350
|
+
addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
|
|
57359
57351
|
}
|
|
57360
|
-
|
|
57361
|
-
|
|
57362
|
-
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57352
|
+
else if (baseConstructorType === anyType) {
|
|
57353
|
+
baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
|
|
57363
57354
|
}
|
|
57364
|
-
|
|
57365
|
-
|
|
57366
|
-
|
|
57367
|
-
|
|
57368
|
-
|
|
57369
|
-
|
|
57370
|
-
|
|
57371
|
-
|
|
57355
|
+
}
|
|
57356
|
+
var indexSymbol = getIndexSymbolFromSymbolTable(members);
|
|
57357
|
+
if (indexSymbol) {
|
|
57358
|
+
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57359
|
+
}
|
|
57360
|
+
else {
|
|
57361
|
+
if (baseConstructorIndexInfo) {
|
|
57362
|
+
indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
|
|
57372
57363
|
}
|
|
57373
|
-
|
|
57374
|
-
|
|
57375
|
-
|
|
57376
|
-
// in the process of resolving (see issue #6072). The temporarily empty signature list
|
|
57377
|
-
// will never be observed because a qualified name can't reference signatures.
|
|
57378
|
-
if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
|
|
57379
|
-
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57364
|
+
if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
|
|
57365
|
+
ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
|
|
57366
|
+
indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
|
|
57380
57367
|
}
|
|
57381
|
-
|
|
57382
|
-
|
|
57383
|
-
|
|
57384
|
-
|
|
57385
|
-
|
|
57386
|
-
|
|
57387
|
-
|
|
57388
|
-
|
|
57389
|
-
|
|
57390
|
-
|
|
57391
|
-
|
|
57392
|
-
|
|
57393
|
-
|
|
57368
|
+
}
|
|
57369
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
|
|
57370
|
+
// We resolve the members before computing the signatures because a signature may use
|
|
57371
|
+
// typeof with a qualified name expression that circularly references the type we are
|
|
57372
|
+
// in the process of resolving (see issue #6072). The temporarily empty signature list
|
|
57373
|
+
// will never be observed because a qualified name can't reference signatures.
|
|
57374
|
+
if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
|
|
57375
|
+
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57376
|
+
}
|
|
57377
|
+
// And likewise for construct signatures for classes
|
|
57378
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57379
|
+
var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57380
|
+
var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
|
|
57381
|
+
if (symbol.flags & 16 /* Function */) {
|
|
57382
|
+
constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
|
|
57383
|
+
createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
|
|
57384
|
+
undefined; }));
|
|
57394
57385
|
}
|
|
57386
|
+
if (!constructSignatures.length) {
|
|
57387
|
+
constructSignatures = getDefaultConstructSignatures(classType_1);
|
|
57388
|
+
}
|
|
57389
|
+
type.constructSignatures = constructSignatures;
|
|
57395
57390
|
}
|
|
57396
57391
|
}
|
|
57397
57392
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
@@ -58392,8 +58387,8 @@ var ts;
|
|
|
58392
58387
|
var stringIndexInfo;
|
|
58393
58388
|
var applicableInfo;
|
|
58394
58389
|
var applicableInfos;
|
|
58395
|
-
for (var _i = 0,
|
|
58396
|
-
var info =
|
|
58390
|
+
for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
|
|
58391
|
+
var info = indexInfos_3[_i];
|
|
58397
58392
|
if (info.keyType === stringType) {
|
|
58398
58393
|
stringIndexInfo = info;
|
|
58399
58394
|
}
|
|
@@ -58966,14 +58961,14 @@ var ts;
|
|
|
58966
58961
|
}
|
|
58967
58962
|
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
58968
58963
|
if (indexSymbol.declarations) {
|
|
58969
|
-
var
|
|
58964
|
+
var indexInfos_4 = [];
|
|
58970
58965
|
var _loop_14 = function (declaration) {
|
|
58971
58966
|
if (declaration.parameters.length === 1) {
|
|
58972
58967
|
var parameter = declaration.parameters[0];
|
|
58973
58968
|
if (parameter.type) {
|
|
58974
58969
|
forEachType(getTypeFromTypeNode(parameter.type), function (keyType) {
|
|
58975
|
-
if (isValidIndexKeyType(keyType) && !findIndexInfo(
|
|
58976
|
-
|
|
58970
|
+
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_4, keyType)) {
|
|
58971
|
+
indexInfos_4.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
|
|
58977
58972
|
}
|
|
58978
58973
|
});
|
|
58979
58974
|
}
|
|
@@ -58983,7 +58978,7 @@ var ts;
|
|
|
58983
58978
|
var declaration = _a[_i];
|
|
58984
58979
|
_loop_14(declaration);
|
|
58985
58980
|
}
|
|
58986
|
-
return
|
|
58981
|
+
return indexInfos_4;
|
|
58987
58982
|
}
|
|
58988
58983
|
return ts.emptyArray;
|
|
58989
58984
|
}
|
|
@@ -59531,7 +59526,7 @@ var ts;
|
|
|
59531
59526
|
// The expression is processed as an identifier expression (section 4.3)
|
|
59532
59527
|
// or property access expression(section 4.10),
|
|
59533
59528
|
// the widened type(section 3.9) of which becomes the result.
|
|
59534
|
-
var type =
|
|
59529
|
+
var type = checkExpressionWithTypeArguments(node);
|
|
59535
59530
|
links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type));
|
|
59536
59531
|
}
|
|
59537
59532
|
return links.resolvedType;
|
|
@@ -62235,7 +62230,9 @@ var ts;
|
|
|
62235
62230
|
return result;
|
|
62236
62231
|
}
|
|
62237
62232
|
function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
62238
|
-
var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
|
|
62233
|
+
var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
|
|
62234
|
+
type.objectFlags & 16777216 /* InstantiationExpressionType */ ? type.node :
|
|
62235
|
+
type.symbol.declarations[0];
|
|
62239
62236
|
var links = getNodeLinks(declaration);
|
|
62240
62237
|
var target = type.objectFlags & 4 /* Reference */ ? links.resolvedType :
|
|
62241
62238
|
type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
@@ -62251,8 +62248,8 @@ var ts;
|
|
|
62251
62248
|
outerTypeParameters = ts.addRange(outerTypeParameters, templateTagParameters);
|
|
62252
62249
|
}
|
|
62253
62250
|
typeParameters = outerTypeParameters || ts.emptyArray;
|
|
62254
|
-
var allDeclarations_1 = type.objectFlags & 4 /* Reference */ ? [declaration] : type.symbol.declarations;
|
|
62255
|
-
typeParameters = (target.objectFlags & 4 /* Reference */ || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
|
|
62251
|
+
var allDeclarations_1 = type.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) ? [declaration] : type.symbol.declarations;
|
|
62252
|
+
typeParameters = (target.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
|
|
62256
62253
|
ts.filter(typeParameters, function (tp) { return ts.some(allDeclarations_1, function (d) { return isTypeParameterPossiblyReferenced(tp, d); }); }) :
|
|
62257
62254
|
typeParameters;
|
|
62258
62255
|
links.outerTypeParameters = typeParameters;
|
|
@@ -62424,6 +62421,9 @@ var ts;
|
|
|
62424
62421
|
mapper = combineTypeMappers(makeUnaryTypeMapper(origTypeParameter, freshTypeParameter), mapper);
|
|
62425
62422
|
freshTypeParameter.mapper = mapper;
|
|
62426
62423
|
}
|
|
62424
|
+
if (type.objectFlags & 16777216 /* InstantiationExpressionType */) {
|
|
62425
|
+
result.node = type.node;
|
|
62426
|
+
}
|
|
62427
62427
|
result.target = type;
|
|
62428
62428
|
result.mapper = mapper;
|
|
62429
62429
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -63189,10 +63189,6 @@ var ts;
|
|
|
63189
63189
|
if (sourceRestType || targetRestType) {
|
|
63190
63190
|
void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers);
|
|
63191
63191
|
}
|
|
63192
|
-
if (sourceRestType && targetRestType && sourceCount !== targetCount) {
|
|
63193
|
-
// We're not able to relate misaligned complex rest parameters
|
|
63194
|
-
return 0 /* False */;
|
|
63195
|
-
}
|
|
63196
63192
|
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
63197
63193
|
var strictVariance = !(checkMode & 3 /* Callback */) && strictFunctionTypes && kind !== 168 /* MethodDeclaration */ &&
|
|
63198
63194
|
kind !== 167 /* MethodSignature */ && kind !== 170 /* Constructor */;
|
|
@@ -65617,8 +65613,8 @@ var ts;
|
|
|
65617
65613
|
var indexInfos = getIndexInfosOfType(target);
|
|
65618
65614
|
var targetHasStringIndex = ts.some(indexInfos, function (info) { return info.keyType === stringType; });
|
|
65619
65615
|
var result = -1 /* True */;
|
|
65620
|
-
for (var _i = 0,
|
|
65621
|
-
var targetInfo =
|
|
65616
|
+
for (var _i = 0, indexInfos_5 = indexInfos; _i < indexInfos_5.length; _i++) {
|
|
65617
|
+
var targetInfo = indexInfos_5[_i];
|
|
65622
65618
|
var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ :
|
|
65623
65619
|
isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, 3 /* Both */, reportErrors) :
|
|
65624
65620
|
typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState);
|
|
@@ -66225,10 +66221,10 @@ var ts;
|
|
|
66225
66221
|
if (!(ts.getObjectFlags(type) & 4 /* Reference */) || !(ts.getObjectFlags(type.target) & 3 /* ClassOrInterface */)) {
|
|
66226
66222
|
return undefined;
|
|
66227
66223
|
}
|
|
66228
|
-
if (ts.getObjectFlags(type) &
|
|
66229
|
-
return ts.getObjectFlags(type) &
|
|
66224
|
+
if (ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeCalculated */) {
|
|
66225
|
+
return ts.getObjectFlags(type) & 134217728 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
|
|
66230
66226
|
}
|
|
66231
|
-
type.objectFlags |=
|
|
66227
|
+
type.objectFlags |= 67108864 /* IdenticalBaseTypeCalculated */;
|
|
66232
66228
|
var target = type.target;
|
|
66233
66229
|
if (ts.getObjectFlags(target) & 1 /* Class */) {
|
|
66234
66230
|
var baseTypeNode = getBaseTypeNodeOfClass(target);
|
|
@@ -66249,7 +66245,7 @@ var ts;
|
|
|
66249
66245
|
if (ts.length(getTypeArguments(type)) > ts.length(target.typeParameters)) {
|
|
66250
66246
|
instantiatedBase = getTypeWithThisArgument(instantiatedBase, ts.last(getTypeArguments(type)));
|
|
66251
66247
|
}
|
|
66252
|
-
type.objectFlags |=
|
|
66248
|
+
type.objectFlags |= 134217728 /* IdenticalBaseTypeExists */;
|
|
66253
66249
|
return type.cachedEquivalentBaseType = instantiatedBase;
|
|
66254
66250
|
}
|
|
66255
66251
|
function isEmptyLiteralType(type) {
|
|
@@ -66913,7 +66909,7 @@ var ts;
|
|
|
66913
66909
|
var result = !!(type.flags & 465829888 /* Instantiable */ ||
|
|
66914
66910
|
type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || ts.forEach(getTypeArguments(type), couldContainTypeVariables)) ||
|
|
66915
66911
|
objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
|
|
66916
|
-
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */)) ||
|
|
66912
|
+
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */ | 16777216 /* InstantiationExpressionType */)) ||
|
|
66917
66913
|
type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && ts.some(type.types, couldContainTypeVariables));
|
|
66918
66914
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
66919
66915
|
type.objectFlags |= 1048576 /* CouldContainTypeVariablesComputed */ | (result ? 2097152 /* CouldContainTypeVariables */ : 0);
|
|
@@ -67830,8 +67826,8 @@ var ts;
|
|
|
67830
67826
|
var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* Mapped */) ? 8 /* HomomorphicMappedType */ : 0;
|
|
67831
67827
|
var indexInfos = getIndexInfosOfType(target);
|
|
67832
67828
|
if (isObjectTypeWithInferableIndex(source)) {
|
|
67833
|
-
for (var _i = 0,
|
|
67834
|
-
var targetInfo =
|
|
67829
|
+
for (var _i = 0, indexInfos_6 = indexInfos; _i < indexInfos_6.length; _i++) {
|
|
67830
|
+
var targetInfo = indexInfos_6[_i];
|
|
67835
67831
|
var propTypes = [];
|
|
67836
67832
|
for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
|
|
67837
67833
|
var prop = _b[_a];
|
|
@@ -67851,8 +67847,8 @@ var ts;
|
|
|
67851
67847
|
}
|
|
67852
67848
|
}
|
|
67853
67849
|
}
|
|
67854
|
-
for (var _e = 0,
|
|
67855
|
-
var targetInfo =
|
|
67850
|
+
for (var _e = 0, indexInfos_7 = indexInfos; _e < indexInfos_7.length; _e++) {
|
|
67851
|
+
var targetInfo = indexInfos_7[_e];
|
|
67856
67852
|
var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType);
|
|
67857
67853
|
if (sourceInfo) {
|
|
67858
67854
|
inferWithPriority(sourceInfo.type, targetInfo.type, priority);
|
|
@@ -70250,7 +70246,7 @@ var ts;
|
|
|
70250
70246
|
var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
|
|
70251
70247
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
70252
70248
|
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
70253
|
-
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */
|
|
70249
|
+
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
|
|
70254
70250
|
}
|
|
70255
70251
|
function isExportOrExportExpression(location) {
|
|
70256
70252
|
return !!ts.findAncestor(location, function (n) {
|
|
@@ -76016,6 +76012,72 @@ var ts;
|
|
|
76016
76012
|
return node.flags & 32 /* OptionalChain */ ? checkNonNullChain(node) :
|
|
76017
76013
|
getNonNullableType(checkExpression(node.expression));
|
|
76018
76014
|
}
|
|
76015
|
+
function checkExpressionWithTypeArguments(node) {
|
|
76016
|
+
checkGrammarExpressionWithTypeArguments(node);
|
|
76017
|
+
var exprType = node.kind === 227 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) :
|
|
76018
|
+
ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) :
|
|
76019
|
+
checkExpression(node.exprName);
|
|
76020
|
+
var typeArguments = node.typeArguments;
|
|
76021
|
+
if (exprType === silentNeverType || isErrorType(exprType) || !ts.some(typeArguments)) {
|
|
76022
|
+
return exprType;
|
|
76023
|
+
}
|
|
76024
|
+
var hasSomeApplicableSignature = false;
|
|
76025
|
+
var nonApplicableType;
|
|
76026
|
+
var result = getInstantiatedType(exprType);
|
|
76027
|
+
var errorType = hasSomeApplicableSignature ? nonApplicableType : exprType;
|
|
76028
|
+
if (errorType) {
|
|
76029
|
+
diagnostics.add(ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable, typeToString(errorType)));
|
|
76030
|
+
}
|
|
76031
|
+
return result;
|
|
76032
|
+
function getInstantiatedType(type) {
|
|
76033
|
+
var hasSignatures = false;
|
|
76034
|
+
var hasApplicableSignature = false;
|
|
76035
|
+
var result = getInstantiatedTypePart(type);
|
|
76036
|
+
hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
|
|
76037
|
+
if (hasSignatures && !hasApplicableSignature) {
|
|
76038
|
+
nonApplicableType !== null && nonApplicableType !== void 0 ? nonApplicableType : (nonApplicableType = type);
|
|
76039
|
+
}
|
|
76040
|
+
return result;
|
|
76041
|
+
function getInstantiatedTypePart(type) {
|
|
76042
|
+
if (type.flags & 524288 /* Object */) {
|
|
76043
|
+
var resolved = resolveStructuredTypeMembers(type);
|
|
76044
|
+
var callSignatures = getInstantiatedSignatures(resolved.callSignatures);
|
|
76045
|
+
var constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
|
|
76046
|
+
hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
|
|
76047
|
+
hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
|
|
76048
|
+
if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
|
|
76049
|
+
var result_11 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
|
|
76050
|
+
result_11.objectFlags |= 16777216 /* InstantiationExpressionType */;
|
|
76051
|
+
result_11.node = node;
|
|
76052
|
+
return result_11;
|
|
76053
|
+
}
|
|
76054
|
+
}
|
|
76055
|
+
else if (type.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
76056
|
+
var constraint = getBaseConstraintOfType(type);
|
|
76057
|
+
if (constraint) {
|
|
76058
|
+
var instantiated = getInstantiatedTypePart(constraint);
|
|
76059
|
+
if (instantiated !== constraint) {
|
|
76060
|
+
return instantiated;
|
|
76061
|
+
}
|
|
76062
|
+
}
|
|
76063
|
+
}
|
|
76064
|
+
else if (type.flags & 1048576 /* Union */) {
|
|
76065
|
+
return mapType(type, getInstantiatedType);
|
|
76066
|
+
}
|
|
76067
|
+
else if (type.flags & 2097152 /* Intersection */) {
|
|
76068
|
+
return getIntersectionType(ts.sameMap(type.types, getInstantiatedTypePart));
|
|
76069
|
+
}
|
|
76070
|
+
return type;
|
|
76071
|
+
}
|
|
76072
|
+
}
|
|
76073
|
+
function getInstantiatedSignatures(signatures) {
|
|
76074
|
+
var applicableSignatures = ts.filter(signatures, function (sig) { return !!sig.typeParameters && hasCorrectTypeArgumentArity(sig, typeArguments); });
|
|
76075
|
+
return ts.sameMap(applicableSignatures, function (sig) {
|
|
76076
|
+
var typeArgumentTypes = checkTypeArguments(sig, typeArguments, /*reportErrors*/ true);
|
|
76077
|
+
return typeArgumentTypes ? getSignatureInstantiation(sig, typeArgumentTypes, ts.isInJSFile(sig.declaration)) : sig;
|
|
76078
|
+
});
|
|
76079
|
+
}
|
|
76080
|
+
}
|
|
76019
76081
|
function checkMetaProperty(node) {
|
|
76020
76082
|
checkGrammarMetaProperty(node);
|
|
76021
76083
|
if (node.keywordToken === 103 /* NewKeyword */) {
|
|
@@ -77505,7 +77567,7 @@ var ts;
|
|
|
77505
77567
|
if (operator === 55 /* AmpersandAmpersandToken */ || operator === 56 /* BarBarToken */ || operator === 60 /* QuestionQuestionToken */) {
|
|
77506
77568
|
if (operator === 55 /* AmpersandAmpersandToken */) {
|
|
77507
77569
|
var parent = ts.walkUpParenthesizedExpressions(node.parent);
|
|
77508
|
-
checkTestingKnownTruthyCallableOrAwaitableType(node.left,
|
|
77570
|
+
checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
|
|
77509
77571
|
}
|
|
77510
77572
|
checkTruthinessOfType(leftType, node.left);
|
|
77511
77573
|
}
|
|
@@ -78012,8 +78074,8 @@ var ts;
|
|
|
78012
78074
|
return type;
|
|
78013
78075
|
}
|
|
78014
78076
|
function checkConditionalExpression(node, checkMode) {
|
|
78015
|
-
|
|
78016
|
-
checkTestingKnownTruthyCallableOrAwaitableType(node.condition,
|
|
78077
|
+
checkTruthinessExpression(node.condition);
|
|
78078
|
+
checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue);
|
|
78017
78079
|
var type1 = checkExpression(node.whenTrue, checkMode);
|
|
78018
78080
|
var type2 = checkExpression(node.whenFalse, checkMode);
|
|
78019
78081
|
return getUnionType([type1, type2], 2 /* Subtype */);
|
|
@@ -78532,6 +78594,8 @@ var ts;
|
|
|
78532
78594
|
return checkAssertion(node);
|
|
78533
78595
|
case 229 /* NonNullExpression */:
|
|
78534
78596
|
return checkNonNullAssertion(node);
|
|
78597
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
78598
|
+
return checkExpressionWithTypeArguments(node);
|
|
78535
78599
|
case 230 /* MetaProperty */:
|
|
78536
78600
|
return checkMetaProperty(node);
|
|
78537
78601
|
case 214 /* DeleteExpression */:
|
|
@@ -79735,12 +79799,12 @@ var ts;
|
|
|
79735
79799
|
case 264 /* ImportEqualsDeclaration */:
|
|
79736
79800
|
case 267 /* NamespaceImport */:
|
|
79737
79801
|
case 266 /* ImportClause */:
|
|
79738
|
-
var
|
|
79802
|
+
var result_12 = 0 /* None */;
|
|
79739
79803
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
79740
79804
|
ts.forEach(target.declarations, function (d) {
|
|
79741
|
-
|
|
79805
|
+
result_12 |= getDeclarationSpaces(d);
|
|
79742
79806
|
});
|
|
79743
|
-
return
|
|
79807
|
+
return result_12;
|
|
79744
79808
|
case 253 /* VariableDeclaration */:
|
|
79745
79809
|
case 202 /* BindingElement */:
|
|
79746
79810
|
case 255 /* FunctionDeclaration */:
|
|
@@ -81167,50 +81231,59 @@ var ts;
|
|
|
81167
81231
|
function checkIfStatement(node) {
|
|
81168
81232
|
// Grammar checking
|
|
81169
81233
|
checkGrammarStatementInAmbientContext(node);
|
|
81170
|
-
|
|
81171
|
-
checkTestingKnownTruthyCallableOrAwaitableType(node.expression,
|
|
81234
|
+
checkTruthinessExpression(node.expression);
|
|
81235
|
+
checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement);
|
|
81172
81236
|
checkSourceElement(node.thenStatement);
|
|
81173
81237
|
if (node.thenStatement.kind === 235 /* EmptyStatement */) {
|
|
81174
81238
|
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
|
|
81175
81239
|
}
|
|
81176
81240
|
checkSourceElement(node.elseStatement);
|
|
81177
81241
|
}
|
|
81178
|
-
function checkTestingKnownTruthyCallableOrAwaitableType(condExpr,
|
|
81242
|
+
function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) {
|
|
81179
81243
|
if (!strictNullChecks)
|
|
81180
81244
|
return;
|
|
81181
|
-
|
|
81182
|
-
|
|
81183
|
-
|
|
81184
|
-
|
|
81185
|
-
|
|
81186
|
-
|
|
81187
|
-
|
|
81188
|
-
|
|
81189
|
-
|
|
81190
|
-
|
|
81191
|
-
|
|
81192
|
-
|
|
81193
|
-
|
|
81194
|
-
|
|
81195
|
-
|
|
81196
|
-
|
|
81197
|
-
|
|
81198
|
-
|
|
81199
|
-
|
|
81200
|
-
|
|
81201
|
-
|
|
81202
|
-
|
|
81203
|
-
|
|
81204
|
-
}
|
|
81205
|
-
var isUsed = testedSymbol && ts.isBinaryExpression(condExpr.parent) && isSymbolUsedInBinaryExpressionChain(condExpr.parent, testedSymbol)
|
|
81206
|
-
|| testedSymbol && body && isSymbolUsedInConditionBody(condExpr, body, testedNode, testedSymbol);
|
|
81207
|
-
if (!isUsed) {
|
|
81208
|
-
if (isPromise) {
|
|
81209
|
-
errorAndMaybeSuggestAwait(location,
|
|
81210
|
-
/*maybeMissingAwait*/ true, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined, getTypeNameForErrorDisplay(type));
|
|
81245
|
+
helper(condExpr, body);
|
|
81246
|
+
while (ts.isBinaryExpression(condExpr) && condExpr.operatorToken.kind === 56 /* BarBarToken */) {
|
|
81247
|
+
condExpr = condExpr.left;
|
|
81248
|
+
helper(condExpr, body);
|
|
81249
|
+
}
|
|
81250
|
+
function helper(condExpr, body) {
|
|
81251
|
+
var location = ts.isBinaryExpression(condExpr) &&
|
|
81252
|
+
(condExpr.operatorToken.kind === 56 /* BarBarToken */ || condExpr.operatorToken.kind === 55 /* AmpersandAmpersandToken */)
|
|
81253
|
+
? condExpr.right
|
|
81254
|
+
: condExpr;
|
|
81255
|
+
var type = checkTruthinessExpression(location);
|
|
81256
|
+
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
81257
|
+
if (getFalsyFlags(type) || isPropertyExpressionCast)
|
|
81258
|
+
return;
|
|
81259
|
+
// While it technically should be invalid for any known-truthy value
|
|
81260
|
+
// to be tested, we de-scope to functions and Promises unreferenced in
|
|
81261
|
+
// the block as a heuristic to identify the most common bugs. There
|
|
81262
|
+
// are too many false positives for values sourced from type
|
|
81263
|
+
// definitions without strictNullChecks otherwise.
|
|
81264
|
+
var callSignatures = getSignaturesOfType(type, 0 /* Call */);
|
|
81265
|
+
var isPromise = !!getAwaitedTypeOfPromise(type);
|
|
81266
|
+
if (callSignatures.length === 0 && !isPromise) {
|
|
81267
|
+
return;
|
|
81211
81268
|
}
|
|
81212
|
-
|
|
81213
|
-
|
|
81269
|
+
var testedNode = ts.isIdentifier(location) ? location
|
|
81270
|
+
: ts.isPropertyAccessExpression(location) ? location.name
|
|
81271
|
+
: ts.isBinaryExpression(location) && ts.isIdentifier(location.right) ? location.right
|
|
81272
|
+
: undefined;
|
|
81273
|
+
var testedSymbol = testedNode && getSymbolAtLocation(testedNode);
|
|
81274
|
+
if (!testedSymbol && !isPromise) {
|
|
81275
|
+
return;
|
|
81276
|
+
}
|
|
81277
|
+
var isUsed = testedSymbol && ts.isBinaryExpression(condExpr.parent) && isSymbolUsedInBinaryExpressionChain(condExpr.parent, testedSymbol)
|
|
81278
|
+
|| testedSymbol && body && isSymbolUsedInConditionBody(condExpr, body, testedNode, testedSymbol);
|
|
81279
|
+
if (!isUsed) {
|
|
81280
|
+
if (isPromise) {
|
|
81281
|
+
errorAndMaybeSuggestAwait(location,
|
|
81282
|
+
/*maybeMissingAwait*/ true, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined, getTypeNameForErrorDisplay(type));
|
|
81283
|
+
}
|
|
81284
|
+
else {
|
|
81285
|
+
error(location, ts.Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead);
|
|
81286
|
+
}
|
|
81214
81287
|
}
|
|
81215
81288
|
}
|
|
81216
81289
|
}
|
|
@@ -82299,8 +82372,8 @@ var ts;
|
|
|
82299
82372
|
}
|
|
82300
82373
|
}
|
|
82301
82374
|
if (indexInfos.length > 1) {
|
|
82302
|
-
for (var _d = 0,
|
|
82303
|
-
var info =
|
|
82375
|
+
for (var _d = 0, indexInfos_8 = indexInfos; _d < indexInfos_8.length; _d++) {
|
|
82376
|
+
var info = indexInfos_8[_d];
|
|
82304
82377
|
checkIndexConstraintForIndexSignature(type, info);
|
|
82305
82378
|
}
|
|
82306
82379
|
}
|
|
@@ -82326,8 +82399,8 @@ var ts;
|
|
|
82326
82399
|
error(errorNode, ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
|
|
82327
82400
|
}
|
|
82328
82401
|
};
|
|
82329
|
-
for (var _i = 0,
|
|
82330
|
-
var info =
|
|
82402
|
+
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
82403
|
+
var info = indexInfos_9[_i];
|
|
82331
82404
|
_loop_27(info);
|
|
82332
82405
|
}
|
|
82333
82406
|
}
|
|
@@ -82349,8 +82422,8 @@ var ts;
|
|
|
82349
82422
|
error(errorNode, ts.Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3, typeToString(checkInfo.keyType), typeToString(checkInfo.type), typeToString(info.keyType), typeToString(info.type));
|
|
82350
82423
|
}
|
|
82351
82424
|
};
|
|
82352
|
-
for (var _i = 0,
|
|
82353
|
-
var info =
|
|
82425
|
+
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
82426
|
+
var info = indexInfos_10[_i];
|
|
82354
82427
|
_loop_28(info);
|
|
82355
82428
|
}
|
|
82356
82429
|
}
|
|
@@ -82399,9 +82472,9 @@ var ts;
|
|
|
82399
82472
|
var containsArguments = containsArgumentsReference(node);
|
|
82400
82473
|
if (containsArguments) {
|
|
82401
82474
|
var lastJSDocParam = ts.lastOrUndefined(jsdocParameters);
|
|
82402
|
-
if (lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
82475
|
+
if (isJs && lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
82403
82476
|
lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
82404
|
-
|
|
82477
|
+
error(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));
|
|
82405
82478
|
}
|
|
82406
82479
|
}
|
|
82407
82480
|
else {
|
|
@@ -82411,7 +82484,9 @@ var ts;
|
|
|
82411
82484
|
return;
|
|
82412
82485
|
}
|
|
82413
82486
|
if (ts.isQualifiedName(name)) {
|
|
82414
|
-
|
|
82487
|
+
if (isJs) {
|
|
82488
|
+
error(name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
|
|
82489
|
+
}
|
|
82415
82490
|
}
|
|
82416
82491
|
else {
|
|
82417
82492
|
errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
|
|
@@ -84004,10 +84079,10 @@ var ts;
|
|
|
84004
84079
|
}
|
|
84005
84080
|
// ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries.
|
|
84006
84081
|
// (TS Exceptions: namespaces, function overloads, enums, and interfaces)
|
|
84007
|
-
if (flags & (1920 /* Namespace */ |
|
|
84082
|
+
if (flags & (1920 /* Namespace */ | 384 /* Enum */)) {
|
|
84008
84083
|
return;
|
|
84009
84084
|
}
|
|
84010
|
-
var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverloadAndNotAccessor);
|
|
84085
|
+
var exportedDeclarationsCount = ts.countWhere(declarations, ts.and(isNotOverloadAndNotAccessor, ts.not(ts.isInterfaceDeclaration)));
|
|
84011
84086
|
if (flags & 524288 /* TypeAlias */ && exportedDeclarationsCount <= 2) {
|
|
84012
84087
|
// it is legal to merge type alias with other values
|
|
84013
84088
|
// so count should be either 1 (just type alias) or 2 (type alias + merged value)
|
|
@@ -87983,7 +88058,7 @@ var ts;
|
|
|
87983
88058
|
return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
|
|
87984
88059
|
case 180 /* TypeQuery */:
|
|
87985
88060
|
ts.Debug.type(node);
|
|
87986
|
-
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName));
|
|
88061
|
+
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
|
|
87987
88062
|
case 181 /* TypeLiteral */:
|
|
87988
88063
|
ts.Debug.type(node);
|
|
87989
88064
|
return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
|
|
@@ -90875,8 +90950,8 @@ var ts;
|
|
|
90875
90950
|
function generateClassElementDecorationExpressions(node, isStatic) {
|
|
90876
90951
|
var members = getDecoratedClassElements(node, isStatic);
|
|
90877
90952
|
var expressions;
|
|
90878
|
-
for (var _i = 0,
|
|
90879
|
-
var member =
|
|
90953
|
+
for (var _i = 0, members_8 = members; _i < members_8.length; _i++) {
|
|
90954
|
+
var member = members_8[_i];
|
|
90880
90955
|
var expression = generateClassElementDecorationExpression(node, member);
|
|
90881
90956
|
if (expression) {
|
|
90882
90957
|
if (!expressions) {
|
|
@@ -96221,8 +96296,8 @@ var ts;
|
|
|
96221
96296
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
96222
96297
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
96223
96298
|
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
96224
|
-
var
|
|
96225
|
-
return
|
|
96299
|
+
var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
96300
|
+
return result_13 && factory.createPropertyAssignment("children", result_13);
|
|
96226
96301
|
}
|
|
96227
96302
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
96228
96303
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -109860,6 +109935,8 @@ var ts;
|
|
|
109860
109935
|
return emitAsExpression(node);
|
|
109861
109936
|
case 229 /* NonNullExpression */:
|
|
109862
109937
|
return emitNonNullExpression(node);
|
|
109938
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
109939
|
+
return emitExpressionWithTypeArguments(node);
|
|
109863
109940
|
case 230 /* MetaProperty */:
|
|
109864
109941
|
return emitMetaProperty(node);
|
|
109865
109942
|
case 231 /* SyntheticExpression */:
|
|
@@ -110304,6 +110381,7 @@ var ts;
|
|
|
110304
110381
|
writeKeyword("typeof");
|
|
110305
110382
|
writeSpace();
|
|
110306
110383
|
emit(node.exprName);
|
|
110384
|
+
emitTypeArguments(node, node.typeArguments);
|
|
110307
110385
|
}
|
|
110308
110386
|
function emitTypeLiteral(node) {
|
|
110309
110387
|
writePunctuation("{");
|
|
@@ -115277,15 +115355,15 @@ var ts;
|
|
|
115277
115355
|
// which per above occurred during the current program creation.
|
|
115278
115356
|
// Since we assume the filesystem does not change during program creation,
|
|
115279
115357
|
// it is safe to reuse resolutions from the earlier call.
|
|
115280
|
-
var
|
|
115358
|
+
var result_14 = [];
|
|
115281
115359
|
var i = 0;
|
|
115282
115360
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
115283
115361
|
var moduleName = moduleNames_1[_i];
|
|
115284
115362
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
115285
115363
|
i++;
|
|
115286
|
-
|
|
115364
|
+
result_14.push(resolvedModule);
|
|
115287
115365
|
}
|
|
115288
|
-
return
|
|
115366
|
+
return result_14;
|
|
115289
115367
|
}
|
|
115290
115368
|
// At this point, we know at least one of the following hold:
|
|
115291
115369
|
// - file has local declarations for ambient modules
|
|
@@ -120403,9 +120481,9 @@ var ts;
|
|
|
120403
120481
|
if (!preferSymlinks) {
|
|
120404
120482
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
120405
120483
|
// so we only need to remove them from the realpath filenames.
|
|
120406
|
-
var
|
|
120407
|
-
if (
|
|
120408
|
-
return
|
|
120484
|
+
var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
120485
|
+
if (result_15)
|
|
120486
|
+
return result_15;
|
|
120409
120487
|
}
|
|
120410
120488
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
120411
120489
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -120425,10 +120503,10 @@ var ts;
|
|
|
120425
120503
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
120426
120504
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
120427
120505
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
120428
|
-
var
|
|
120506
|
+
var result_16 = cb(option, target === referenceRedirect);
|
|
120429
120507
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
120430
|
-
if (
|
|
120431
|
-
return
|
|
120508
|
+
if (result_16)
|
|
120509
|
+
return result_16;
|
|
120432
120510
|
}
|
|
120433
120511
|
});
|
|
120434
120512
|
});
|
|
@@ -124686,7 +124764,7 @@ var ts;
|
|
|
124686
124764
|
case 199 /* ImportType */:
|
|
124687
124765
|
return !node.parent.isTypeOf;
|
|
124688
124766
|
case 227 /* ExpressionWithTypeArguments */:
|
|
124689
|
-
return
|
|
124767
|
+
return ts.isPartOfTypeNode(node.parent);
|
|
124690
124768
|
}
|
|
124691
124769
|
return false;
|
|
124692
124770
|
}
|
|
@@ -126713,14 +126791,15 @@ var ts;
|
|
|
126713
126791
|
: "linkplain";
|
|
126714
126792
|
var parts = [linkPart("{@" + prefix + " ")];
|
|
126715
126793
|
if (!link.name) {
|
|
126716
|
-
if (link.text)
|
|
126794
|
+
if (link.text) {
|
|
126717
126795
|
parts.push(linkTextPart(link.text));
|
|
126796
|
+
}
|
|
126718
126797
|
}
|
|
126719
126798
|
else {
|
|
126720
126799
|
var symbol = checker === null || checker === void 0 ? void 0 : checker.getSymbolAtLocation(link.name);
|
|
126721
126800
|
var suffix = findLinkNameEnd(link.text);
|
|
126722
126801
|
var name = ts.getTextOfNode(link.name) + link.text.slice(0, suffix);
|
|
126723
|
-
var text = link.text.slice(suffix);
|
|
126802
|
+
var text = skipSeparatorFromLinkText(link.text.slice(suffix));
|
|
126724
126803
|
var decl = (symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) || ((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]);
|
|
126725
126804
|
if (decl) {
|
|
126726
126805
|
parts.push(linkNamePart(name, decl));
|
|
@@ -126735,6 +126814,15 @@ var ts;
|
|
|
126735
126814
|
return parts;
|
|
126736
126815
|
}
|
|
126737
126816
|
ts.buildLinkParts = buildLinkParts;
|
|
126817
|
+
function skipSeparatorFromLinkText(text) {
|
|
126818
|
+
var pos = 0;
|
|
126819
|
+
if (text.charCodeAt(pos++) === 124 /* bar */) {
|
|
126820
|
+
while (pos < text.length && text.charCodeAt(pos) === 32 /* space */)
|
|
126821
|
+
pos++;
|
|
126822
|
+
return text.slice(pos);
|
|
126823
|
+
}
|
|
126824
|
+
return text;
|
|
126825
|
+
}
|
|
126738
126826
|
function findLinkNameEnd(text) {
|
|
126739
126827
|
if (text.indexOf("()") === 0)
|
|
126740
126828
|
return 2;
|
|
@@ -137971,9 +138059,18 @@ var ts;
|
|
|
137971
138059
|
JsDoc.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations;
|
|
137972
138060
|
function getDisplayPartsFromComment(comment, checker) {
|
|
137973
138061
|
if (typeof comment === "string") {
|
|
137974
|
-
return [ts.textPart(comment)];
|
|
138062
|
+
return [ts.textPart(skipSeparatorFromComment(comment))];
|
|
138063
|
+
}
|
|
138064
|
+
return ts.flatMap(comment, function (node) { return node.kind === 319 /* JSDocText */ ? [ts.textPart(skipSeparatorFromComment(node.text))] : ts.buildLinkParts(node, checker); });
|
|
138065
|
+
}
|
|
138066
|
+
function skipSeparatorFromComment(text) {
|
|
138067
|
+
var pos = 0;
|
|
138068
|
+
if (text.charCodeAt(pos++) === 45 /* minus */) {
|
|
138069
|
+
while (pos < text.length && text.charCodeAt(pos) === 32 /* space */)
|
|
138070
|
+
pos++;
|
|
138071
|
+
return text.slice(pos);
|
|
137975
138072
|
}
|
|
137976
|
-
return
|
|
138073
|
+
return text;
|
|
137977
138074
|
}
|
|
137978
138075
|
function getCommentDisplayParts(tag, checker) {
|
|
137979
138076
|
var comment = tag.comment, kind = tag.kind;
|
|
@@ -155351,7 +155448,7 @@ var ts;
|
|
|
155351
155448
|
/*dotDotDotToken*/ undefined,
|
|
155352
155449
|
/*name*/ names && names[i] || "arg" + i,
|
|
155353
155450
|
/*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined,
|
|
155354
|
-
/*type*/ inJs ? undefined : types && types[i] || ts.factory.createKeywordTypeNode(
|
|
155451
|
+
/*type*/ inJs ? undefined : types && types[i] || ts.factory.createKeywordTypeNode(154 /* UnknownKeyword */),
|
|
155355
155452
|
/*initializer*/ undefined);
|
|
155356
155453
|
parameters.push(newParameter);
|
|
155357
155454
|
}
|
|
@@ -155379,11 +155476,10 @@ var ts;
|
|
|
155379
155476
|
var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.name; });
|
|
155380
155477
|
var parameters = createDummyParameters(maxNonRestArgs, maxArgsParameterSymbolNames, /* types */ undefined, minArgumentCount, /*inJs*/ false);
|
|
155381
155478
|
if (someSigHasRestParameter) {
|
|
155382
|
-
var anyArrayType = ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(130 /* AnyKeyword */));
|
|
155383
155479
|
var restParameter = ts.factory.createParameterDeclaration(
|
|
155384
155480
|
/*decorators*/ undefined,
|
|
155385
155481
|
/*modifiers*/ undefined, ts.factory.createToken(25 /* DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest",
|
|
155386
|
-
/*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined,
|
|
155482
|
+
/*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(154 /* UnknownKeyword */)),
|
|
155387
155483
|
/*initializer*/ undefined);
|
|
155388
155484
|
parameters.push(restParameter);
|
|
155389
155485
|
}
|
|
@@ -157629,7 +157725,7 @@ var ts;
|
|
|
157629
157725
|
// cannot find either start or end node
|
|
157630
157726
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
|
|
157631
157727
|
}
|
|
157632
|
-
if (
|
|
157728
|
+
if (start.flags & 4194304 /* JSDoc */) {
|
|
157633
157729
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractJSDoc)] };
|
|
157634
157730
|
}
|
|
157635
157731
|
if (start.parent !== end.parent) {
|
|
@@ -157752,7 +157848,7 @@ var ts;
|
|
|
157752
157848
|
ts.Debug.assert(nodeToCheck.pos <= nodeToCheck.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (1)");
|
|
157753
157849
|
// For understanding how skipTrivia functioned:
|
|
157754
157850
|
ts.Debug.assert(!ts.positionIsSynthesized(nodeToCheck.pos), "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (2)");
|
|
157755
|
-
if (!ts.isStatement(nodeToCheck) && !(ts.isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck))) {
|
|
157851
|
+
if (!ts.isStatement(nodeToCheck) && !(ts.isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck)) && !isStringLiteralJsxAttribute(nodeToCheck)) {
|
|
157756
157852
|
return [ts.createDiagnosticForNode(nodeToCheck, Messages.statementOrExpressionExpected)];
|
|
157757
157853
|
}
|
|
157758
157854
|
if (nodeToCheck.flags & 8388608 /* Ambient */) {
|
|
@@ -157932,13 +158028,16 @@ var ts;
|
|
|
157932
158028
|
if (ts.isStatement(node)) {
|
|
157933
158029
|
return [node];
|
|
157934
158030
|
}
|
|
157935
|
-
|
|
158031
|
+
if (ts.isExpressionNode(node)) {
|
|
157936
158032
|
// If our selection is the expression in an ExpressionStatement, expand
|
|
157937
158033
|
// the selection to include the enclosing Statement (this stops us
|
|
157938
158034
|
// from trying to care about the return value of the extracted function
|
|
157939
158035
|
// and eliminates double semicolon insertion in certain scenarios)
|
|
157940
158036
|
return ts.isExpressionStatement(node.parent) ? [node.parent] : node;
|
|
157941
158037
|
}
|
|
158038
|
+
if (isStringLiteralJsxAttribute(node)) {
|
|
158039
|
+
return node;
|
|
158040
|
+
}
|
|
157942
158041
|
return undefined;
|
|
157943
158042
|
}
|
|
157944
158043
|
function isScope(node) {
|
|
@@ -158748,7 +158847,7 @@ var ts;
|
|
|
158748
158847
|
// Unfortunately, this code takes advantage of the knowledge that the generated method
|
|
158749
158848
|
// will use the contextual type of an expression as the return type of the extracted
|
|
158750
158849
|
// method (and will therefore "use" all the types involved).
|
|
158751
|
-
if (inGenericContext && !isReadonlyArray(targetRange.range)) {
|
|
158850
|
+
if (inGenericContext && !isReadonlyArray(targetRange.range) && !ts.isJsxAttribute(targetRange.range)) {
|
|
158752
158851
|
var contextualType = checker.getContextualType(targetRange.range); // TODO: GH#18217
|
|
158753
158852
|
recordTypeParameterUsages(contextualType);
|
|
158754
158853
|
}
|
|
@@ -159073,7 +159172,11 @@ var ts;
|
|
|
159073
159172
|
}
|
|
159074
159173
|
}
|
|
159075
159174
|
function isInJSXContent(node) {
|
|
159076
|
-
return (
|
|
159175
|
+
return isStringLiteralJsxAttribute(node) ||
|
|
159176
|
+
(ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node) || ts.isJsxFragment(node)) && (ts.isJsxElement(node.parent) || ts.isJsxFragment(node.parent));
|
|
159177
|
+
}
|
|
159178
|
+
function isStringLiteralJsxAttribute(node) {
|
|
159179
|
+
return ts.isStringLiteral(node) && node.parent && ts.isJsxAttribute(node.parent);
|
|
159077
159180
|
}
|
|
159078
159181
|
})(extractSymbol = refactor.extractSymbol || (refactor.extractSymbol = {}));
|
|
159079
159182
|
})(refactor = ts.refactor || (ts.refactor = {}));
|