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/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220220";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -2423,7 +2423,7 @@ var ts;
|
|
|
2423
2423
|
Debug.checkEachDefined = checkEachDefined;
|
|
2424
2424
|
function assertNever(member, message, stackCrawlMark) {
|
|
2425
2425
|
if (message === void 0) { message = "Illegal value:"; }
|
|
2426
|
-
var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos")
|
|
2426
|
+
var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
|
|
2427
2427
|
return fail(message + " " + detail, stackCrawlMark || assertNever);
|
|
2428
2428
|
}
|
|
2429
2429
|
Debug.assertNever = assertNever;
|
|
@@ -4920,13 +4920,14 @@ var ts;
|
|
|
4920
4920
|
// Flags that require TypeFlags.Object
|
|
4921
4921
|
ObjectFlags[ObjectFlags["ContainsSpread"] = 4194304] = "ContainsSpread";
|
|
4922
4922
|
ObjectFlags[ObjectFlags["ObjectRestType"] = 8388608] = "ObjectRestType";
|
|
4923
|
+
ObjectFlags[ObjectFlags["InstantiationExpressionType"] = 16777216] = "InstantiationExpressionType";
|
|
4923
4924
|
/* @internal */
|
|
4924
|
-
ObjectFlags[ObjectFlags["IsClassInstanceClone"] =
|
|
4925
|
+
ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 33554432] = "IsClassInstanceClone";
|
|
4925
4926
|
// Flags that require TypeFlags.Object and ObjectFlags.Reference
|
|
4926
4927
|
/* @internal */
|
|
4927
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] =
|
|
4928
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 67108864] = "IdenticalBaseTypeCalculated";
|
|
4928
4929
|
/* @internal */
|
|
4929
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] =
|
|
4930
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 134217728] = "IdenticalBaseTypeExists";
|
|
4930
4931
|
// Flags that require TypeFlags.UnionOrIntersection or TypeFlags.Substitution
|
|
4931
4932
|
/* @internal */
|
|
4932
4933
|
ObjectFlags[ObjectFlags["IsGenericTypeComputed"] = 4194304] = "IsGenericTypeComputed";
|
|
@@ -8144,7 +8145,6 @@ var ts;
|
|
|
8144
8145
|
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 `}`?"),
|
|
8145
8146
|
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 `>`?"),
|
|
8146
8147
|
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'."),
|
|
8147
|
-
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."),
|
|
8148
8148
|
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."),
|
|
8149
8149
|
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."),
|
|
8150
8150
|
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."),
|
|
@@ -8530,6 +8530,7 @@ var ts;
|
|
|
8530
8530
|
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."),
|
|
8531
8531
|
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"),
|
|
8532
8532
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8533
|
+
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."),
|
|
8533
8534
|
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."),
|
|
8534
8535
|
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."),
|
|
8535
8536
|
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."),
|
|
@@ -9575,7 +9576,7 @@ var ts;
|
|
|
9575
9576
|
Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"),
|
|
9576
9577
|
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"),
|
|
9577
9578
|
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"),
|
|
9578
|
-
|
|
9579
|
+
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"),
|
|
9579
9580
|
Add_a_return_statement: diag(95111, ts.DiagnosticCategory.Message, "Add_a_return_statement_95111", "Add a return statement"),
|
|
9580
9581
|
Remove_braces_from_arrow_function_body: diag(95112, ts.DiagnosticCategory.Message, "Remove_braces_from_arrow_function_body_95112", "Remove braces from arrow function body"),
|
|
9581
9582
|
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"),
|
|
@@ -13421,6 +13422,7 @@ var ts;
|
|
|
13421
13422
|
case 110 /* TrueKeyword */:
|
|
13422
13423
|
case 106 /* SuperKeyword */:
|
|
13423
13424
|
case 229 /* NonNullExpression */:
|
|
13425
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
13424
13426
|
case 230 /* MetaProperty */:
|
|
13425
13427
|
case 100 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
|
|
13426
13428
|
return true;
|
|
@@ -15134,7 +15136,7 @@ var ts;
|
|
|
15134
15136
|
case 114 /* VoidKeyword */:
|
|
15135
15137
|
return node.parent.kind !== 216 /* VoidExpression */;
|
|
15136
15138
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15137
|
-
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
|
15139
|
+
return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
|
15138
15140
|
case 162 /* TypeParameter */:
|
|
15139
15141
|
return node.parent.kind === 194 /* MappedType */ || node.parent.kind === 189 /* InferType */;
|
|
15140
15142
|
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
|
@@ -15171,7 +15173,7 @@ var ts;
|
|
|
15171
15173
|
}
|
|
15172
15174
|
switch (parent.kind) {
|
|
15173
15175
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15174
|
-
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15176
|
+
return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15175
15177
|
case 162 /* TypeParameter */:
|
|
15176
15178
|
return node === parent.constraint;
|
|
15177
15179
|
case 342 /* JSDocTemplateTag */:
|
|
@@ -15874,7 +15876,7 @@ var ts;
|
|
|
15874
15876
|
case 296 /* SpreadAssignment */:
|
|
15875
15877
|
return true;
|
|
15876
15878
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15877
|
-
return parent.expression === node &&
|
|
15879
|
+
return parent.expression === node && !isPartOfTypeNode(parent);
|
|
15878
15880
|
case 295 /* ShorthandPropertyAssignment */:
|
|
15879
15881
|
return parent.objectAssignmentInitializer === node;
|
|
15880
15882
|
default:
|
|
@@ -22861,16 +22863,18 @@ var ts;
|
|
|
22861
22863
|
return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type);
|
|
22862
22864
|
}
|
|
22863
22865
|
// @api
|
|
22864
|
-
function createTypeQueryNode(exprName) {
|
|
22866
|
+
function createTypeQueryNode(exprName, typeArguments) {
|
|
22865
22867
|
var node = createBaseNode(180 /* TypeQuery */);
|
|
22866
22868
|
node.exprName = exprName;
|
|
22869
|
+
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
22867
22870
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
22868
22871
|
return node;
|
|
22869
22872
|
}
|
|
22870
22873
|
// @api
|
|
22871
|
-
function updateTypeQueryNode(node, exprName) {
|
|
22874
|
+
function updateTypeQueryNode(node, exprName, typeArguments) {
|
|
22872
22875
|
return node.exprName !== exprName
|
|
22873
|
-
|
|
22876
|
+
|| node.typeArguments !== typeArguments
|
|
22877
|
+
? update(createTypeQueryNode(exprName, typeArguments), node)
|
|
22874
22878
|
: node;
|
|
22875
22879
|
}
|
|
22876
22880
|
// @api
|
|
@@ -29994,7 +29998,8 @@ var ts;
|
|
|
29994
29998
|
visitNode(cbNode, node.parameterName) ||
|
|
29995
29999
|
visitNode(cbNode, node.type);
|
|
29996
30000
|
case 180 /* TypeQuery */:
|
|
29997
|
-
return visitNode(cbNode, node.exprName)
|
|
30001
|
+
return visitNode(cbNode, node.exprName) ||
|
|
30002
|
+
visitNodes(cbNode, cbNodes, node.typeArguments);
|
|
29998
30003
|
case 181 /* TypeLiteral */:
|
|
29999
30004
|
return visitNodes(cbNode, cbNodes, node.members);
|
|
30000
30005
|
case 182 /* ArrayType */:
|
|
@@ -32527,7 +32532,9 @@ var ts;
|
|
|
32527
32532
|
function parseTypeQuery() {
|
|
32528
32533
|
var pos = getNodePos();
|
|
32529
32534
|
parseExpected(112 /* TypeOfKeyword */);
|
|
32530
|
-
|
|
32535
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
32536
|
+
var typeArguments = tryParseTypeArguments();
|
|
32537
|
+
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
32531
32538
|
}
|
|
32532
32539
|
function parseTypeParameter() {
|
|
32533
32540
|
var pos = getNodePos();
|
|
@@ -34597,20 +34604,30 @@ var ts;
|
|
|
34597
34604
|
expression = parsePropertyAccessExpressionRest(pos, expression, questionDotToken);
|
|
34598
34605
|
continue;
|
|
34599
34606
|
}
|
|
34600
|
-
if (!questionDotToken && token() === 53 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
|
|
34601
|
-
nextToken();
|
|
34602
|
-
expression = finishNode(factory.createNonNullExpression(expression), pos);
|
|
34603
|
-
continue;
|
|
34604
|
-
}
|
|
34605
34607
|
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
|
|
34606
34608
|
if ((questionDotToken || !inDecoratorContext()) && parseOptional(22 /* OpenBracketToken */)) {
|
|
34607
34609
|
expression = parseElementAccessExpressionRest(pos, expression, questionDotToken);
|
|
34608
34610
|
continue;
|
|
34609
34611
|
}
|
|
34610
34612
|
if (isTemplateStartOfTaggedTemplate()) {
|
|
34611
|
-
|
|
34613
|
+
// Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments
|
|
34614
|
+
expression = !questionDotToken && expression.kind === 227 /* ExpressionWithTypeArguments */ ?
|
|
34615
|
+
parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) :
|
|
34616
|
+
parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined);
|
|
34612
34617
|
continue;
|
|
34613
34618
|
}
|
|
34619
|
+
if (!questionDotToken) {
|
|
34620
|
+
if (token() === 53 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
|
|
34621
|
+
nextToken();
|
|
34622
|
+
expression = finishNode(factory.createNonNullExpression(expression), pos);
|
|
34623
|
+
continue;
|
|
34624
|
+
}
|
|
34625
|
+
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34626
|
+
if (typeArguments) {
|
|
34627
|
+
expression = finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
34628
|
+
continue;
|
|
34629
|
+
}
|
|
34630
|
+
}
|
|
34614
34631
|
return expression;
|
|
34615
34632
|
}
|
|
34616
34633
|
}
|
|
@@ -34630,38 +34647,30 @@ var ts;
|
|
|
34630
34647
|
function parseCallExpressionRest(pos, expression) {
|
|
34631
34648
|
while (true) {
|
|
34632
34649
|
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
|
|
34650
|
+
var typeArguments = void 0;
|
|
34633
34651
|
var questionDotToken = parseOptionalToken(28 /* QuestionDotToken */);
|
|
34634
|
-
|
|
34635
|
-
|
|
34636
|
-
|
|
34637
|
-
|
|
34638
|
-
// keep checking for postfix expressions. Otherwise, it's just a '<' that's
|
|
34639
|
-
// part of an arithmetic expression. Break out so we consume it higher in the
|
|
34640
|
-
// stack.
|
|
34641
|
-
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34642
|
-
if (typeArguments) {
|
|
34643
|
-
if (isTemplateStartOfTaggedTemplate()) {
|
|
34644
|
-
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
|
|
34645
|
-
continue;
|
|
34646
|
-
}
|
|
34647
|
-
var argumentList = parseArgumentList();
|
|
34648
|
-
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34649
|
-
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
|
|
34650
|
-
factory.createCallExpression(expression, typeArguments, argumentList);
|
|
34651
|
-
expression = finishNode(callExpr, pos);
|
|
34652
|
+
if (questionDotToken) {
|
|
34653
|
+
typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34654
|
+
if (isTemplateStartOfTaggedTemplate()) {
|
|
34655
|
+
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
|
|
34652
34656
|
continue;
|
|
34653
34657
|
}
|
|
34654
34658
|
}
|
|
34655
|
-
|
|
34659
|
+
if (typeArguments || token() === 20 /* OpenParenToken */) {
|
|
34660
|
+
// Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments
|
|
34661
|
+
if (!questionDotToken && expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
34662
|
+
typeArguments = expression.typeArguments;
|
|
34663
|
+
expression = expression.expression;
|
|
34664
|
+
}
|
|
34656
34665
|
var argumentList = parseArgumentList();
|
|
34657
34666
|
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34658
|
-
factory.createCallChain(expression, questionDotToken,
|
|
34659
|
-
factory.createCallExpression(expression,
|
|
34667
|
+
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
|
|
34668
|
+
factory.createCallExpression(expression, typeArguments, argumentList);
|
|
34660
34669
|
expression = finishNode(callExpr, pos);
|
|
34661
34670
|
continue;
|
|
34662
34671
|
}
|
|
34663
34672
|
if (questionDotToken) {
|
|
34664
|
-
// We failed to parse anything, so report a missing identifier here.
|
|
34673
|
+
// We parsed `?.` but then failed to parse anything, so report a missing identifier here.
|
|
34665
34674
|
var name = createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.Identifier_expected);
|
|
34666
34675
|
expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos);
|
|
34667
34676
|
}
|
|
@@ -34689,21 +34698,25 @@ var ts;
|
|
|
34689
34698
|
// If it doesn't have the closing `>` then it's definitely not an type argument list.
|
|
34690
34699
|
return undefined;
|
|
34691
34700
|
}
|
|
34692
|
-
//
|
|
34693
|
-
//
|
|
34694
|
-
|
|
34695
|
-
|
|
34696
|
-
|
|
34701
|
+
// We successfully parsed a type argument list. The next token determines whether we want to
|
|
34702
|
+
// treat it as such. If the type argument list is followed by `(` or a template literal, as in
|
|
34703
|
+
// `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
|
|
34704
|
+
// it as a relational expression.
|
|
34705
|
+
return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined;
|
|
34697
34706
|
}
|
|
34698
34707
|
function canFollowTypeArgumentsInExpression() {
|
|
34699
34708
|
switch (token()) {
|
|
34709
|
+
// These tokens can follow a type argument list in a call expression.
|
|
34700
34710
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
34701
34711
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
34702
34712
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
34703
|
-
//
|
|
34704
|
-
//
|
|
34713
|
+
// These tokens can't follow in a call expression, nor can they start an
|
|
34714
|
+
// expression. So, consider the type argument list part of an instantiation
|
|
34715
|
+
// expression.
|
|
34705
34716
|
// falls through
|
|
34717
|
+
case 27 /* CommaToken */: // foo<x>,
|
|
34706
34718
|
case 24 /* DotToken */: // foo<x>.
|
|
34719
|
+
case 28 /* QuestionDotToken */: // foo<x>?.
|
|
34707
34720
|
case 21 /* CloseParenToken */: // foo<x>)
|
|
34708
34721
|
case 23 /* CloseBracketToken */: // foo<x>]
|
|
34709
34722
|
case 58 /* ColonToken */: // foo<x>:
|
|
@@ -34721,20 +34734,10 @@ var ts;
|
|
|
34721
34734
|
case 51 /* BarToken */: // foo<x> |
|
|
34722
34735
|
case 19 /* CloseBraceToken */: // foo<x> }
|
|
34723
34736
|
case 1 /* EndOfFileToken */: // foo<x>
|
|
34724
|
-
// these cases can't legally follow a type arg list. However, they're not legal
|
|
34725
|
-
// expressions either. The user is probably in the middle of a generic type. So
|
|
34726
|
-
// treat it as such.
|
|
34727
34737
|
return true;
|
|
34728
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
34729
|
-
case 18 /* OpenBraceToken */: // foo<x> {
|
|
34730
|
-
// We don't want to treat these as type arguments. Otherwise we'll parse this
|
|
34731
|
-
// as an invocation expression. Instead, we want to parse out the expression
|
|
34732
|
-
// in isolation from the type arguments.
|
|
34733
|
-
// falls through
|
|
34734
|
-
default:
|
|
34735
|
-
// Anything else treat as an expression.
|
|
34736
|
-
return false;
|
|
34737
34738
|
}
|
|
34739
|
+
// Treat anything else as an expression.
|
|
34740
|
+
return false;
|
|
34738
34741
|
}
|
|
34739
34742
|
function parsePrimaryExpression() {
|
|
34740
34743
|
switch (token()) {
|
|
@@ -34915,26 +34918,15 @@ var ts;
|
|
|
34915
34918
|
return finishNode(factory.createMetaProperty(103 /* NewKeyword */, name), pos);
|
|
34916
34919
|
}
|
|
34917
34920
|
var expressionPos = getNodePos();
|
|
34918
|
-
var expression = parsePrimaryExpression();
|
|
34921
|
+
var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false);
|
|
34919
34922
|
var typeArguments;
|
|
34920
|
-
|
|
34921
|
-
|
|
34922
|
-
typeArguments =
|
|
34923
|
-
|
|
34924
|
-
ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
|
|
34925
|
-
expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
|
|
34926
|
-
typeArguments = undefined;
|
|
34927
|
-
}
|
|
34928
|
-
break;
|
|
34929
|
-
}
|
|
34930
|
-
var argumentsArray;
|
|
34931
|
-
if (token() === 20 /* OpenParenToken */) {
|
|
34932
|
-
argumentsArray = parseArgumentList();
|
|
34933
|
-
}
|
|
34934
|
-
else if (typeArguments) {
|
|
34935
|
-
parseErrorAt(pos, scanner.getStartPos(), ts.Diagnostics.A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list);
|
|
34923
|
+
// Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments
|
|
34924
|
+
if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
34925
|
+
typeArguments = expression.typeArguments;
|
|
34926
|
+
expression = expression.expression;
|
|
34936
34927
|
}
|
|
34937
|
-
|
|
34928
|
+
var argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : undefined;
|
|
34929
|
+
return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos);
|
|
34938
34930
|
}
|
|
34939
34931
|
// STATEMENTS
|
|
34940
34932
|
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
|
|
@@ -36023,6 +36015,9 @@ var ts;
|
|
|
36023
36015
|
function parseExpressionWithTypeArguments() {
|
|
36024
36016
|
var pos = getNodePos();
|
|
36025
36017
|
var expression = parseLeftHandSideExpressionOrHigher();
|
|
36018
|
+
if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
36019
|
+
return expression;
|
|
36020
|
+
}
|
|
36026
36021
|
var typeArguments = tryParseTypeArguments();
|
|
36027
36022
|
return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
36028
36023
|
}
|
|
@@ -40468,7 +40463,7 @@ var ts;
|
|
|
40468
40463
|
var result = [];
|
|
40469
40464
|
result.push("{");
|
|
40470
40465
|
result.push(tab + "\"compilerOptions\": {");
|
|
40471
|
-
result.push("" + tab + tab + "/* " + ts.getLocaleSpecificMessage(ts.Diagnostics.
|
|
40466
|
+
result.push("" + tab + tab + "/* " + ts.getLocaleSpecificMessage(ts.Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file) + " */");
|
|
40472
40467
|
result.push("");
|
|
40473
40468
|
// Print out each row, aligning all the descriptions on the same column.
|
|
40474
40469
|
for (var _a = 0, entries_2 = entries; _a < entries_2.length; _a++) {
|
|
@@ -51031,7 +51026,7 @@ var ts;
|
|
|
51031
51026
|
// get symbol of the first identifier of the entityName
|
|
51032
51027
|
var meaning;
|
|
51033
51028
|
if (entityName.parent.kind === 180 /* TypeQuery */ ||
|
|
51034
|
-
ts.
|
|
51029
|
+
entityName.parent.kind === 227 /* ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) ||
|
|
51035
51030
|
entityName.parent.kind === 161 /* ComputedPropertyName */) {
|
|
51036
51031
|
// Typeof value
|
|
51037
51032
|
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
@@ -51142,7 +51137,7 @@ var ts;
|
|
|
51142
51137
|
return flags & 814775659 /* NodeBuilderFlagsMask */;
|
|
51143
51138
|
}
|
|
51144
51139
|
function isClassInstanceSide(type) {
|
|
51145
|
-
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) &
|
|
51140
|
+
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 33554432 /* IsClassInstanceClone */)));
|
|
51146
51141
|
}
|
|
51147
51142
|
function createNodeBuilder() {
|
|
51148
51143
|
return {
|
|
@@ -55071,7 +55066,7 @@ var ts;
|
|
|
55071
55066
|
members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
|
|
55072
55067
|
result.objectFlags |= (ts.getObjectFlags(type) & 8192 /* JSLiteral */); // Propagate JSLiteral flag
|
|
55073
55068
|
if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
|
|
55074
|
-
result.objectFlags |=
|
|
55069
|
+
result.objectFlags |= 33554432 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
|
|
55075
55070
|
}
|
|
55076
55071
|
return result;
|
|
55077
55072
|
}
|
|
@@ -57117,87 +57112,87 @@ var ts;
|
|
|
57117
57112
|
* Converts an AnonymousType to a ResolvedType.
|
|
57118
57113
|
*/
|
|
57119
57114
|
function resolveAnonymousTypeMembers(type) {
|
|
57120
|
-
var symbol = getMergedSymbol(type.symbol);
|
|
57121
57115
|
if (type.target) {
|
|
57122
57116
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57123
|
-
var
|
|
57117
|
+
var members_6 = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
|
|
57124
57118
|
var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper);
|
|
57125
57119
|
var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper);
|
|
57126
|
-
var
|
|
57127
|
-
setStructuredTypeMembers(type,
|
|
57120
|
+
var indexInfos_1 = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
|
|
57121
|
+
setStructuredTypeMembers(type, members_6, callSignatures, constructSignatures, indexInfos_1);
|
|
57122
|
+
return;
|
|
57128
57123
|
}
|
|
57129
|
-
|
|
57124
|
+
var symbol = getMergedSymbol(type.symbol);
|
|
57125
|
+
if (symbol.flags & 2048 /* TypeLiteral */) {
|
|
57130
57126
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57131
|
-
var
|
|
57132
|
-
var callSignatures = getSignaturesOfSymbol(
|
|
57133
|
-
var constructSignatures = getSignaturesOfSymbol(
|
|
57134
|
-
var
|
|
57135
|
-
setStructuredTypeMembers(type,
|
|
57127
|
+
var members_7 = getMembersOfSymbol(symbol);
|
|
57128
|
+
var callSignatures = getSignaturesOfSymbol(members_7.get("__call" /* Call */));
|
|
57129
|
+
var constructSignatures = getSignaturesOfSymbol(members_7.get("__new" /* New */));
|
|
57130
|
+
var indexInfos_2 = getIndexInfosOfSymbol(symbol);
|
|
57131
|
+
setStructuredTypeMembers(type, members_7, callSignatures, constructSignatures, indexInfos_2);
|
|
57132
|
+
return;
|
|
57136
57133
|
}
|
|
57137
|
-
|
|
57138
|
-
|
|
57139
|
-
|
|
57140
|
-
|
|
57141
|
-
|
|
57142
|
-
|
|
57143
|
-
|
|
57144
|
-
|
|
57145
|
-
|
|
57146
|
-
|
|
57147
|
-
|
|
57148
|
-
|
|
57149
|
-
|
|
57150
|
-
members = varsOnly_1;
|
|
57151
|
-
}
|
|
57134
|
+
// Combinations of function, class, enum and module
|
|
57135
|
+
var members = emptySymbols;
|
|
57136
|
+
var indexInfos;
|
|
57137
|
+
if (symbol.exports) {
|
|
57138
|
+
members = getExportsOfSymbol(symbol);
|
|
57139
|
+
if (symbol === globalThisSymbol) {
|
|
57140
|
+
var varsOnly_1 = new ts.Map();
|
|
57141
|
+
members.forEach(function (p) {
|
|
57142
|
+
if (!(p.flags & 418 /* BlockScoped */)) {
|
|
57143
|
+
varsOnly_1.set(p.escapedName, p);
|
|
57144
|
+
}
|
|
57145
|
+
});
|
|
57146
|
+
members = varsOnly_1;
|
|
57152
57147
|
}
|
|
57153
|
-
|
|
57154
|
-
|
|
57155
|
-
|
|
57156
|
-
|
|
57157
|
-
|
|
57158
|
-
|
|
57159
|
-
|
|
57160
|
-
|
|
57161
|
-
|
|
57162
|
-
else if (baseConstructorType === anyType) {
|
|
57163
|
-
baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
|
|
57164
|
-
}
|
|
57148
|
+
}
|
|
57149
|
+
var baseConstructorIndexInfo;
|
|
57150
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57151
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57152
|
+
var classType = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57153
|
+
var baseConstructorType = getBaseConstructorTypeOfClass(classType);
|
|
57154
|
+
if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
|
|
57155
|
+
members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
|
|
57156
|
+
addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
|
|
57165
57157
|
}
|
|
57166
|
-
|
|
57167
|
-
|
|
57168
|
-
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57158
|
+
else if (baseConstructorType === anyType) {
|
|
57159
|
+
baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
|
|
57169
57160
|
}
|
|
57170
|
-
|
|
57171
|
-
|
|
57172
|
-
|
|
57173
|
-
|
|
57174
|
-
|
|
57175
|
-
|
|
57176
|
-
|
|
57177
|
-
|
|
57161
|
+
}
|
|
57162
|
+
var indexSymbol = getIndexSymbolFromSymbolTable(members);
|
|
57163
|
+
if (indexSymbol) {
|
|
57164
|
+
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57165
|
+
}
|
|
57166
|
+
else {
|
|
57167
|
+
if (baseConstructorIndexInfo) {
|
|
57168
|
+
indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
|
|
57178
57169
|
}
|
|
57179
|
-
|
|
57180
|
-
|
|
57181
|
-
|
|
57182
|
-
// in the process of resolving (see issue #6072). The temporarily empty signature list
|
|
57183
|
-
// will never be observed because a qualified name can't reference signatures.
|
|
57184
|
-
if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
|
|
57185
|
-
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57170
|
+
if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
|
|
57171
|
+
ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
|
|
57172
|
+
indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
|
|
57186
57173
|
}
|
|
57187
|
-
|
|
57188
|
-
|
|
57189
|
-
|
|
57190
|
-
|
|
57191
|
-
|
|
57192
|
-
|
|
57193
|
-
|
|
57194
|
-
|
|
57195
|
-
|
|
57196
|
-
|
|
57197
|
-
|
|
57198
|
-
|
|
57199
|
-
|
|
57174
|
+
}
|
|
57175
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
|
|
57176
|
+
// We resolve the members before computing the signatures because a signature may use
|
|
57177
|
+
// typeof with a qualified name expression that circularly references the type we are
|
|
57178
|
+
// in the process of resolving (see issue #6072). The temporarily empty signature list
|
|
57179
|
+
// will never be observed because a qualified name can't reference signatures.
|
|
57180
|
+
if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
|
|
57181
|
+
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57182
|
+
}
|
|
57183
|
+
// And likewise for construct signatures for classes
|
|
57184
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57185
|
+
var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57186
|
+
var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
|
|
57187
|
+
if (symbol.flags & 16 /* Function */) {
|
|
57188
|
+
constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
|
|
57189
|
+
createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
|
|
57190
|
+
undefined; }));
|
|
57200
57191
|
}
|
|
57192
|
+
if (!constructSignatures.length) {
|
|
57193
|
+
constructSignatures = getDefaultConstructSignatures(classType_1);
|
|
57194
|
+
}
|
|
57195
|
+
type.constructSignatures = constructSignatures;
|
|
57201
57196
|
}
|
|
57202
57197
|
}
|
|
57203
57198
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
@@ -58198,8 +58193,8 @@ var ts;
|
|
|
58198
58193
|
var stringIndexInfo;
|
|
58199
58194
|
var applicableInfo;
|
|
58200
58195
|
var applicableInfos;
|
|
58201
|
-
for (var _i = 0,
|
|
58202
|
-
var info =
|
|
58196
|
+
for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
|
|
58197
|
+
var info = indexInfos_3[_i];
|
|
58203
58198
|
if (info.keyType === stringType) {
|
|
58204
58199
|
stringIndexInfo = info;
|
|
58205
58200
|
}
|
|
@@ -58772,14 +58767,14 @@ var ts;
|
|
|
58772
58767
|
}
|
|
58773
58768
|
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
58774
58769
|
if (indexSymbol.declarations) {
|
|
58775
|
-
var
|
|
58770
|
+
var indexInfos_4 = [];
|
|
58776
58771
|
var _loop_14 = function (declaration) {
|
|
58777
58772
|
if (declaration.parameters.length === 1) {
|
|
58778
58773
|
var parameter = declaration.parameters[0];
|
|
58779
58774
|
if (parameter.type) {
|
|
58780
58775
|
forEachType(getTypeFromTypeNode(parameter.type), function (keyType) {
|
|
58781
|
-
if (isValidIndexKeyType(keyType) && !findIndexInfo(
|
|
58782
|
-
|
|
58776
|
+
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_4, keyType)) {
|
|
58777
|
+
indexInfos_4.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
|
|
58783
58778
|
}
|
|
58784
58779
|
});
|
|
58785
58780
|
}
|
|
@@ -58789,7 +58784,7 @@ var ts;
|
|
|
58789
58784
|
var declaration = _a[_i];
|
|
58790
58785
|
_loop_14(declaration);
|
|
58791
58786
|
}
|
|
58792
|
-
return
|
|
58787
|
+
return indexInfos_4;
|
|
58793
58788
|
}
|
|
58794
58789
|
return ts.emptyArray;
|
|
58795
58790
|
}
|
|
@@ -59337,7 +59332,7 @@ var ts;
|
|
|
59337
59332
|
// The expression is processed as an identifier expression (section 4.3)
|
|
59338
59333
|
// or property access expression(section 4.10),
|
|
59339
59334
|
// the widened type(section 3.9) of which becomes the result.
|
|
59340
|
-
var type =
|
|
59335
|
+
var type = checkExpressionWithTypeArguments(node);
|
|
59341
59336
|
links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type));
|
|
59342
59337
|
}
|
|
59343
59338
|
return links.resolvedType;
|
|
@@ -62041,7 +62036,9 @@ var ts;
|
|
|
62041
62036
|
return result;
|
|
62042
62037
|
}
|
|
62043
62038
|
function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
62044
|
-
var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
|
|
62039
|
+
var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
|
|
62040
|
+
type.objectFlags & 16777216 /* InstantiationExpressionType */ ? type.node :
|
|
62041
|
+
type.symbol.declarations[0];
|
|
62045
62042
|
var links = getNodeLinks(declaration);
|
|
62046
62043
|
var target = type.objectFlags & 4 /* Reference */ ? links.resolvedType :
|
|
62047
62044
|
type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
@@ -62057,8 +62054,8 @@ var ts;
|
|
|
62057
62054
|
outerTypeParameters = ts.addRange(outerTypeParameters, templateTagParameters);
|
|
62058
62055
|
}
|
|
62059
62056
|
typeParameters = outerTypeParameters || ts.emptyArray;
|
|
62060
|
-
var allDeclarations_1 = type.objectFlags & 4 /* Reference */ ? [declaration] : type.symbol.declarations;
|
|
62061
|
-
typeParameters = (target.objectFlags & 4 /* Reference */ || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
|
|
62057
|
+
var allDeclarations_1 = type.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) ? [declaration] : type.symbol.declarations;
|
|
62058
|
+
typeParameters = (target.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
|
|
62062
62059
|
ts.filter(typeParameters, function (tp) { return ts.some(allDeclarations_1, function (d) { return isTypeParameterPossiblyReferenced(tp, d); }); }) :
|
|
62063
62060
|
typeParameters;
|
|
62064
62061
|
links.outerTypeParameters = typeParameters;
|
|
@@ -62230,6 +62227,9 @@ var ts;
|
|
|
62230
62227
|
mapper = combineTypeMappers(makeUnaryTypeMapper(origTypeParameter, freshTypeParameter), mapper);
|
|
62231
62228
|
freshTypeParameter.mapper = mapper;
|
|
62232
62229
|
}
|
|
62230
|
+
if (type.objectFlags & 16777216 /* InstantiationExpressionType */) {
|
|
62231
|
+
result.node = type.node;
|
|
62232
|
+
}
|
|
62233
62233
|
result.target = type;
|
|
62234
62234
|
result.mapper = mapper;
|
|
62235
62235
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -62995,10 +62995,6 @@ var ts;
|
|
|
62995
62995
|
if (sourceRestType || targetRestType) {
|
|
62996
62996
|
void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers);
|
|
62997
62997
|
}
|
|
62998
|
-
if (sourceRestType && targetRestType && sourceCount !== targetCount) {
|
|
62999
|
-
// We're not able to relate misaligned complex rest parameters
|
|
63000
|
-
return 0 /* False */;
|
|
63001
|
-
}
|
|
63002
62998
|
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
63003
62999
|
var strictVariance = !(checkMode & 3 /* Callback */) && strictFunctionTypes && kind !== 168 /* MethodDeclaration */ &&
|
|
63004
63000
|
kind !== 167 /* MethodSignature */ && kind !== 170 /* Constructor */;
|
|
@@ -65423,8 +65419,8 @@ var ts;
|
|
|
65423
65419
|
var indexInfos = getIndexInfosOfType(target);
|
|
65424
65420
|
var targetHasStringIndex = ts.some(indexInfos, function (info) { return info.keyType === stringType; });
|
|
65425
65421
|
var result = -1 /* True */;
|
|
65426
|
-
for (var _i = 0,
|
|
65427
|
-
var targetInfo =
|
|
65422
|
+
for (var _i = 0, indexInfos_5 = indexInfos; _i < indexInfos_5.length; _i++) {
|
|
65423
|
+
var targetInfo = indexInfos_5[_i];
|
|
65428
65424
|
var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ :
|
|
65429
65425
|
isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, 3 /* Both */, reportErrors) :
|
|
65430
65426
|
typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState);
|
|
@@ -66031,10 +66027,10 @@ var ts;
|
|
|
66031
66027
|
if (!(ts.getObjectFlags(type) & 4 /* Reference */) || !(ts.getObjectFlags(type.target) & 3 /* ClassOrInterface */)) {
|
|
66032
66028
|
return undefined;
|
|
66033
66029
|
}
|
|
66034
|
-
if (ts.getObjectFlags(type) &
|
|
66035
|
-
return ts.getObjectFlags(type) &
|
|
66030
|
+
if (ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeCalculated */) {
|
|
66031
|
+
return ts.getObjectFlags(type) & 134217728 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
|
|
66036
66032
|
}
|
|
66037
|
-
type.objectFlags |=
|
|
66033
|
+
type.objectFlags |= 67108864 /* IdenticalBaseTypeCalculated */;
|
|
66038
66034
|
var target = type.target;
|
|
66039
66035
|
if (ts.getObjectFlags(target) & 1 /* Class */) {
|
|
66040
66036
|
var baseTypeNode = getBaseTypeNodeOfClass(target);
|
|
@@ -66055,7 +66051,7 @@ var ts;
|
|
|
66055
66051
|
if (ts.length(getTypeArguments(type)) > ts.length(target.typeParameters)) {
|
|
66056
66052
|
instantiatedBase = getTypeWithThisArgument(instantiatedBase, ts.last(getTypeArguments(type)));
|
|
66057
66053
|
}
|
|
66058
|
-
type.objectFlags |=
|
|
66054
|
+
type.objectFlags |= 134217728 /* IdenticalBaseTypeExists */;
|
|
66059
66055
|
return type.cachedEquivalentBaseType = instantiatedBase;
|
|
66060
66056
|
}
|
|
66061
66057
|
function isEmptyLiteralType(type) {
|
|
@@ -66719,7 +66715,7 @@ var ts;
|
|
|
66719
66715
|
var result = !!(type.flags & 465829888 /* Instantiable */ ||
|
|
66720
66716
|
type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || ts.forEach(getTypeArguments(type), couldContainTypeVariables)) ||
|
|
66721
66717
|
objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
|
|
66722
|
-
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */)) ||
|
|
66718
|
+
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */ | 16777216 /* InstantiationExpressionType */)) ||
|
|
66723
66719
|
type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && ts.some(type.types, couldContainTypeVariables));
|
|
66724
66720
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
66725
66721
|
type.objectFlags |= 1048576 /* CouldContainTypeVariablesComputed */ | (result ? 2097152 /* CouldContainTypeVariables */ : 0);
|
|
@@ -67636,8 +67632,8 @@ var ts;
|
|
|
67636
67632
|
var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* Mapped */) ? 8 /* HomomorphicMappedType */ : 0;
|
|
67637
67633
|
var indexInfos = getIndexInfosOfType(target);
|
|
67638
67634
|
if (isObjectTypeWithInferableIndex(source)) {
|
|
67639
|
-
for (var _i = 0,
|
|
67640
|
-
var targetInfo =
|
|
67635
|
+
for (var _i = 0, indexInfos_6 = indexInfos; _i < indexInfos_6.length; _i++) {
|
|
67636
|
+
var targetInfo = indexInfos_6[_i];
|
|
67641
67637
|
var propTypes = [];
|
|
67642
67638
|
for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
|
|
67643
67639
|
var prop = _b[_a];
|
|
@@ -67657,8 +67653,8 @@ var ts;
|
|
|
67657
67653
|
}
|
|
67658
67654
|
}
|
|
67659
67655
|
}
|
|
67660
|
-
for (var _e = 0,
|
|
67661
|
-
var targetInfo =
|
|
67656
|
+
for (var _e = 0, indexInfos_7 = indexInfos; _e < indexInfos_7.length; _e++) {
|
|
67657
|
+
var targetInfo = indexInfos_7[_e];
|
|
67662
67658
|
var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType);
|
|
67663
67659
|
if (sourceInfo) {
|
|
67664
67660
|
inferWithPriority(sourceInfo.type, targetInfo.type, priority);
|
|
@@ -70056,7 +70052,7 @@ var ts;
|
|
|
70056
70052
|
var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
|
|
70057
70053
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
70058
70054
|
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
70059
|
-
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */
|
|
70055
|
+
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
|
|
70060
70056
|
}
|
|
70061
70057
|
function isExportOrExportExpression(location) {
|
|
70062
70058
|
return !!ts.findAncestor(location, function (n) {
|
|
@@ -75822,6 +75818,72 @@ var ts;
|
|
|
75822
75818
|
return node.flags & 32 /* OptionalChain */ ? checkNonNullChain(node) :
|
|
75823
75819
|
getNonNullableType(checkExpression(node.expression));
|
|
75824
75820
|
}
|
|
75821
|
+
function checkExpressionWithTypeArguments(node) {
|
|
75822
|
+
checkGrammarExpressionWithTypeArguments(node);
|
|
75823
|
+
var exprType = node.kind === 227 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) :
|
|
75824
|
+
ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) :
|
|
75825
|
+
checkExpression(node.exprName);
|
|
75826
|
+
var typeArguments = node.typeArguments;
|
|
75827
|
+
if (exprType === silentNeverType || isErrorType(exprType) || !ts.some(typeArguments)) {
|
|
75828
|
+
return exprType;
|
|
75829
|
+
}
|
|
75830
|
+
var hasSomeApplicableSignature = false;
|
|
75831
|
+
var nonApplicableType;
|
|
75832
|
+
var result = getInstantiatedType(exprType);
|
|
75833
|
+
var errorType = hasSomeApplicableSignature ? nonApplicableType : exprType;
|
|
75834
|
+
if (errorType) {
|
|
75835
|
+
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)));
|
|
75836
|
+
}
|
|
75837
|
+
return result;
|
|
75838
|
+
function getInstantiatedType(type) {
|
|
75839
|
+
var hasSignatures = false;
|
|
75840
|
+
var hasApplicableSignature = false;
|
|
75841
|
+
var result = getInstantiatedTypePart(type);
|
|
75842
|
+
hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
|
|
75843
|
+
if (hasSignatures && !hasApplicableSignature) {
|
|
75844
|
+
nonApplicableType !== null && nonApplicableType !== void 0 ? nonApplicableType : (nonApplicableType = type);
|
|
75845
|
+
}
|
|
75846
|
+
return result;
|
|
75847
|
+
function getInstantiatedTypePart(type) {
|
|
75848
|
+
if (type.flags & 524288 /* Object */) {
|
|
75849
|
+
var resolved = resolveStructuredTypeMembers(type);
|
|
75850
|
+
var callSignatures = getInstantiatedSignatures(resolved.callSignatures);
|
|
75851
|
+
var constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
|
|
75852
|
+
hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
|
|
75853
|
+
hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
|
|
75854
|
+
if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
|
|
75855
|
+
var result_11 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
|
|
75856
|
+
result_11.objectFlags |= 16777216 /* InstantiationExpressionType */;
|
|
75857
|
+
result_11.node = node;
|
|
75858
|
+
return result_11;
|
|
75859
|
+
}
|
|
75860
|
+
}
|
|
75861
|
+
else if (type.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
75862
|
+
var constraint = getBaseConstraintOfType(type);
|
|
75863
|
+
if (constraint) {
|
|
75864
|
+
var instantiated = getInstantiatedTypePart(constraint);
|
|
75865
|
+
if (instantiated !== constraint) {
|
|
75866
|
+
return instantiated;
|
|
75867
|
+
}
|
|
75868
|
+
}
|
|
75869
|
+
}
|
|
75870
|
+
else if (type.flags & 1048576 /* Union */) {
|
|
75871
|
+
return mapType(type, getInstantiatedType);
|
|
75872
|
+
}
|
|
75873
|
+
else if (type.flags & 2097152 /* Intersection */) {
|
|
75874
|
+
return getIntersectionType(ts.sameMap(type.types, getInstantiatedTypePart));
|
|
75875
|
+
}
|
|
75876
|
+
return type;
|
|
75877
|
+
}
|
|
75878
|
+
}
|
|
75879
|
+
function getInstantiatedSignatures(signatures) {
|
|
75880
|
+
var applicableSignatures = ts.filter(signatures, function (sig) { return !!sig.typeParameters && hasCorrectTypeArgumentArity(sig, typeArguments); });
|
|
75881
|
+
return ts.sameMap(applicableSignatures, function (sig) {
|
|
75882
|
+
var typeArgumentTypes = checkTypeArguments(sig, typeArguments, /*reportErrors*/ true);
|
|
75883
|
+
return typeArgumentTypes ? getSignatureInstantiation(sig, typeArgumentTypes, ts.isInJSFile(sig.declaration)) : sig;
|
|
75884
|
+
});
|
|
75885
|
+
}
|
|
75886
|
+
}
|
|
75825
75887
|
function checkMetaProperty(node) {
|
|
75826
75888
|
checkGrammarMetaProperty(node);
|
|
75827
75889
|
if (node.keywordToken === 103 /* NewKeyword */) {
|
|
@@ -77311,7 +77373,7 @@ var ts;
|
|
|
77311
77373
|
if (operator === 55 /* AmpersandAmpersandToken */ || operator === 56 /* BarBarToken */ || operator === 60 /* QuestionQuestionToken */) {
|
|
77312
77374
|
if (operator === 55 /* AmpersandAmpersandToken */) {
|
|
77313
77375
|
var parent = ts.walkUpParenthesizedExpressions(node.parent);
|
|
77314
|
-
checkTestingKnownTruthyCallableOrAwaitableType(node.left,
|
|
77376
|
+
checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
|
|
77315
77377
|
}
|
|
77316
77378
|
checkTruthinessOfType(leftType, node.left);
|
|
77317
77379
|
}
|
|
@@ -77818,8 +77880,8 @@ var ts;
|
|
|
77818
77880
|
return type;
|
|
77819
77881
|
}
|
|
77820
77882
|
function checkConditionalExpression(node, checkMode) {
|
|
77821
|
-
|
|
77822
|
-
checkTestingKnownTruthyCallableOrAwaitableType(node.condition,
|
|
77883
|
+
checkTruthinessExpression(node.condition);
|
|
77884
|
+
checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue);
|
|
77823
77885
|
var type1 = checkExpression(node.whenTrue, checkMode);
|
|
77824
77886
|
var type2 = checkExpression(node.whenFalse, checkMode);
|
|
77825
77887
|
return getUnionType([type1, type2], 2 /* Subtype */);
|
|
@@ -78338,6 +78400,8 @@ var ts;
|
|
|
78338
78400
|
return checkAssertion(node);
|
|
78339
78401
|
case 229 /* NonNullExpression */:
|
|
78340
78402
|
return checkNonNullAssertion(node);
|
|
78403
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
78404
|
+
return checkExpressionWithTypeArguments(node);
|
|
78341
78405
|
case 230 /* MetaProperty */:
|
|
78342
78406
|
return checkMetaProperty(node);
|
|
78343
78407
|
case 214 /* DeleteExpression */:
|
|
@@ -79541,12 +79605,12 @@ var ts;
|
|
|
79541
79605
|
case 264 /* ImportEqualsDeclaration */:
|
|
79542
79606
|
case 267 /* NamespaceImport */:
|
|
79543
79607
|
case 266 /* ImportClause */:
|
|
79544
|
-
var
|
|
79608
|
+
var result_12 = 0 /* None */;
|
|
79545
79609
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
79546
79610
|
ts.forEach(target.declarations, function (d) {
|
|
79547
|
-
|
|
79611
|
+
result_12 |= getDeclarationSpaces(d);
|
|
79548
79612
|
});
|
|
79549
|
-
return
|
|
79613
|
+
return result_12;
|
|
79550
79614
|
case 253 /* VariableDeclaration */:
|
|
79551
79615
|
case 202 /* BindingElement */:
|
|
79552
79616
|
case 255 /* FunctionDeclaration */:
|
|
@@ -80973,50 +81037,59 @@ var ts;
|
|
|
80973
81037
|
function checkIfStatement(node) {
|
|
80974
81038
|
// Grammar checking
|
|
80975
81039
|
checkGrammarStatementInAmbientContext(node);
|
|
80976
|
-
|
|
80977
|
-
checkTestingKnownTruthyCallableOrAwaitableType(node.expression,
|
|
81040
|
+
checkTruthinessExpression(node.expression);
|
|
81041
|
+
checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement);
|
|
80978
81042
|
checkSourceElement(node.thenStatement);
|
|
80979
81043
|
if (node.thenStatement.kind === 235 /* EmptyStatement */) {
|
|
80980
81044
|
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
|
|
80981
81045
|
}
|
|
80982
81046
|
checkSourceElement(node.elseStatement);
|
|
80983
81047
|
}
|
|
80984
|
-
function checkTestingKnownTruthyCallableOrAwaitableType(condExpr,
|
|
81048
|
+
function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) {
|
|
80985
81049
|
if (!strictNullChecks)
|
|
80986
81050
|
return;
|
|
80987
|
-
|
|
80988
|
-
|
|
80989
|
-
|
|
80990
|
-
|
|
80991
|
-
|
|
80992
|
-
|
|
80993
|
-
|
|
80994
|
-
|
|
80995
|
-
|
|
80996
|
-
|
|
80997
|
-
|
|
80998
|
-
|
|
80999
|
-
|
|
81000
|
-
|
|
81001
|
-
|
|
81002
|
-
|
|
81003
|
-
|
|
81004
|
-
|
|
81005
|
-
|
|
81006
|
-
|
|
81007
|
-
|
|
81008
|
-
|
|
81009
|
-
|
|
81010
|
-
}
|
|
81011
|
-
var isUsed = testedSymbol && ts.isBinaryExpression(condExpr.parent) && isSymbolUsedInBinaryExpressionChain(condExpr.parent, testedSymbol)
|
|
81012
|
-
|| testedSymbol && body && isSymbolUsedInConditionBody(condExpr, body, testedNode, testedSymbol);
|
|
81013
|
-
if (!isUsed) {
|
|
81014
|
-
if (isPromise) {
|
|
81015
|
-
errorAndMaybeSuggestAwait(location,
|
|
81016
|
-
/*maybeMissingAwait*/ true, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined, getTypeNameForErrorDisplay(type));
|
|
81051
|
+
helper(condExpr, body);
|
|
81052
|
+
while (ts.isBinaryExpression(condExpr) && condExpr.operatorToken.kind === 56 /* BarBarToken */) {
|
|
81053
|
+
condExpr = condExpr.left;
|
|
81054
|
+
helper(condExpr, body);
|
|
81055
|
+
}
|
|
81056
|
+
function helper(condExpr, body) {
|
|
81057
|
+
var location = ts.isBinaryExpression(condExpr) &&
|
|
81058
|
+
(condExpr.operatorToken.kind === 56 /* BarBarToken */ || condExpr.operatorToken.kind === 55 /* AmpersandAmpersandToken */)
|
|
81059
|
+
? condExpr.right
|
|
81060
|
+
: condExpr;
|
|
81061
|
+
var type = checkTruthinessExpression(location);
|
|
81062
|
+
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
81063
|
+
if (getFalsyFlags(type) || isPropertyExpressionCast)
|
|
81064
|
+
return;
|
|
81065
|
+
// While it technically should be invalid for any known-truthy value
|
|
81066
|
+
// to be tested, we de-scope to functions and Promises unreferenced in
|
|
81067
|
+
// the block as a heuristic to identify the most common bugs. There
|
|
81068
|
+
// are too many false positives for values sourced from type
|
|
81069
|
+
// definitions without strictNullChecks otherwise.
|
|
81070
|
+
var callSignatures = getSignaturesOfType(type, 0 /* Call */);
|
|
81071
|
+
var isPromise = !!getAwaitedTypeOfPromise(type);
|
|
81072
|
+
if (callSignatures.length === 0 && !isPromise) {
|
|
81073
|
+
return;
|
|
81017
81074
|
}
|
|
81018
|
-
|
|
81019
|
-
|
|
81075
|
+
var testedNode = ts.isIdentifier(location) ? location
|
|
81076
|
+
: ts.isPropertyAccessExpression(location) ? location.name
|
|
81077
|
+
: ts.isBinaryExpression(location) && ts.isIdentifier(location.right) ? location.right
|
|
81078
|
+
: undefined;
|
|
81079
|
+
var testedSymbol = testedNode && getSymbolAtLocation(testedNode);
|
|
81080
|
+
if (!testedSymbol && !isPromise) {
|
|
81081
|
+
return;
|
|
81082
|
+
}
|
|
81083
|
+
var isUsed = testedSymbol && ts.isBinaryExpression(condExpr.parent) && isSymbolUsedInBinaryExpressionChain(condExpr.parent, testedSymbol)
|
|
81084
|
+
|| testedSymbol && body && isSymbolUsedInConditionBody(condExpr, body, testedNode, testedSymbol);
|
|
81085
|
+
if (!isUsed) {
|
|
81086
|
+
if (isPromise) {
|
|
81087
|
+
errorAndMaybeSuggestAwait(location,
|
|
81088
|
+
/*maybeMissingAwait*/ true, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined, getTypeNameForErrorDisplay(type));
|
|
81089
|
+
}
|
|
81090
|
+
else {
|
|
81091
|
+
error(location, ts.Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead);
|
|
81092
|
+
}
|
|
81020
81093
|
}
|
|
81021
81094
|
}
|
|
81022
81095
|
}
|
|
@@ -82105,8 +82178,8 @@ var ts;
|
|
|
82105
82178
|
}
|
|
82106
82179
|
}
|
|
82107
82180
|
if (indexInfos.length > 1) {
|
|
82108
|
-
for (var _d = 0,
|
|
82109
|
-
var info =
|
|
82181
|
+
for (var _d = 0, indexInfos_8 = indexInfos; _d < indexInfos_8.length; _d++) {
|
|
82182
|
+
var info = indexInfos_8[_d];
|
|
82110
82183
|
checkIndexConstraintForIndexSignature(type, info);
|
|
82111
82184
|
}
|
|
82112
82185
|
}
|
|
@@ -82132,8 +82205,8 @@ var ts;
|
|
|
82132
82205
|
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));
|
|
82133
82206
|
}
|
|
82134
82207
|
};
|
|
82135
|
-
for (var _i = 0,
|
|
82136
|
-
var info =
|
|
82208
|
+
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
82209
|
+
var info = indexInfos_9[_i];
|
|
82137
82210
|
_loop_27(info);
|
|
82138
82211
|
}
|
|
82139
82212
|
}
|
|
@@ -82155,8 +82228,8 @@ var ts;
|
|
|
82155
82228
|
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));
|
|
82156
82229
|
}
|
|
82157
82230
|
};
|
|
82158
|
-
for (var _i = 0,
|
|
82159
|
-
var info =
|
|
82231
|
+
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
82232
|
+
var info = indexInfos_10[_i];
|
|
82160
82233
|
_loop_28(info);
|
|
82161
82234
|
}
|
|
82162
82235
|
}
|
|
@@ -82205,9 +82278,9 @@ var ts;
|
|
|
82205
82278
|
var containsArguments = containsArgumentsReference(node);
|
|
82206
82279
|
if (containsArguments) {
|
|
82207
82280
|
var lastJSDocParam = ts.lastOrUndefined(jsdocParameters);
|
|
82208
|
-
if (lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
82281
|
+
if (isJs && lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
82209
82282
|
lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
82210
|
-
|
|
82283
|
+
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));
|
|
82211
82284
|
}
|
|
82212
82285
|
}
|
|
82213
82286
|
else {
|
|
@@ -82217,7 +82290,9 @@ var ts;
|
|
|
82217
82290
|
return;
|
|
82218
82291
|
}
|
|
82219
82292
|
if (ts.isQualifiedName(name)) {
|
|
82220
|
-
|
|
82293
|
+
if (isJs) {
|
|
82294
|
+
error(name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
|
|
82295
|
+
}
|
|
82221
82296
|
}
|
|
82222
82297
|
else {
|
|
82223
82298
|
errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
|
|
@@ -83810,10 +83885,10 @@ var ts;
|
|
|
83810
83885
|
}
|
|
83811
83886
|
// ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries.
|
|
83812
83887
|
// (TS Exceptions: namespaces, function overloads, enums, and interfaces)
|
|
83813
|
-
if (flags & (1920 /* Namespace */ |
|
|
83888
|
+
if (flags & (1920 /* Namespace */ | 384 /* Enum */)) {
|
|
83814
83889
|
return;
|
|
83815
83890
|
}
|
|
83816
|
-
var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverloadAndNotAccessor);
|
|
83891
|
+
var exportedDeclarationsCount = ts.countWhere(declarations, ts.and(isNotOverloadAndNotAccessor, ts.not(ts.isInterfaceDeclaration)));
|
|
83817
83892
|
if (flags & 524288 /* TypeAlias */ && exportedDeclarationsCount <= 2) {
|
|
83818
83893
|
// it is legal to merge type alias with other values
|
|
83819
83894
|
// so count should be either 1 (just type alias) or 2 (type alias + merged value)
|
|
@@ -87789,7 +87864,7 @@ var ts;
|
|
|
87789
87864
|
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));
|
|
87790
87865
|
case 180 /* TypeQuery */:
|
|
87791
87866
|
ts.Debug.type(node);
|
|
87792
|
-
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName));
|
|
87867
|
+
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
|
|
87793
87868
|
case 181 /* TypeLiteral */:
|
|
87794
87869
|
ts.Debug.type(node);
|
|
87795
87870
|
return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
|
|
@@ -90681,8 +90756,8 @@ var ts;
|
|
|
90681
90756
|
function generateClassElementDecorationExpressions(node, isStatic) {
|
|
90682
90757
|
var members = getDecoratedClassElements(node, isStatic);
|
|
90683
90758
|
var expressions;
|
|
90684
|
-
for (var _i = 0,
|
|
90685
|
-
var member =
|
|
90759
|
+
for (var _i = 0, members_8 = members; _i < members_8.length; _i++) {
|
|
90760
|
+
var member = members_8[_i];
|
|
90686
90761
|
var expression = generateClassElementDecorationExpression(node, member);
|
|
90687
90762
|
if (expression) {
|
|
90688
90763
|
if (!expressions) {
|
|
@@ -96027,8 +96102,8 @@ var ts;
|
|
|
96027
96102
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
96028
96103
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
96029
96104
|
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
96030
|
-
var
|
|
96031
|
-
return
|
|
96105
|
+
var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
96106
|
+
return result_13 && factory.createPropertyAssignment("children", result_13);
|
|
96032
96107
|
}
|
|
96033
96108
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
96034
96109
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -109666,6 +109741,8 @@ var ts;
|
|
|
109666
109741
|
return emitAsExpression(node);
|
|
109667
109742
|
case 229 /* NonNullExpression */:
|
|
109668
109743
|
return emitNonNullExpression(node);
|
|
109744
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
109745
|
+
return emitExpressionWithTypeArguments(node);
|
|
109669
109746
|
case 230 /* MetaProperty */:
|
|
109670
109747
|
return emitMetaProperty(node);
|
|
109671
109748
|
case 231 /* SyntheticExpression */:
|
|
@@ -110110,6 +110187,7 @@ var ts;
|
|
|
110110
110187
|
writeKeyword("typeof");
|
|
110111
110188
|
writeSpace();
|
|
110112
110189
|
emit(node.exprName);
|
|
110190
|
+
emitTypeArguments(node, node.typeArguments);
|
|
110113
110191
|
}
|
|
110114
110192
|
function emitTypeLiteral(node) {
|
|
110115
110193
|
writePunctuation("{");
|
|
@@ -115083,15 +115161,15 @@ var ts;
|
|
|
115083
115161
|
// which per above occurred during the current program creation.
|
|
115084
115162
|
// Since we assume the filesystem does not change during program creation,
|
|
115085
115163
|
// it is safe to reuse resolutions from the earlier call.
|
|
115086
|
-
var
|
|
115164
|
+
var result_14 = [];
|
|
115087
115165
|
var i = 0;
|
|
115088
115166
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
115089
115167
|
var moduleName = moduleNames_1[_i];
|
|
115090
115168
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
115091
115169
|
i++;
|
|
115092
|
-
|
|
115170
|
+
result_14.push(resolvedModule);
|
|
115093
115171
|
}
|
|
115094
|
-
return
|
|
115172
|
+
return result_14;
|
|
115095
115173
|
}
|
|
115096
115174
|
// At this point, we know at least one of the following hold:
|
|
115097
115175
|
// - file has local declarations for ambient modules
|
|
@@ -120209,9 +120287,9 @@ var ts;
|
|
|
120209
120287
|
if (!preferSymlinks) {
|
|
120210
120288
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
120211
120289
|
// so we only need to remove them from the realpath filenames.
|
|
120212
|
-
var
|
|
120213
|
-
if (
|
|
120214
|
-
return
|
|
120290
|
+
var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
120291
|
+
if (result_15)
|
|
120292
|
+
return result_15;
|
|
120215
120293
|
}
|
|
120216
120294
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
120217
120295
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -120231,10 +120309,10 @@ var ts;
|
|
|
120231
120309
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
120232
120310
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
120233
120311
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
120234
|
-
var
|
|
120312
|
+
var result_16 = cb(option, target === referenceRedirect);
|
|
120235
120313
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
120236
|
-
if (
|
|
120237
|
-
return
|
|
120314
|
+
if (result_16)
|
|
120315
|
+
return result_16;
|
|
120238
120316
|
}
|
|
120239
120317
|
});
|
|
120240
120318
|
});
|
|
@@ -124075,7 +124153,7 @@ var ts;
|
|
|
124075
124153
|
case 199 /* ImportType */:
|
|
124076
124154
|
return !node.parent.isTypeOf;
|
|
124077
124155
|
case 227 /* ExpressionWithTypeArguments */:
|
|
124078
|
-
return
|
|
124156
|
+
return ts.isPartOfTypeNode(node.parent);
|
|
124079
124157
|
}
|
|
124080
124158
|
return false;
|
|
124081
124159
|
}
|
|
@@ -126102,14 +126180,15 @@ var ts;
|
|
|
126102
126180
|
: "linkplain";
|
|
126103
126181
|
var parts = [linkPart("{@" + prefix + " ")];
|
|
126104
126182
|
if (!link.name) {
|
|
126105
|
-
if (link.text)
|
|
126183
|
+
if (link.text) {
|
|
126106
126184
|
parts.push(linkTextPart(link.text));
|
|
126185
|
+
}
|
|
126107
126186
|
}
|
|
126108
126187
|
else {
|
|
126109
126188
|
var symbol = checker === null || checker === void 0 ? void 0 : checker.getSymbolAtLocation(link.name);
|
|
126110
126189
|
var suffix = findLinkNameEnd(link.text);
|
|
126111
126190
|
var name = ts.getTextOfNode(link.name) + link.text.slice(0, suffix);
|
|
126112
|
-
var text = link.text.slice(suffix);
|
|
126191
|
+
var text = skipSeparatorFromLinkText(link.text.slice(suffix));
|
|
126113
126192
|
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]);
|
|
126114
126193
|
if (decl) {
|
|
126115
126194
|
parts.push(linkNamePart(name, decl));
|
|
@@ -126124,6 +126203,15 @@ var ts;
|
|
|
126124
126203
|
return parts;
|
|
126125
126204
|
}
|
|
126126
126205
|
ts.buildLinkParts = buildLinkParts;
|
|
126206
|
+
function skipSeparatorFromLinkText(text) {
|
|
126207
|
+
var pos = 0;
|
|
126208
|
+
if (text.charCodeAt(pos++) === 124 /* bar */) {
|
|
126209
|
+
while (pos < text.length && text.charCodeAt(pos) === 32 /* space */)
|
|
126210
|
+
pos++;
|
|
126211
|
+
return text.slice(pos);
|
|
126212
|
+
}
|
|
126213
|
+
return text;
|
|
126214
|
+
}
|
|
126127
126215
|
function findLinkNameEnd(text) {
|
|
126128
126216
|
if (text.indexOf("()") === 0)
|
|
126129
126217
|
return 2;
|
|
@@ -137360,9 +137448,18 @@ var ts;
|
|
|
137360
137448
|
JsDoc.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations;
|
|
137361
137449
|
function getDisplayPartsFromComment(comment, checker) {
|
|
137362
137450
|
if (typeof comment === "string") {
|
|
137363
|
-
return [ts.textPart(comment)];
|
|
137451
|
+
return [ts.textPart(skipSeparatorFromComment(comment))];
|
|
137452
|
+
}
|
|
137453
|
+
return ts.flatMap(comment, function (node) { return node.kind === 319 /* JSDocText */ ? [ts.textPart(skipSeparatorFromComment(node.text))] : ts.buildLinkParts(node, checker); });
|
|
137454
|
+
}
|
|
137455
|
+
function skipSeparatorFromComment(text) {
|
|
137456
|
+
var pos = 0;
|
|
137457
|
+
if (text.charCodeAt(pos++) === 45 /* minus */) {
|
|
137458
|
+
while (pos < text.length && text.charCodeAt(pos) === 32 /* space */)
|
|
137459
|
+
pos++;
|
|
137460
|
+
return text.slice(pos);
|
|
137364
137461
|
}
|
|
137365
|
-
return
|
|
137462
|
+
return text;
|
|
137366
137463
|
}
|
|
137367
137464
|
function getCommentDisplayParts(tag, checker) {
|
|
137368
137465
|
var comment = tag.comment, kind = tag.kind;
|
|
@@ -154740,7 +154837,7 @@ var ts;
|
|
|
154740
154837
|
/*dotDotDotToken*/ undefined,
|
|
154741
154838
|
/*name*/ names && names[i] || "arg" + i,
|
|
154742
154839
|
/*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined,
|
|
154743
|
-
/*type*/ inJs ? undefined : types && types[i] || ts.factory.createKeywordTypeNode(
|
|
154840
|
+
/*type*/ inJs ? undefined : types && types[i] || ts.factory.createKeywordTypeNode(154 /* UnknownKeyword */),
|
|
154744
154841
|
/*initializer*/ undefined);
|
|
154745
154842
|
parameters.push(newParameter);
|
|
154746
154843
|
}
|
|
@@ -154768,11 +154865,10 @@ var ts;
|
|
|
154768
154865
|
var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.name; });
|
|
154769
154866
|
var parameters = createDummyParameters(maxNonRestArgs, maxArgsParameterSymbolNames, /* types */ undefined, minArgumentCount, /*inJs*/ false);
|
|
154770
154867
|
if (someSigHasRestParameter) {
|
|
154771
|
-
var anyArrayType = ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(130 /* AnyKeyword */));
|
|
154772
154868
|
var restParameter = ts.factory.createParameterDeclaration(
|
|
154773
154869
|
/*decorators*/ undefined,
|
|
154774
154870
|
/*modifiers*/ undefined, ts.factory.createToken(25 /* DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest",
|
|
154775
|
-
/*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined,
|
|
154871
|
+
/*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(154 /* UnknownKeyword */)),
|
|
154776
154872
|
/*initializer*/ undefined);
|
|
154777
154873
|
parameters.push(restParameter);
|
|
154778
154874
|
}
|
|
@@ -157018,7 +157114,7 @@ var ts;
|
|
|
157018
157114
|
// cannot find either start or end node
|
|
157019
157115
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
|
|
157020
157116
|
}
|
|
157021
|
-
if (
|
|
157117
|
+
if (start.flags & 4194304 /* JSDoc */) {
|
|
157022
157118
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractJSDoc)] };
|
|
157023
157119
|
}
|
|
157024
157120
|
if (start.parent !== end.parent) {
|
|
@@ -157141,7 +157237,7 @@ var ts;
|
|
|
157141
157237
|
ts.Debug.assert(nodeToCheck.pos <= nodeToCheck.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (1)");
|
|
157142
157238
|
// For understanding how skipTrivia functioned:
|
|
157143
157239
|
ts.Debug.assert(!ts.positionIsSynthesized(nodeToCheck.pos), "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (2)");
|
|
157144
|
-
if (!ts.isStatement(nodeToCheck) && !(ts.isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck))) {
|
|
157240
|
+
if (!ts.isStatement(nodeToCheck) && !(ts.isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck)) && !isStringLiteralJsxAttribute(nodeToCheck)) {
|
|
157145
157241
|
return [ts.createDiagnosticForNode(nodeToCheck, Messages.statementOrExpressionExpected)];
|
|
157146
157242
|
}
|
|
157147
157243
|
if (nodeToCheck.flags & 8388608 /* Ambient */) {
|
|
@@ -157321,13 +157417,16 @@ var ts;
|
|
|
157321
157417
|
if (ts.isStatement(node)) {
|
|
157322
157418
|
return [node];
|
|
157323
157419
|
}
|
|
157324
|
-
|
|
157420
|
+
if (ts.isExpressionNode(node)) {
|
|
157325
157421
|
// If our selection is the expression in an ExpressionStatement, expand
|
|
157326
157422
|
// the selection to include the enclosing Statement (this stops us
|
|
157327
157423
|
// from trying to care about the return value of the extracted function
|
|
157328
157424
|
// and eliminates double semicolon insertion in certain scenarios)
|
|
157329
157425
|
return ts.isExpressionStatement(node.parent) ? [node.parent] : node;
|
|
157330
157426
|
}
|
|
157427
|
+
if (isStringLiteralJsxAttribute(node)) {
|
|
157428
|
+
return node;
|
|
157429
|
+
}
|
|
157331
157430
|
return undefined;
|
|
157332
157431
|
}
|
|
157333
157432
|
function isScope(node) {
|
|
@@ -158137,7 +158236,7 @@ var ts;
|
|
|
158137
158236
|
// Unfortunately, this code takes advantage of the knowledge that the generated method
|
|
158138
158237
|
// will use the contextual type of an expression as the return type of the extracted
|
|
158139
158238
|
// method (and will therefore "use" all the types involved).
|
|
158140
|
-
if (inGenericContext && !isReadonlyArray(targetRange.range)) {
|
|
158239
|
+
if (inGenericContext && !isReadonlyArray(targetRange.range) && !ts.isJsxAttribute(targetRange.range)) {
|
|
158141
158240
|
var contextualType = checker.getContextualType(targetRange.range); // TODO: GH#18217
|
|
158142
158241
|
recordTypeParameterUsages(contextualType);
|
|
158143
158242
|
}
|
|
@@ -158462,7 +158561,11 @@ var ts;
|
|
|
158462
158561
|
}
|
|
158463
158562
|
}
|
|
158464
158563
|
function isInJSXContent(node) {
|
|
158465
|
-
return (
|
|
158564
|
+
return isStringLiteralJsxAttribute(node) ||
|
|
158565
|
+
(ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node) || ts.isJsxFragment(node)) && (ts.isJsxElement(node.parent) || ts.isJsxFragment(node.parent));
|
|
158566
|
+
}
|
|
158567
|
+
function isStringLiteralJsxAttribute(node) {
|
|
158568
|
+
return ts.isStringLiteral(node) && node.parent && ts.isJsxAttribute(node.parent);
|
|
158466
158569
|
}
|
|
158467
158570
|
})(extractSymbol = refactor.extractSymbol || (refactor.extractSymbol = {}));
|
|
158468
158571
|
})(refactor = ts.refactor || (ts.refactor = {}));
|
|
@@ -176969,6 +177072,7 @@ var ts;
|
|
|
176969
177072
|
})(server = ts.server || (ts.server = {}));
|
|
176970
177073
|
})(ts || (ts = {}));
|
|
176971
177074
|
/*@internal*/
|
|
177075
|
+
/// <reference lib="webworker" />
|
|
176972
177076
|
var ts;
|
|
176973
177077
|
(function (ts) {
|
|
176974
177078
|
var server;
|
|
@@ -177050,7 +177154,7 @@ var ts;
|
|
|
177050
177154
|
}
|
|
177051
177155
|
}
|
|
177052
177156
|
function hrtime(previous) {
|
|
177053
|
-
var now = self.performance.now(
|
|
177157
|
+
var now = self.performance.now() * 1e-3;
|
|
177054
177158
|
var seconds = Math.floor(now);
|
|
177055
177159
|
var nanoseconds = Math.floor((now % 1) * 1e9);
|
|
177056
177160
|
if (previous) {
|
|
@@ -177072,7 +177176,7 @@ var ts;
|
|
|
177072
177176
|
WorkerSession.prototype.exit = function () {
|
|
177073
177177
|
this.logger.info("Exiting...");
|
|
177074
177178
|
this.projectService.closeLog();
|
|
177075
|
-
close(
|
|
177179
|
+
close();
|
|
177076
177180
|
};
|
|
177077
177181
|
WorkerSession.prototype.listen = function () {
|
|
177078
177182
|
var _this = this;
|
|
@@ -177103,9 +177207,9 @@ var ts;
|
|
|
177103
177207
|
function getLogLevel(level) {
|
|
177104
177208
|
if (level) {
|
|
177105
177209
|
var l = level.toLowerCase();
|
|
177106
|
-
for (var
|
|
177107
|
-
if (isNaN(+
|
|
177108
|
-
return server.LogLevel[
|
|
177210
|
+
for (var name_1 in server.LogLevel) {
|
|
177211
|
+
if (isNaN(+name_1) && l === name_1.toLowerCase()) {
|
|
177212
|
+
return server.LogLevel[name_1];
|
|
177109
177213
|
}
|
|
177110
177214
|
}
|
|
177111
177215
|
}
|