typescript 4.7.0-dev.20220216 → 4.7.0-dev.20220217
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +241 -165
- package/lib/tsserver.js +266 -195
- package/lib/tsserverlibrary.d.ts +7 -7
- package/lib/tsserverlibrary.js +266 -195
- package/lib/typescript.d.ts +7 -7
- package/lib/typescript.js +266 -195
- package/lib/typescriptServices.d.ts +7 -7
- package/lib/typescriptServices.js +266 -195
- package/lib/typingsInstaller.js +264 -193
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220217";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -4909,13 +4909,14 @@ var ts;
|
|
|
4909
4909
|
// Flags that require TypeFlags.Object
|
|
4910
4910
|
ObjectFlags[ObjectFlags["ContainsSpread"] = 4194304] = "ContainsSpread";
|
|
4911
4911
|
ObjectFlags[ObjectFlags["ObjectRestType"] = 8388608] = "ObjectRestType";
|
|
4912
|
+
ObjectFlags[ObjectFlags["InstantiationExpressionType"] = 16777216] = "InstantiationExpressionType";
|
|
4912
4913
|
/* @internal */
|
|
4913
|
-
ObjectFlags[ObjectFlags["IsClassInstanceClone"] =
|
|
4914
|
+
ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 33554432] = "IsClassInstanceClone";
|
|
4914
4915
|
// Flags that require TypeFlags.Object and ObjectFlags.Reference
|
|
4915
4916
|
/* @internal */
|
|
4916
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] =
|
|
4917
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 67108864] = "IdenticalBaseTypeCalculated";
|
|
4917
4918
|
/* @internal */
|
|
4918
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] =
|
|
4919
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 134217728] = "IdenticalBaseTypeExists";
|
|
4919
4920
|
// Flags that require TypeFlags.UnionOrIntersection or TypeFlags.Substitution
|
|
4920
4921
|
/* @internal */
|
|
4921
4922
|
ObjectFlags[ObjectFlags["IsGenericTypeComputed"] = 4194304] = "IsGenericTypeComputed";
|
|
@@ -8133,7 +8134,6 @@ var ts;
|
|
|
8133
8134
|
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 `}`?"),
|
|
8134
8135
|
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 `>`?"),
|
|
8135
8136
|
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'."),
|
|
8136
|
-
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."),
|
|
8137
8137
|
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."),
|
|
8138
8138
|
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."),
|
|
8139
8139
|
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."),
|
|
@@ -8519,6 +8519,7 @@ var ts;
|
|
|
8519
8519
|
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."),
|
|
8520
8520
|
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"),
|
|
8521
8521
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8522
|
+
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."),
|
|
8522
8523
|
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."),
|
|
8523
8524
|
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."),
|
|
8524
8525
|
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."),
|
|
@@ -13410,6 +13411,7 @@ var ts;
|
|
|
13410
13411
|
case 110 /* TrueKeyword */:
|
|
13411
13412
|
case 106 /* SuperKeyword */:
|
|
13412
13413
|
case 229 /* NonNullExpression */:
|
|
13414
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
13413
13415
|
case 230 /* MetaProperty */:
|
|
13414
13416
|
case 100 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
|
|
13415
13417
|
return true;
|
|
@@ -15123,7 +15125,7 @@ var ts;
|
|
|
15123
15125
|
case 114 /* VoidKeyword */:
|
|
15124
15126
|
return node.parent.kind !== 216 /* VoidExpression */;
|
|
15125
15127
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15126
|
-
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
|
15128
|
+
return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
|
15127
15129
|
case 162 /* TypeParameter */:
|
|
15128
15130
|
return node.parent.kind === 194 /* MappedType */ || node.parent.kind === 189 /* InferType */;
|
|
15129
15131
|
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
|
@@ -15160,7 +15162,7 @@ var ts;
|
|
|
15160
15162
|
}
|
|
15161
15163
|
switch (parent.kind) {
|
|
15162
15164
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15163
|
-
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15165
|
+
return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15164
15166
|
case 162 /* TypeParameter */:
|
|
15165
15167
|
return node === parent.constraint;
|
|
15166
15168
|
case 342 /* JSDocTemplateTag */:
|
|
@@ -15863,7 +15865,7 @@ var ts;
|
|
|
15863
15865
|
case 296 /* SpreadAssignment */:
|
|
15864
15866
|
return true;
|
|
15865
15867
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15866
|
-
return parent.expression === node &&
|
|
15868
|
+
return parent.expression === node && !isPartOfTypeNode(parent);
|
|
15867
15869
|
case 295 /* ShorthandPropertyAssignment */:
|
|
15868
15870
|
return parent.objectAssignmentInitializer === node;
|
|
15869
15871
|
default:
|
|
@@ -22850,16 +22852,18 @@ var ts;
|
|
|
22850
22852
|
return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type);
|
|
22851
22853
|
}
|
|
22852
22854
|
// @api
|
|
22853
|
-
function createTypeQueryNode(exprName) {
|
|
22855
|
+
function createTypeQueryNode(exprName, typeArguments) {
|
|
22854
22856
|
var node = createBaseNode(180 /* TypeQuery */);
|
|
22855
22857
|
node.exprName = exprName;
|
|
22858
|
+
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
22856
22859
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
22857
22860
|
return node;
|
|
22858
22861
|
}
|
|
22859
22862
|
// @api
|
|
22860
|
-
function updateTypeQueryNode(node, exprName) {
|
|
22863
|
+
function updateTypeQueryNode(node, exprName, typeArguments) {
|
|
22861
22864
|
return node.exprName !== exprName
|
|
22862
|
-
|
|
22865
|
+
|| node.typeArguments !== typeArguments
|
|
22866
|
+
? update(createTypeQueryNode(exprName, typeArguments), node)
|
|
22863
22867
|
: node;
|
|
22864
22868
|
}
|
|
22865
22869
|
// @api
|
|
@@ -29983,7 +29987,8 @@ var ts;
|
|
|
29983
29987
|
visitNode(cbNode, node.parameterName) ||
|
|
29984
29988
|
visitNode(cbNode, node.type);
|
|
29985
29989
|
case 180 /* TypeQuery */:
|
|
29986
|
-
return visitNode(cbNode, node.exprName)
|
|
29990
|
+
return visitNode(cbNode, node.exprName) ||
|
|
29991
|
+
visitNodes(cbNode, cbNodes, node.typeArguments);
|
|
29987
29992
|
case 181 /* TypeLiteral */:
|
|
29988
29993
|
return visitNodes(cbNode, cbNodes, node.members);
|
|
29989
29994
|
case 182 /* ArrayType */:
|
|
@@ -32516,7 +32521,9 @@ var ts;
|
|
|
32516
32521
|
function parseTypeQuery() {
|
|
32517
32522
|
var pos = getNodePos();
|
|
32518
32523
|
parseExpected(112 /* TypeOfKeyword */);
|
|
32519
|
-
|
|
32524
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
32525
|
+
var typeArguments = tryParseTypeArguments();
|
|
32526
|
+
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
32520
32527
|
}
|
|
32521
32528
|
function parseTypeParameter() {
|
|
32522
32529
|
var pos = getNodePos();
|
|
@@ -34586,20 +34593,30 @@ var ts;
|
|
|
34586
34593
|
expression = parsePropertyAccessExpressionRest(pos, expression, questionDotToken);
|
|
34587
34594
|
continue;
|
|
34588
34595
|
}
|
|
34589
|
-
if (!questionDotToken && token() === 53 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
|
|
34590
|
-
nextToken();
|
|
34591
|
-
expression = finishNode(factory.createNonNullExpression(expression), pos);
|
|
34592
|
-
continue;
|
|
34593
|
-
}
|
|
34594
34596
|
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
|
|
34595
34597
|
if ((questionDotToken || !inDecoratorContext()) && parseOptional(22 /* OpenBracketToken */)) {
|
|
34596
34598
|
expression = parseElementAccessExpressionRest(pos, expression, questionDotToken);
|
|
34597
34599
|
continue;
|
|
34598
34600
|
}
|
|
34599
34601
|
if (isTemplateStartOfTaggedTemplate()) {
|
|
34600
|
-
|
|
34602
|
+
// Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments
|
|
34603
|
+
expression = !questionDotToken && expression.kind === 227 /* ExpressionWithTypeArguments */ ?
|
|
34604
|
+
parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) :
|
|
34605
|
+
parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined);
|
|
34601
34606
|
continue;
|
|
34602
34607
|
}
|
|
34608
|
+
if (!questionDotToken) {
|
|
34609
|
+
if (token() === 53 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
|
|
34610
|
+
nextToken();
|
|
34611
|
+
expression = finishNode(factory.createNonNullExpression(expression), pos);
|
|
34612
|
+
continue;
|
|
34613
|
+
}
|
|
34614
|
+
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34615
|
+
if (typeArguments) {
|
|
34616
|
+
expression = finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
34617
|
+
continue;
|
|
34618
|
+
}
|
|
34619
|
+
}
|
|
34603
34620
|
return expression;
|
|
34604
34621
|
}
|
|
34605
34622
|
}
|
|
@@ -34619,38 +34636,30 @@ var ts;
|
|
|
34619
34636
|
function parseCallExpressionRest(pos, expression) {
|
|
34620
34637
|
while (true) {
|
|
34621
34638
|
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
|
|
34639
|
+
var typeArguments = void 0;
|
|
34622
34640
|
var questionDotToken = parseOptionalToken(28 /* QuestionDotToken */);
|
|
34623
|
-
|
|
34624
|
-
|
|
34625
|
-
|
|
34626
|
-
|
|
34627
|
-
// keep checking for postfix expressions. Otherwise, it's just a '<' that's
|
|
34628
|
-
// part of an arithmetic expression. Break out so we consume it higher in the
|
|
34629
|
-
// stack.
|
|
34630
|
-
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34631
|
-
if (typeArguments) {
|
|
34632
|
-
if (isTemplateStartOfTaggedTemplate()) {
|
|
34633
|
-
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
|
|
34634
|
-
continue;
|
|
34635
|
-
}
|
|
34636
|
-
var argumentList = parseArgumentList();
|
|
34637
|
-
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34638
|
-
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
|
|
34639
|
-
factory.createCallExpression(expression, typeArguments, argumentList);
|
|
34640
|
-
expression = finishNode(callExpr, pos);
|
|
34641
|
+
if (questionDotToken) {
|
|
34642
|
+
typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34643
|
+
if (isTemplateStartOfTaggedTemplate()) {
|
|
34644
|
+
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
|
|
34641
34645
|
continue;
|
|
34642
34646
|
}
|
|
34643
34647
|
}
|
|
34644
|
-
|
|
34648
|
+
if (typeArguments || token() === 20 /* OpenParenToken */) {
|
|
34649
|
+
// Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments
|
|
34650
|
+
if (!questionDotToken && expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
34651
|
+
typeArguments = expression.typeArguments;
|
|
34652
|
+
expression = expression.expression;
|
|
34653
|
+
}
|
|
34645
34654
|
var argumentList = parseArgumentList();
|
|
34646
34655
|
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34647
|
-
factory.createCallChain(expression, questionDotToken,
|
|
34648
|
-
factory.createCallExpression(expression,
|
|
34656
|
+
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
|
|
34657
|
+
factory.createCallExpression(expression, typeArguments, argumentList);
|
|
34649
34658
|
expression = finishNode(callExpr, pos);
|
|
34650
34659
|
continue;
|
|
34651
34660
|
}
|
|
34652
34661
|
if (questionDotToken) {
|
|
34653
|
-
// We failed to parse anything, so report a missing identifier here.
|
|
34662
|
+
// We parsed `?.` but then failed to parse anything, so report a missing identifier here.
|
|
34654
34663
|
var name = createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.Identifier_expected);
|
|
34655
34664
|
expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos);
|
|
34656
34665
|
}
|
|
@@ -34678,21 +34687,25 @@ var ts;
|
|
|
34678
34687
|
// If it doesn't have the closing `>` then it's definitely not an type argument list.
|
|
34679
34688
|
return undefined;
|
|
34680
34689
|
}
|
|
34681
|
-
//
|
|
34682
|
-
//
|
|
34683
|
-
|
|
34684
|
-
|
|
34685
|
-
|
|
34690
|
+
// We successfully parsed a type argument list. The next token determines whether we want to
|
|
34691
|
+
// treat it as such. If the type argument list is followed by `(` or a template literal, as in
|
|
34692
|
+
// `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
|
|
34693
|
+
// it as a relational expression.
|
|
34694
|
+
return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined;
|
|
34686
34695
|
}
|
|
34687
34696
|
function canFollowTypeArgumentsInExpression() {
|
|
34688
34697
|
switch (token()) {
|
|
34698
|
+
// These tokens can follow a type argument list in a call expression.
|
|
34689
34699
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
34690
34700
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
34691
34701
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
34692
|
-
//
|
|
34693
|
-
//
|
|
34702
|
+
// These tokens can't follow in a call expression, nor can they start an
|
|
34703
|
+
// expression. So, consider the type argument list part of an instantiation
|
|
34704
|
+
// expression.
|
|
34694
34705
|
// falls through
|
|
34706
|
+
case 27 /* CommaToken */: // foo<x>,
|
|
34695
34707
|
case 24 /* DotToken */: // foo<x>.
|
|
34708
|
+
case 28 /* QuestionDotToken */: // foo<x>?.
|
|
34696
34709
|
case 21 /* CloseParenToken */: // foo<x>)
|
|
34697
34710
|
case 23 /* CloseBracketToken */: // foo<x>]
|
|
34698
34711
|
case 58 /* ColonToken */: // foo<x>:
|
|
@@ -34710,20 +34723,10 @@ var ts;
|
|
|
34710
34723
|
case 51 /* BarToken */: // foo<x> |
|
|
34711
34724
|
case 19 /* CloseBraceToken */: // foo<x> }
|
|
34712
34725
|
case 1 /* EndOfFileToken */: // foo<x>
|
|
34713
|
-
// these cases can't legally follow a type arg list. However, they're not legal
|
|
34714
|
-
// expressions either. The user is probably in the middle of a generic type. So
|
|
34715
|
-
// treat it as such.
|
|
34716
34726
|
return true;
|
|
34717
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
34718
|
-
case 18 /* OpenBraceToken */: // foo<x> {
|
|
34719
|
-
// We don't want to treat these as type arguments. Otherwise we'll parse this
|
|
34720
|
-
// as an invocation expression. Instead, we want to parse out the expression
|
|
34721
|
-
// in isolation from the type arguments.
|
|
34722
|
-
// falls through
|
|
34723
|
-
default:
|
|
34724
|
-
// Anything else treat as an expression.
|
|
34725
|
-
return false;
|
|
34726
34727
|
}
|
|
34728
|
+
// Treat anything else as an expression.
|
|
34729
|
+
return false;
|
|
34727
34730
|
}
|
|
34728
34731
|
function parsePrimaryExpression() {
|
|
34729
34732
|
switch (token()) {
|
|
@@ -34904,26 +34907,15 @@ var ts;
|
|
|
34904
34907
|
return finishNode(factory.createMetaProperty(103 /* NewKeyword */, name), pos);
|
|
34905
34908
|
}
|
|
34906
34909
|
var expressionPos = getNodePos();
|
|
34907
|
-
var expression = parsePrimaryExpression();
|
|
34910
|
+
var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false);
|
|
34908
34911
|
var typeArguments;
|
|
34909
|
-
|
|
34910
|
-
|
|
34911
|
-
typeArguments =
|
|
34912
|
-
|
|
34913
|
-
ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
|
|
34914
|
-
expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
|
|
34915
|
-
typeArguments = undefined;
|
|
34916
|
-
}
|
|
34917
|
-
break;
|
|
34918
|
-
}
|
|
34919
|
-
var argumentsArray;
|
|
34920
|
-
if (token() === 20 /* OpenParenToken */) {
|
|
34921
|
-
argumentsArray = parseArgumentList();
|
|
34922
|
-
}
|
|
34923
|
-
else if (typeArguments) {
|
|
34924
|
-
parseErrorAt(pos, scanner.getStartPos(), ts.Diagnostics.A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list);
|
|
34912
|
+
// Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments
|
|
34913
|
+
if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
34914
|
+
typeArguments = expression.typeArguments;
|
|
34915
|
+
expression = expression.expression;
|
|
34925
34916
|
}
|
|
34926
|
-
|
|
34917
|
+
var argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : undefined;
|
|
34918
|
+
return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos);
|
|
34927
34919
|
}
|
|
34928
34920
|
// STATEMENTS
|
|
34929
34921
|
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
|
|
@@ -36012,6 +36004,9 @@ var ts;
|
|
|
36012
36004
|
function parseExpressionWithTypeArguments() {
|
|
36013
36005
|
var pos = getNodePos();
|
|
36014
36006
|
var expression = parseLeftHandSideExpressionOrHigher();
|
|
36007
|
+
if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
36008
|
+
return expression;
|
|
36009
|
+
}
|
|
36015
36010
|
var typeArguments = tryParseTypeArguments();
|
|
36016
36011
|
return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
36017
36012
|
}
|
|
@@ -51020,7 +51015,7 @@ var ts;
|
|
|
51020
51015
|
// get symbol of the first identifier of the entityName
|
|
51021
51016
|
var meaning;
|
|
51022
51017
|
if (entityName.parent.kind === 180 /* TypeQuery */ ||
|
|
51023
|
-
ts.
|
|
51018
|
+
entityName.parent.kind === 227 /* ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) ||
|
|
51024
51019
|
entityName.parent.kind === 161 /* ComputedPropertyName */) {
|
|
51025
51020
|
// Typeof value
|
|
51026
51021
|
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
@@ -51131,7 +51126,7 @@ var ts;
|
|
|
51131
51126
|
return flags & 814775659 /* NodeBuilderFlagsMask */;
|
|
51132
51127
|
}
|
|
51133
51128
|
function isClassInstanceSide(type) {
|
|
51134
|
-
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) &
|
|
51129
|
+
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 33554432 /* IsClassInstanceClone */)));
|
|
51135
51130
|
}
|
|
51136
51131
|
function createNodeBuilder() {
|
|
51137
51132
|
return {
|
|
@@ -55060,7 +55055,7 @@ var ts;
|
|
|
55060
55055
|
members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
|
|
55061
55056
|
result.objectFlags |= (ts.getObjectFlags(type) & 8192 /* JSLiteral */); // Propagate JSLiteral flag
|
|
55062
55057
|
if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
|
|
55063
|
-
result.objectFlags |=
|
|
55058
|
+
result.objectFlags |= 33554432 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
|
|
55064
55059
|
}
|
|
55065
55060
|
return result;
|
|
55066
55061
|
}
|
|
@@ -57106,87 +57101,87 @@ var ts;
|
|
|
57106
57101
|
* Converts an AnonymousType to a ResolvedType.
|
|
57107
57102
|
*/
|
|
57108
57103
|
function resolveAnonymousTypeMembers(type) {
|
|
57109
|
-
var symbol = getMergedSymbol(type.symbol);
|
|
57110
57104
|
if (type.target) {
|
|
57111
57105
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57112
|
-
var
|
|
57106
|
+
var members_6 = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
|
|
57113
57107
|
var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper);
|
|
57114
57108
|
var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper);
|
|
57115
|
-
var
|
|
57116
|
-
setStructuredTypeMembers(type,
|
|
57109
|
+
var indexInfos_1 = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
|
|
57110
|
+
setStructuredTypeMembers(type, members_6, callSignatures, constructSignatures, indexInfos_1);
|
|
57111
|
+
return;
|
|
57117
57112
|
}
|
|
57118
|
-
|
|
57113
|
+
var symbol = getMergedSymbol(type.symbol);
|
|
57114
|
+
if (symbol.flags & 2048 /* TypeLiteral */) {
|
|
57119
57115
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57120
|
-
var
|
|
57121
|
-
var callSignatures = getSignaturesOfSymbol(
|
|
57122
|
-
var constructSignatures = getSignaturesOfSymbol(
|
|
57123
|
-
var
|
|
57124
|
-
setStructuredTypeMembers(type,
|
|
57116
|
+
var members_7 = getMembersOfSymbol(symbol);
|
|
57117
|
+
var callSignatures = getSignaturesOfSymbol(members_7.get("__call" /* Call */));
|
|
57118
|
+
var constructSignatures = getSignaturesOfSymbol(members_7.get("__new" /* New */));
|
|
57119
|
+
var indexInfos_2 = getIndexInfosOfSymbol(symbol);
|
|
57120
|
+
setStructuredTypeMembers(type, members_7, callSignatures, constructSignatures, indexInfos_2);
|
|
57121
|
+
return;
|
|
57125
57122
|
}
|
|
57126
|
-
|
|
57127
|
-
|
|
57128
|
-
|
|
57129
|
-
|
|
57130
|
-
|
|
57131
|
-
|
|
57132
|
-
|
|
57133
|
-
|
|
57134
|
-
|
|
57135
|
-
|
|
57136
|
-
|
|
57137
|
-
|
|
57138
|
-
|
|
57139
|
-
members = varsOnly_1;
|
|
57140
|
-
}
|
|
57123
|
+
// Combinations of function, class, enum and module
|
|
57124
|
+
var members = emptySymbols;
|
|
57125
|
+
var indexInfos;
|
|
57126
|
+
if (symbol.exports) {
|
|
57127
|
+
members = getExportsOfSymbol(symbol);
|
|
57128
|
+
if (symbol === globalThisSymbol) {
|
|
57129
|
+
var varsOnly_1 = new ts.Map();
|
|
57130
|
+
members.forEach(function (p) {
|
|
57131
|
+
if (!(p.flags & 418 /* BlockScoped */)) {
|
|
57132
|
+
varsOnly_1.set(p.escapedName, p);
|
|
57133
|
+
}
|
|
57134
|
+
});
|
|
57135
|
+
members = varsOnly_1;
|
|
57141
57136
|
}
|
|
57142
|
-
|
|
57143
|
-
|
|
57144
|
-
|
|
57145
|
-
|
|
57146
|
-
|
|
57147
|
-
|
|
57148
|
-
|
|
57149
|
-
|
|
57150
|
-
|
|
57151
|
-
else if (baseConstructorType === anyType) {
|
|
57152
|
-
baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
|
|
57153
|
-
}
|
|
57137
|
+
}
|
|
57138
|
+
var baseConstructorIndexInfo;
|
|
57139
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57140
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57141
|
+
var classType = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57142
|
+
var baseConstructorType = getBaseConstructorTypeOfClass(classType);
|
|
57143
|
+
if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
|
|
57144
|
+
members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
|
|
57145
|
+
addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
|
|
57154
57146
|
}
|
|
57155
|
-
|
|
57156
|
-
|
|
57157
|
-
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57147
|
+
else if (baseConstructorType === anyType) {
|
|
57148
|
+
baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
|
|
57158
57149
|
}
|
|
57159
|
-
|
|
57160
|
-
|
|
57161
|
-
|
|
57162
|
-
|
|
57163
|
-
|
|
57164
|
-
|
|
57165
|
-
|
|
57166
|
-
|
|
57150
|
+
}
|
|
57151
|
+
var indexSymbol = getIndexSymbolFromSymbolTable(members);
|
|
57152
|
+
if (indexSymbol) {
|
|
57153
|
+
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57154
|
+
}
|
|
57155
|
+
else {
|
|
57156
|
+
if (baseConstructorIndexInfo) {
|
|
57157
|
+
indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
|
|
57167
57158
|
}
|
|
57168
|
-
|
|
57169
|
-
|
|
57170
|
-
|
|
57171
|
-
// in the process of resolving (see issue #6072). The temporarily empty signature list
|
|
57172
|
-
// will never be observed because a qualified name can't reference signatures.
|
|
57173
|
-
if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
|
|
57174
|
-
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57159
|
+
if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
|
|
57160
|
+
ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
|
|
57161
|
+
indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
|
|
57175
57162
|
}
|
|
57176
|
-
|
|
57177
|
-
|
|
57178
|
-
|
|
57179
|
-
|
|
57180
|
-
|
|
57181
|
-
|
|
57182
|
-
|
|
57183
|
-
|
|
57184
|
-
|
|
57185
|
-
|
|
57186
|
-
|
|
57187
|
-
|
|
57188
|
-
|
|
57163
|
+
}
|
|
57164
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
|
|
57165
|
+
// We resolve the members before computing the signatures because a signature may use
|
|
57166
|
+
// typeof with a qualified name expression that circularly references the type we are
|
|
57167
|
+
// in the process of resolving (see issue #6072). The temporarily empty signature list
|
|
57168
|
+
// will never be observed because a qualified name can't reference signatures.
|
|
57169
|
+
if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
|
|
57170
|
+
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57171
|
+
}
|
|
57172
|
+
// And likewise for construct signatures for classes
|
|
57173
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57174
|
+
var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57175
|
+
var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
|
|
57176
|
+
if (symbol.flags & 16 /* Function */) {
|
|
57177
|
+
constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
|
|
57178
|
+
createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
|
|
57179
|
+
undefined; }));
|
|
57180
|
+
}
|
|
57181
|
+
if (!constructSignatures.length) {
|
|
57182
|
+
constructSignatures = getDefaultConstructSignatures(classType_1);
|
|
57189
57183
|
}
|
|
57184
|
+
type.constructSignatures = constructSignatures;
|
|
57190
57185
|
}
|
|
57191
57186
|
}
|
|
57192
57187
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
@@ -58187,8 +58182,8 @@ var ts;
|
|
|
58187
58182
|
var stringIndexInfo;
|
|
58188
58183
|
var applicableInfo;
|
|
58189
58184
|
var applicableInfos;
|
|
58190
|
-
for (var _i = 0,
|
|
58191
|
-
var info =
|
|
58185
|
+
for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
|
|
58186
|
+
var info = indexInfos_3[_i];
|
|
58192
58187
|
if (info.keyType === stringType) {
|
|
58193
58188
|
stringIndexInfo = info;
|
|
58194
58189
|
}
|
|
@@ -58761,14 +58756,14 @@ var ts;
|
|
|
58761
58756
|
}
|
|
58762
58757
|
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
58763
58758
|
if (indexSymbol.declarations) {
|
|
58764
|
-
var
|
|
58759
|
+
var indexInfos_4 = [];
|
|
58765
58760
|
var _loop_14 = function (declaration) {
|
|
58766
58761
|
if (declaration.parameters.length === 1) {
|
|
58767
58762
|
var parameter = declaration.parameters[0];
|
|
58768
58763
|
if (parameter.type) {
|
|
58769
58764
|
forEachType(getTypeFromTypeNode(parameter.type), function (keyType) {
|
|
58770
|
-
if (isValidIndexKeyType(keyType) && !findIndexInfo(
|
|
58771
|
-
|
|
58765
|
+
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_4, keyType)) {
|
|
58766
|
+
indexInfos_4.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
|
|
58772
58767
|
}
|
|
58773
58768
|
});
|
|
58774
58769
|
}
|
|
@@ -58778,7 +58773,7 @@ var ts;
|
|
|
58778
58773
|
var declaration = _a[_i];
|
|
58779
58774
|
_loop_14(declaration);
|
|
58780
58775
|
}
|
|
58781
|
-
return
|
|
58776
|
+
return indexInfos_4;
|
|
58782
58777
|
}
|
|
58783
58778
|
return ts.emptyArray;
|
|
58784
58779
|
}
|
|
@@ -59326,7 +59321,7 @@ var ts;
|
|
|
59326
59321
|
// The expression is processed as an identifier expression (section 4.3)
|
|
59327
59322
|
// or property access expression(section 4.10),
|
|
59328
59323
|
// the widened type(section 3.9) of which becomes the result.
|
|
59329
|
-
var type =
|
|
59324
|
+
var type = checkExpressionWithTypeArguments(node);
|
|
59330
59325
|
links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type));
|
|
59331
59326
|
}
|
|
59332
59327
|
return links.resolvedType;
|
|
@@ -62030,7 +62025,9 @@ var ts;
|
|
|
62030
62025
|
return result;
|
|
62031
62026
|
}
|
|
62032
62027
|
function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
62033
|
-
var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
|
|
62028
|
+
var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
|
|
62029
|
+
type.objectFlags & 16777216 /* InstantiationExpressionType */ ? type.node :
|
|
62030
|
+
type.symbol.declarations[0];
|
|
62034
62031
|
var links = getNodeLinks(declaration);
|
|
62035
62032
|
var target = type.objectFlags & 4 /* Reference */ ? links.resolvedType :
|
|
62036
62033
|
type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
@@ -62046,8 +62043,8 @@ var ts;
|
|
|
62046
62043
|
outerTypeParameters = ts.addRange(outerTypeParameters, templateTagParameters);
|
|
62047
62044
|
}
|
|
62048
62045
|
typeParameters = outerTypeParameters || ts.emptyArray;
|
|
62049
|
-
var allDeclarations_1 = type.objectFlags & 4 /* Reference */ ? [declaration] : type.symbol.declarations;
|
|
62050
|
-
typeParameters = (target.objectFlags & 4 /* Reference */ || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
|
|
62046
|
+
var allDeclarations_1 = type.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) ? [declaration] : type.symbol.declarations;
|
|
62047
|
+
typeParameters = (target.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
|
|
62051
62048
|
ts.filter(typeParameters, function (tp) { return ts.some(allDeclarations_1, function (d) { return isTypeParameterPossiblyReferenced(tp, d); }); }) :
|
|
62052
62049
|
typeParameters;
|
|
62053
62050
|
links.outerTypeParameters = typeParameters;
|
|
@@ -62219,6 +62216,9 @@ var ts;
|
|
|
62219
62216
|
mapper = combineTypeMappers(makeUnaryTypeMapper(origTypeParameter, freshTypeParameter), mapper);
|
|
62220
62217
|
freshTypeParameter.mapper = mapper;
|
|
62221
62218
|
}
|
|
62219
|
+
if (type.objectFlags & 16777216 /* InstantiationExpressionType */) {
|
|
62220
|
+
result.node = type.node;
|
|
62221
|
+
}
|
|
62222
62222
|
result.target = type;
|
|
62223
62223
|
result.mapper = mapper;
|
|
62224
62224
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -65412,8 +65412,8 @@ var ts;
|
|
|
65412
65412
|
var indexInfos = getIndexInfosOfType(target);
|
|
65413
65413
|
var targetHasStringIndex = ts.some(indexInfos, function (info) { return info.keyType === stringType; });
|
|
65414
65414
|
var result = -1 /* True */;
|
|
65415
|
-
for (var _i = 0,
|
|
65416
|
-
var targetInfo =
|
|
65415
|
+
for (var _i = 0, indexInfos_5 = indexInfos; _i < indexInfos_5.length; _i++) {
|
|
65416
|
+
var targetInfo = indexInfos_5[_i];
|
|
65417
65417
|
var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ :
|
|
65418
65418
|
isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, 3 /* Both */, reportErrors) :
|
|
65419
65419
|
typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState);
|
|
@@ -66020,10 +66020,10 @@ var ts;
|
|
|
66020
66020
|
if (!(ts.getObjectFlags(type) & 4 /* Reference */) || !(ts.getObjectFlags(type.target) & 3 /* ClassOrInterface */)) {
|
|
66021
66021
|
return undefined;
|
|
66022
66022
|
}
|
|
66023
|
-
if (ts.getObjectFlags(type) &
|
|
66024
|
-
return ts.getObjectFlags(type) &
|
|
66023
|
+
if (ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeCalculated */) {
|
|
66024
|
+
return ts.getObjectFlags(type) & 134217728 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
|
|
66025
66025
|
}
|
|
66026
|
-
type.objectFlags |=
|
|
66026
|
+
type.objectFlags |= 67108864 /* IdenticalBaseTypeCalculated */;
|
|
66027
66027
|
var target = type.target;
|
|
66028
66028
|
if (ts.getObjectFlags(target) & 1 /* Class */) {
|
|
66029
66029
|
var baseTypeNode = getBaseTypeNodeOfClass(target);
|
|
@@ -66044,7 +66044,7 @@ var ts;
|
|
|
66044
66044
|
if (ts.length(getTypeArguments(type)) > ts.length(target.typeParameters)) {
|
|
66045
66045
|
instantiatedBase = getTypeWithThisArgument(instantiatedBase, ts.last(getTypeArguments(type)));
|
|
66046
66046
|
}
|
|
66047
|
-
type.objectFlags |=
|
|
66047
|
+
type.objectFlags |= 134217728 /* IdenticalBaseTypeExists */;
|
|
66048
66048
|
return type.cachedEquivalentBaseType = instantiatedBase;
|
|
66049
66049
|
}
|
|
66050
66050
|
function isEmptyLiteralType(type) {
|
|
@@ -66708,7 +66708,7 @@ var ts;
|
|
|
66708
66708
|
var result = !!(type.flags & 465829888 /* Instantiable */ ||
|
|
66709
66709
|
type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || ts.forEach(getTypeArguments(type), couldContainTypeVariables)) ||
|
|
66710
66710
|
objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
|
|
66711
|
-
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */)) ||
|
|
66711
|
+
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */ | 16777216 /* InstantiationExpressionType */)) ||
|
|
66712
66712
|
type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && ts.some(type.types, couldContainTypeVariables));
|
|
66713
66713
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
66714
66714
|
type.objectFlags |= 1048576 /* CouldContainTypeVariablesComputed */ | (result ? 2097152 /* CouldContainTypeVariables */ : 0);
|
|
@@ -67625,8 +67625,8 @@ var ts;
|
|
|
67625
67625
|
var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* Mapped */) ? 8 /* HomomorphicMappedType */ : 0;
|
|
67626
67626
|
var indexInfos = getIndexInfosOfType(target);
|
|
67627
67627
|
if (isObjectTypeWithInferableIndex(source)) {
|
|
67628
|
-
for (var _i = 0,
|
|
67629
|
-
var targetInfo =
|
|
67628
|
+
for (var _i = 0, indexInfos_6 = indexInfos; _i < indexInfos_6.length; _i++) {
|
|
67629
|
+
var targetInfo = indexInfos_6[_i];
|
|
67630
67630
|
var propTypes = [];
|
|
67631
67631
|
for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
|
|
67632
67632
|
var prop = _b[_a];
|
|
@@ -67646,8 +67646,8 @@ var ts;
|
|
|
67646
67646
|
}
|
|
67647
67647
|
}
|
|
67648
67648
|
}
|
|
67649
|
-
for (var _e = 0,
|
|
67650
|
-
var targetInfo =
|
|
67649
|
+
for (var _e = 0, indexInfos_7 = indexInfos; _e < indexInfos_7.length; _e++) {
|
|
67650
|
+
var targetInfo = indexInfos_7[_e];
|
|
67651
67651
|
var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType);
|
|
67652
67652
|
if (sourceInfo) {
|
|
67653
67653
|
inferWithPriority(sourceInfo.type, targetInfo.type, priority);
|
|
@@ -75811,6 +75811,72 @@ var ts;
|
|
|
75811
75811
|
return node.flags & 32 /* OptionalChain */ ? checkNonNullChain(node) :
|
|
75812
75812
|
getNonNullableType(checkExpression(node.expression));
|
|
75813
75813
|
}
|
|
75814
|
+
function checkExpressionWithTypeArguments(node) {
|
|
75815
|
+
checkGrammarExpressionWithTypeArguments(node);
|
|
75816
|
+
var exprType = node.kind === 227 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) :
|
|
75817
|
+
ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) :
|
|
75818
|
+
checkExpression(node.exprName);
|
|
75819
|
+
var typeArguments = node.typeArguments;
|
|
75820
|
+
if (exprType === silentNeverType || isErrorType(exprType) || !ts.some(typeArguments)) {
|
|
75821
|
+
return exprType;
|
|
75822
|
+
}
|
|
75823
|
+
var hasSomeApplicableSignature = false;
|
|
75824
|
+
var nonApplicableType;
|
|
75825
|
+
var result = getInstantiatedType(exprType);
|
|
75826
|
+
var errorType = hasSomeApplicableSignature ? nonApplicableType : exprType;
|
|
75827
|
+
if (errorType) {
|
|
75828
|
+
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)));
|
|
75829
|
+
}
|
|
75830
|
+
return result;
|
|
75831
|
+
function getInstantiatedType(type) {
|
|
75832
|
+
var hasSignatures = false;
|
|
75833
|
+
var hasApplicableSignature = false;
|
|
75834
|
+
var result = getInstantiatedTypePart(type);
|
|
75835
|
+
hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
|
|
75836
|
+
if (hasSignatures && !hasApplicableSignature) {
|
|
75837
|
+
nonApplicableType !== null && nonApplicableType !== void 0 ? nonApplicableType : (nonApplicableType = type);
|
|
75838
|
+
}
|
|
75839
|
+
return result;
|
|
75840
|
+
function getInstantiatedTypePart(type) {
|
|
75841
|
+
if (type.flags & 524288 /* Object */) {
|
|
75842
|
+
var resolved = resolveStructuredTypeMembers(type);
|
|
75843
|
+
var callSignatures = getInstantiatedSignatures(resolved.callSignatures);
|
|
75844
|
+
var constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
|
|
75845
|
+
hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
|
|
75846
|
+
hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
|
|
75847
|
+
if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
|
|
75848
|
+
var result_11 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
|
|
75849
|
+
result_11.objectFlags |= 16777216 /* InstantiationExpressionType */;
|
|
75850
|
+
result_11.node = node;
|
|
75851
|
+
return result_11;
|
|
75852
|
+
}
|
|
75853
|
+
}
|
|
75854
|
+
else if (type.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
75855
|
+
var constraint = getBaseConstraintOfType(type);
|
|
75856
|
+
if (constraint) {
|
|
75857
|
+
var instantiated = getInstantiatedTypePart(constraint);
|
|
75858
|
+
if (instantiated !== constraint) {
|
|
75859
|
+
return instantiated;
|
|
75860
|
+
}
|
|
75861
|
+
}
|
|
75862
|
+
}
|
|
75863
|
+
else if (type.flags & 1048576 /* Union */) {
|
|
75864
|
+
return mapType(type, getInstantiatedType);
|
|
75865
|
+
}
|
|
75866
|
+
else if (type.flags & 2097152 /* Intersection */) {
|
|
75867
|
+
return getIntersectionType(ts.sameMap(type.types, getInstantiatedTypePart));
|
|
75868
|
+
}
|
|
75869
|
+
return type;
|
|
75870
|
+
}
|
|
75871
|
+
}
|
|
75872
|
+
function getInstantiatedSignatures(signatures) {
|
|
75873
|
+
var applicableSignatures = ts.filter(signatures, function (sig) { return !!sig.typeParameters && hasCorrectTypeArgumentArity(sig, typeArguments); });
|
|
75874
|
+
return ts.sameMap(applicableSignatures, function (sig) {
|
|
75875
|
+
var typeArgumentTypes = checkTypeArguments(sig, typeArguments, /*reportErrors*/ true);
|
|
75876
|
+
return typeArgumentTypes ? getSignatureInstantiation(sig, typeArgumentTypes, ts.isInJSFile(sig.declaration)) : sig;
|
|
75877
|
+
});
|
|
75878
|
+
}
|
|
75879
|
+
}
|
|
75814
75880
|
function checkMetaProperty(node) {
|
|
75815
75881
|
checkGrammarMetaProperty(node);
|
|
75816
75882
|
if (node.keywordToken === 103 /* NewKeyword */) {
|
|
@@ -78327,6 +78393,8 @@ var ts;
|
|
|
78327
78393
|
return checkAssertion(node);
|
|
78328
78394
|
case 229 /* NonNullExpression */:
|
|
78329
78395
|
return checkNonNullAssertion(node);
|
|
78396
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
78397
|
+
return checkExpressionWithTypeArguments(node);
|
|
78330
78398
|
case 230 /* MetaProperty */:
|
|
78331
78399
|
return checkMetaProperty(node);
|
|
78332
78400
|
case 214 /* DeleteExpression */:
|
|
@@ -79530,12 +79598,12 @@ var ts;
|
|
|
79530
79598
|
case 264 /* ImportEqualsDeclaration */:
|
|
79531
79599
|
case 267 /* NamespaceImport */:
|
|
79532
79600
|
case 266 /* ImportClause */:
|
|
79533
|
-
var
|
|
79601
|
+
var result_12 = 0 /* None */;
|
|
79534
79602
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
79535
79603
|
ts.forEach(target.declarations, function (d) {
|
|
79536
|
-
|
|
79604
|
+
result_12 |= getDeclarationSpaces(d);
|
|
79537
79605
|
});
|
|
79538
|
-
return
|
|
79606
|
+
return result_12;
|
|
79539
79607
|
case 253 /* VariableDeclaration */:
|
|
79540
79608
|
case 202 /* BindingElement */:
|
|
79541
79609
|
case 255 /* FunctionDeclaration */:
|
|
@@ -82094,8 +82162,8 @@ var ts;
|
|
|
82094
82162
|
}
|
|
82095
82163
|
}
|
|
82096
82164
|
if (indexInfos.length > 1) {
|
|
82097
|
-
for (var _d = 0,
|
|
82098
|
-
var info =
|
|
82165
|
+
for (var _d = 0, indexInfos_8 = indexInfos; _d < indexInfos_8.length; _d++) {
|
|
82166
|
+
var info = indexInfos_8[_d];
|
|
82099
82167
|
checkIndexConstraintForIndexSignature(type, info);
|
|
82100
82168
|
}
|
|
82101
82169
|
}
|
|
@@ -82121,8 +82189,8 @@ var ts;
|
|
|
82121
82189
|
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));
|
|
82122
82190
|
}
|
|
82123
82191
|
};
|
|
82124
|
-
for (var _i = 0,
|
|
82125
|
-
var info =
|
|
82192
|
+
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
82193
|
+
var info = indexInfos_9[_i];
|
|
82126
82194
|
_loop_27(info);
|
|
82127
82195
|
}
|
|
82128
82196
|
}
|
|
@@ -82144,8 +82212,8 @@ var ts;
|
|
|
82144
82212
|
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));
|
|
82145
82213
|
}
|
|
82146
82214
|
};
|
|
82147
|
-
for (var _i = 0,
|
|
82148
|
-
var info =
|
|
82215
|
+
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
82216
|
+
var info = indexInfos_10[_i];
|
|
82149
82217
|
_loop_28(info);
|
|
82150
82218
|
}
|
|
82151
82219
|
}
|
|
@@ -87778,7 +87846,7 @@ var ts;
|
|
|
87778
87846
|
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));
|
|
87779
87847
|
case 180 /* TypeQuery */:
|
|
87780
87848
|
ts.Debug.type(node);
|
|
87781
|
-
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName));
|
|
87849
|
+
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
|
|
87782
87850
|
case 181 /* TypeLiteral */:
|
|
87783
87851
|
ts.Debug.type(node);
|
|
87784
87852
|
return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
|
|
@@ -90670,8 +90738,8 @@ var ts;
|
|
|
90670
90738
|
function generateClassElementDecorationExpressions(node, isStatic) {
|
|
90671
90739
|
var members = getDecoratedClassElements(node, isStatic);
|
|
90672
90740
|
var expressions;
|
|
90673
|
-
for (var _i = 0,
|
|
90674
|
-
var member =
|
|
90741
|
+
for (var _i = 0, members_8 = members; _i < members_8.length; _i++) {
|
|
90742
|
+
var member = members_8[_i];
|
|
90675
90743
|
var expression = generateClassElementDecorationExpression(node, member);
|
|
90676
90744
|
if (expression) {
|
|
90677
90745
|
if (!expressions) {
|
|
@@ -96016,8 +96084,8 @@ var ts;
|
|
|
96016
96084
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
96017
96085
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
96018
96086
|
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
96019
|
-
var
|
|
96020
|
-
return
|
|
96087
|
+
var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
96088
|
+
return result_13 && factory.createPropertyAssignment("children", result_13);
|
|
96021
96089
|
}
|
|
96022
96090
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
96023
96091
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -109655,6 +109723,8 @@ var ts;
|
|
|
109655
109723
|
return emitAsExpression(node);
|
|
109656
109724
|
case 229 /* NonNullExpression */:
|
|
109657
109725
|
return emitNonNullExpression(node);
|
|
109726
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
109727
|
+
return emitExpressionWithTypeArguments(node);
|
|
109658
109728
|
case 230 /* MetaProperty */:
|
|
109659
109729
|
return emitMetaProperty(node);
|
|
109660
109730
|
case 231 /* SyntheticExpression */:
|
|
@@ -110099,6 +110169,7 @@ var ts;
|
|
|
110099
110169
|
writeKeyword("typeof");
|
|
110100
110170
|
writeSpace();
|
|
110101
110171
|
emit(node.exprName);
|
|
110172
|
+
emitTypeArguments(node, node.typeArguments);
|
|
110102
110173
|
}
|
|
110103
110174
|
function emitTypeLiteral(node) {
|
|
110104
110175
|
writePunctuation("{");
|
|
@@ -115072,15 +115143,15 @@ var ts;
|
|
|
115072
115143
|
// which per above occurred during the current program creation.
|
|
115073
115144
|
// Since we assume the filesystem does not change during program creation,
|
|
115074
115145
|
// it is safe to reuse resolutions from the earlier call.
|
|
115075
|
-
var
|
|
115146
|
+
var result_14 = [];
|
|
115076
115147
|
var i = 0;
|
|
115077
115148
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
115078
115149
|
var moduleName = moduleNames_1[_i];
|
|
115079
115150
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
115080
115151
|
i++;
|
|
115081
|
-
|
|
115152
|
+
result_14.push(resolvedModule);
|
|
115082
115153
|
}
|
|
115083
|
-
return
|
|
115154
|
+
return result_14;
|
|
115084
115155
|
}
|
|
115085
115156
|
// At this point, we know at least one of the following hold:
|
|
115086
115157
|
// - file has local declarations for ambient modules
|
|
@@ -120198,9 +120269,9 @@ var ts;
|
|
|
120198
120269
|
if (!preferSymlinks) {
|
|
120199
120270
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
120200
120271
|
// so we only need to remove them from the realpath filenames.
|
|
120201
|
-
var
|
|
120202
|
-
if (
|
|
120203
|
-
return
|
|
120272
|
+
var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
120273
|
+
if (result_15)
|
|
120274
|
+
return result_15;
|
|
120204
120275
|
}
|
|
120205
120276
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
120206
120277
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -120220,10 +120291,10 @@ var ts;
|
|
|
120220
120291
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
120221
120292
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
120222
120293
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
120223
|
-
var
|
|
120294
|
+
var result_16 = cb(option, target === referenceRedirect);
|
|
120224
120295
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
120225
|
-
if (
|
|
120226
|
-
return
|
|
120296
|
+
if (result_16)
|
|
120297
|
+
return result_16;
|
|
120227
120298
|
}
|
|
120228
120299
|
});
|
|
120229
120300
|
});
|