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/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220217";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -5114,13 +5114,14 @@ var ts;
|
|
|
5114
5114
|
// Flags that require TypeFlags.Object
|
|
5115
5115
|
ObjectFlags[ObjectFlags["ContainsSpread"] = 4194304] = "ContainsSpread";
|
|
5116
5116
|
ObjectFlags[ObjectFlags["ObjectRestType"] = 8388608] = "ObjectRestType";
|
|
5117
|
+
ObjectFlags[ObjectFlags["InstantiationExpressionType"] = 16777216] = "InstantiationExpressionType";
|
|
5117
5118
|
/* @internal */
|
|
5118
|
-
ObjectFlags[ObjectFlags["IsClassInstanceClone"] =
|
|
5119
|
+
ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 33554432] = "IsClassInstanceClone";
|
|
5119
5120
|
// Flags that require TypeFlags.Object and ObjectFlags.Reference
|
|
5120
5121
|
/* @internal */
|
|
5121
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] =
|
|
5122
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 67108864] = "IdenticalBaseTypeCalculated";
|
|
5122
5123
|
/* @internal */
|
|
5123
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] =
|
|
5124
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 134217728] = "IdenticalBaseTypeExists";
|
|
5124
5125
|
// Flags that require TypeFlags.UnionOrIntersection or TypeFlags.Substitution
|
|
5125
5126
|
/* @internal */
|
|
5126
5127
|
ObjectFlags[ObjectFlags["IsGenericTypeComputed"] = 4194304] = "IsGenericTypeComputed";
|
|
@@ -8338,7 +8339,6 @@ var ts;
|
|
|
8338
8339
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
8339
8340
|
Unexpected_token_Did_you_mean_or_gt: diag(1382, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_gt_1382", "Unexpected token. Did you mean `{'>'}` or `>`?"),
|
|
8340
8341
|
Only_named_exports_may_use_export_type: diag(1383, ts.DiagnosticCategory.Error, "Only_named_exports_may_use_export_type_1383", "Only named exports may use 'export type'."),
|
|
8341
|
-
A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list: diag(1384, ts.DiagnosticCategory.Error, "A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list_1384", "A 'new' expression with type arguments must always be followed by a parenthesized argument list."),
|
|
8342
8342
|
Function_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1385, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385", "Function type notation must be parenthesized when used in a union type."),
|
|
8343
8343
|
Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1386, ts.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386", "Constructor type notation must be parenthesized when used in a union type."),
|
|
8344
8344
|
Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
|
|
@@ -8724,6 +8724,7 @@ var ts;
|
|
|
8724
8724
|
Cannot_assign_to_0_because_it_is_an_import: diag(2632, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_an_import_2632", "Cannot assign to '{0}' because it is an import."),
|
|
8725
8725
|
JSX_property_access_expressions_cannot_include_JSX_namespace_names: diag(2633, ts.DiagnosticCategory.Error, "JSX_property_access_expressions_cannot_include_JSX_namespace_names_2633", "JSX property access expressions cannot include JSX namespace names"),
|
|
8726
8726
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8727
|
+
Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
|
|
8727
8728
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
|
|
8728
8729
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
|
|
8729
8730
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
|
|
@@ -13615,6 +13616,7 @@ var ts;
|
|
|
13615
13616
|
case 110 /* TrueKeyword */:
|
|
13616
13617
|
case 106 /* SuperKeyword */:
|
|
13617
13618
|
case 229 /* NonNullExpression */:
|
|
13619
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
13618
13620
|
case 230 /* MetaProperty */:
|
|
13619
13621
|
case 100 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
|
|
13620
13622
|
return true;
|
|
@@ -15328,7 +15330,7 @@ var ts;
|
|
|
15328
15330
|
case 114 /* VoidKeyword */:
|
|
15329
15331
|
return node.parent.kind !== 216 /* VoidExpression */;
|
|
15330
15332
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15331
|
-
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
|
15333
|
+
return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
|
15332
15334
|
case 162 /* TypeParameter */:
|
|
15333
15335
|
return node.parent.kind === 194 /* MappedType */ || node.parent.kind === 189 /* InferType */;
|
|
15334
15336
|
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
|
@@ -15365,7 +15367,7 @@ var ts;
|
|
|
15365
15367
|
}
|
|
15366
15368
|
switch (parent.kind) {
|
|
15367
15369
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15368
|
-
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15370
|
+
return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15369
15371
|
case 162 /* TypeParameter */:
|
|
15370
15372
|
return node === parent.constraint;
|
|
15371
15373
|
case 342 /* JSDocTemplateTag */:
|
|
@@ -16068,7 +16070,7 @@ var ts;
|
|
|
16068
16070
|
case 296 /* SpreadAssignment */:
|
|
16069
16071
|
return true;
|
|
16070
16072
|
case 227 /* ExpressionWithTypeArguments */:
|
|
16071
|
-
return parent.expression === node &&
|
|
16073
|
+
return parent.expression === node && !isPartOfTypeNode(parent);
|
|
16072
16074
|
case 295 /* ShorthandPropertyAssignment */:
|
|
16073
16075
|
return parent.objectAssignmentInitializer === node;
|
|
16074
16076
|
default:
|
|
@@ -23055,16 +23057,18 @@ var ts;
|
|
|
23055
23057
|
return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type);
|
|
23056
23058
|
}
|
|
23057
23059
|
// @api
|
|
23058
|
-
function createTypeQueryNode(exprName) {
|
|
23060
|
+
function createTypeQueryNode(exprName, typeArguments) {
|
|
23059
23061
|
var node = createBaseNode(180 /* TypeQuery */);
|
|
23060
23062
|
node.exprName = exprName;
|
|
23063
|
+
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
23061
23064
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
23062
23065
|
return node;
|
|
23063
23066
|
}
|
|
23064
23067
|
// @api
|
|
23065
|
-
function updateTypeQueryNode(node, exprName) {
|
|
23068
|
+
function updateTypeQueryNode(node, exprName, typeArguments) {
|
|
23066
23069
|
return node.exprName !== exprName
|
|
23067
|
-
|
|
23070
|
+
|| node.typeArguments !== typeArguments
|
|
23071
|
+
? update(createTypeQueryNode(exprName, typeArguments), node)
|
|
23068
23072
|
: node;
|
|
23069
23073
|
}
|
|
23070
23074
|
// @api
|
|
@@ -30188,7 +30192,8 @@ var ts;
|
|
|
30188
30192
|
visitNode(cbNode, node.parameterName) ||
|
|
30189
30193
|
visitNode(cbNode, node.type);
|
|
30190
30194
|
case 180 /* TypeQuery */:
|
|
30191
|
-
return visitNode(cbNode, node.exprName)
|
|
30195
|
+
return visitNode(cbNode, node.exprName) ||
|
|
30196
|
+
visitNodes(cbNode, cbNodes, node.typeArguments);
|
|
30192
30197
|
case 181 /* TypeLiteral */:
|
|
30193
30198
|
return visitNodes(cbNode, cbNodes, node.members);
|
|
30194
30199
|
case 182 /* ArrayType */:
|
|
@@ -32721,7 +32726,9 @@ var ts;
|
|
|
32721
32726
|
function parseTypeQuery() {
|
|
32722
32727
|
var pos = getNodePos();
|
|
32723
32728
|
parseExpected(112 /* TypeOfKeyword */);
|
|
32724
|
-
|
|
32729
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
32730
|
+
var typeArguments = tryParseTypeArguments();
|
|
32731
|
+
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
32725
32732
|
}
|
|
32726
32733
|
function parseTypeParameter() {
|
|
32727
32734
|
var pos = getNodePos();
|
|
@@ -34791,20 +34798,30 @@ var ts;
|
|
|
34791
34798
|
expression = parsePropertyAccessExpressionRest(pos, expression, questionDotToken);
|
|
34792
34799
|
continue;
|
|
34793
34800
|
}
|
|
34794
|
-
if (!questionDotToken && token() === 53 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
|
|
34795
|
-
nextToken();
|
|
34796
|
-
expression = finishNode(factory.createNonNullExpression(expression), pos);
|
|
34797
|
-
continue;
|
|
34798
|
-
}
|
|
34799
34801
|
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
|
|
34800
34802
|
if ((questionDotToken || !inDecoratorContext()) && parseOptional(22 /* OpenBracketToken */)) {
|
|
34801
34803
|
expression = parseElementAccessExpressionRest(pos, expression, questionDotToken);
|
|
34802
34804
|
continue;
|
|
34803
34805
|
}
|
|
34804
34806
|
if (isTemplateStartOfTaggedTemplate()) {
|
|
34805
|
-
|
|
34807
|
+
// Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments
|
|
34808
|
+
expression = !questionDotToken && expression.kind === 227 /* ExpressionWithTypeArguments */ ?
|
|
34809
|
+
parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) :
|
|
34810
|
+
parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined);
|
|
34806
34811
|
continue;
|
|
34807
34812
|
}
|
|
34813
|
+
if (!questionDotToken) {
|
|
34814
|
+
if (token() === 53 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
|
|
34815
|
+
nextToken();
|
|
34816
|
+
expression = finishNode(factory.createNonNullExpression(expression), pos);
|
|
34817
|
+
continue;
|
|
34818
|
+
}
|
|
34819
|
+
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34820
|
+
if (typeArguments) {
|
|
34821
|
+
expression = finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
34822
|
+
continue;
|
|
34823
|
+
}
|
|
34824
|
+
}
|
|
34808
34825
|
return expression;
|
|
34809
34826
|
}
|
|
34810
34827
|
}
|
|
@@ -34824,38 +34841,30 @@ var ts;
|
|
|
34824
34841
|
function parseCallExpressionRest(pos, expression) {
|
|
34825
34842
|
while (true) {
|
|
34826
34843
|
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
|
|
34844
|
+
var typeArguments = void 0;
|
|
34827
34845
|
var questionDotToken = parseOptionalToken(28 /* QuestionDotToken */);
|
|
34828
|
-
|
|
34829
|
-
|
|
34830
|
-
|
|
34831
|
-
|
|
34832
|
-
// keep checking for postfix expressions. Otherwise, it's just a '<' that's
|
|
34833
|
-
// part of an arithmetic expression. Break out so we consume it higher in the
|
|
34834
|
-
// stack.
|
|
34835
|
-
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34836
|
-
if (typeArguments) {
|
|
34837
|
-
if (isTemplateStartOfTaggedTemplate()) {
|
|
34838
|
-
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
|
|
34839
|
-
continue;
|
|
34840
|
-
}
|
|
34841
|
-
var argumentList = parseArgumentList();
|
|
34842
|
-
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34843
|
-
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
|
|
34844
|
-
factory.createCallExpression(expression, typeArguments, argumentList);
|
|
34845
|
-
expression = finishNode(callExpr, pos);
|
|
34846
|
+
if (questionDotToken) {
|
|
34847
|
+
typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34848
|
+
if (isTemplateStartOfTaggedTemplate()) {
|
|
34849
|
+
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
|
|
34846
34850
|
continue;
|
|
34847
34851
|
}
|
|
34848
34852
|
}
|
|
34849
|
-
|
|
34853
|
+
if (typeArguments || token() === 20 /* OpenParenToken */) {
|
|
34854
|
+
// Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments
|
|
34855
|
+
if (!questionDotToken && expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
34856
|
+
typeArguments = expression.typeArguments;
|
|
34857
|
+
expression = expression.expression;
|
|
34858
|
+
}
|
|
34850
34859
|
var argumentList = parseArgumentList();
|
|
34851
34860
|
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34852
|
-
factory.createCallChain(expression, questionDotToken,
|
|
34853
|
-
factory.createCallExpression(expression,
|
|
34861
|
+
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
|
|
34862
|
+
factory.createCallExpression(expression, typeArguments, argumentList);
|
|
34854
34863
|
expression = finishNode(callExpr, pos);
|
|
34855
34864
|
continue;
|
|
34856
34865
|
}
|
|
34857
34866
|
if (questionDotToken) {
|
|
34858
|
-
// We failed to parse anything, so report a missing identifier here.
|
|
34867
|
+
// We parsed `?.` but then failed to parse anything, so report a missing identifier here.
|
|
34859
34868
|
var name = createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.Identifier_expected);
|
|
34860
34869
|
expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos);
|
|
34861
34870
|
}
|
|
@@ -34883,21 +34892,25 @@ var ts;
|
|
|
34883
34892
|
// If it doesn't have the closing `>` then it's definitely not an type argument list.
|
|
34884
34893
|
return undefined;
|
|
34885
34894
|
}
|
|
34886
|
-
//
|
|
34887
|
-
//
|
|
34888
|
-
|
|
34889
|
-
|
|
34890
|
-
|
|
34895
|
+
// We successfully parsed a type argument list. The next token determines whether we want to
|
|
34896
|
+
// treat it as such. If the type argument list is followed by `(` or a template literal, as in
|
|
34897
|
+
// `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
|
|
34898
|
+
// it as a relational expression.
|
|
34899
|
+
return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined;
|
|
34891
34900
|
}
|
|
34892
34901
|
function canFollowTypeArgumentsInExpression() {
|
|
34893
34902
|
switch (token()) {
|
|
34903
|
+
// These tokens can follow a type argument list in a call expression.
|
|
34894
34904
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
34895
34905
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
34896
34906
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
34897
|
-
//
|
|
34898
|
-
//
|
|
34907
|
+
// These tokens can't follow in a call expression, nor can they start an
|
|
34908
|
+
// expression. So, consider the type argument list part of an instantiation
|
|
34909
|
+
// expression.
|
|
34899
34910
|
// falls through
|
|
34911
|
+
case 27 /* CommaToken */: // foo<x>,
|
|
34900
34912
|
case 24 /* DotToken */: // foo<x>.
|
|
34913
|
+
case 28 /* QuestionDotToken */: // foo<x>?.
|
|
34901
34914
|
case 21 /* CloseParenToken */: // foo<x>)
|
|
34902
34915
|
case 23 /* CloseBracketToken */: // foo<x>]
|
|
34903
34916
|
case 58 /* ColonToken */: // foo<x>:
|
|
@@ -34915,20 +34928,10 @@ var ts;
|
|
|
34915
34928
|
case 51 /* BarToken */: // foo<x> |
|
|
34916
34929
|
case 19 /* CloseBraceToken */: // foo<x> }
|
|
34917
34930
|
case 1 /* EndOfFileToken */: // foo<x>
|
|
34918
|
-
// these cases can't legally follow a type arg list. However, they're not legal
|
|
34919
|
-
// expressions either. The user is probably in the middle of a generic type. So
|
|
34920
|
-
// treat it as such.
|
|
34921
34931
|
return true;
|
|
34922
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
34923
|
-
case 18 /* OpenBraceToken */: // foo<x> {
|
|
34924
|
-
// We don't want to treat these as type arguments. Otherwise we'll parse this
|
|
34925
|
-
// as an invocation expression. Instead, we want to parse out the expression
|
|
34926
|
-
// in isolation from the type arguments.
|
|
34927
|
-
// falls through
|
|
34928
|
-
default:
|
|
34929
|
-
// Anything else treat as an expression.
|
|
34930
|
-
return false;
|
|
34931
34932
|
}
|
|
34933
|
+
// Treat anything else as an expression.
|
|
34934
|
+
return false;
|
|
34932
34935
|
}
|
|
34933
34936
|
function parsePrimaryExpression() {
|
|
34934
34937
|
switch (token()) {
|
|
@@ -35109,26 +35112,15 @@ var ts;
|
|
|
35109
35112
|
return finishNode(factory.createMetaProperty(103 /* NewKeyword */, name), pos);
|
|
35110
35113
|
}
|
|
35111
35114
|
var expressionPos = getNodePos();
|
|
35112
|
-
var expression = parsePrimaryExpression();
|
|
35115
|
+
var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false);
|
|
35113
35116
|
var typeArguments;
|
|
35114
|
-
|
|
35115
|
-
|
|
35116
|
-
typeArguments =
|
|
35117
|
-
|
|
35118
|
-
ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
|
|
35119
|
-
expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
|
|
35120
|
-
typeArguments = undefined;
|
|
35121
|
-
}
|
|
35122
|
-
break;
|
|
35123
|
-
}
|
|
35124
|
-
var argumentsArray;
|
|
35125
|
-
if (token() === 20 /* OpenParenToken */) {
|
|
35126
|
-
argumentsArray = parseArgumentList();
|
|
35127
|
-
}
|
|
35128
|
-
else if (typeArguments) {
|
|
35129
|
-
parseErrorAt(pos, scanner.getStartPos(), ts.Diagnostics.A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list);
|
|
35117
|
+
// Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments
|
|
35118
|
+
if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
35119
|
+
typeArguments = expression.typeArguments;
|
|
35120
|
+
expression = expression.expression;
|
|
35130
35121
|
}
|
|
35131
|
-
|
|
35122
|
+
var argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : undefined;
|
|
35123
|
+
return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos);
|
|
35132
35124
|
}
|
|
35133
35125
|
// STATEMENTS
|
|
35134
35126
|
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
|
|
@@ -36217,6 +36209,9 @@ var ts;
|
|
|
36217
36209
|
function parseExpressionWithTypeArguments() {
|
|
36218
36210
|
var pos = getNodePos();
|
|
36219
36211
|
var expression = parseLeftHandSideExpressionOrHigher();
|
|
36212
|
+
if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
36213
|
+
return expression;
|
|
36214
|
+
}
|
|
36220
36215
|
var typeArguments = tryParseTypeArguments();
|
|
36221
36216
|
return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
36222
36217
|
}
|
|
@@ -51225,7 +51220,7 @@ var ts;
|
|
|
51225
51220
|
// get symbol of the first identifier of the entityName
|
|
51226
51221
|
var meaning;
|
|
51227
51222
|
if (entityName.parent.kind === 180 /* TypeQuery */ ||
|
|
51228
|
-
ts.
|
|
51223
|
+
entityName.parent.kind === 227 /* ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) ||
|
|
51229
51224
|
entityName.parent.kind === 161 /* ComputedPropertyName */) {
|
|
51230
51225
|
// Typeof value
|
|
51231
51226
|
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
@@ -51336,7 +51331,7 @@ var ts;
|
|
|
51336
51331
|
return flags & 814775659 /* NodeBuilderFlagsMask */;
|
|
51337
51332
|
}
|
|
51338
51333
|
function isClassInstanceSide(type) {
|
|
51339
|
-
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) &
|
|
51334
|
+
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 33554432 /* IsClassInstanceClone */)));
|
|
51340
51335
|
}
|
|
51341
51336
|
function createNodeBuilder() {
|
|
51342
51337
|
return {
|
|
@@ -55265,7 +55260,7 @@ var ts;
|
|
|
55265
55260
|
members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
|
|
55266
55261
|
result.objectFlags |= (ts.getObjectFlags(type) & 8192 /* JSLiteral */); // Propagate JSLiteral flag
|
|
55267
55262
|
if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
|
|
55268
|
-
result.objectFlags |=
|
|
55263
|
+
result.objectFlags |= 33554432 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
|
|
55269
55264
|
}
|
|
55270
55265
|
return result;
|
|
55271
55266
|
}
|
|
@@ -57311,87 +57306,87 @@ var ts;
|
|
|
57311
57306
|
* Converts an AnonymousType to a ResolvedType.
|
|
57312
57307
|
*/
|
|
57313
57308
|
function resolveAnonymousTypeMembers(type) {
|
|
57314
|
-
var symbol = getMergedSymbol(type.symbol);
|
|
57315
57309
|
if (type.target) {
|
|
57316
57310
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57317
|
-
var
|
|
57311
|
+
var members_6 = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
|
|
57318
57312
|
var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper);
|
|
57319
57313
|
var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper);
|
|
57320
|
-
var
|
|
57321
|
-
setStructuredTypeMembers(type,
|
|
57314
|
+
var indexInfos_1 = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
|
|
57315
|
+
setStructuredTypeMembers(type, members_6, callSignatures, constructSignatures, indexInfos_1);
|
|
57316
|
+
return;
|
|
57322
57317
|
}
|
|
57323
|
-
|
|
57318
|
+
var symbol = getMergedSymbol(type.symbol);
|
|
57319
|
+
if (symbol.flags & 2048 /* TypeLiteral */) {
|
|
57324
57320
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57325
|
-
var
|
|
57326
|
-
var callSignatures = getSignaturesOfSymbol(
|
|
57327
|
-
var constructSignatures = getSignaturesOfSymbol(
|
|
57328
|
-
var
|
|
57329
|
-
setStructuredTypeMembers(type,
|
|
57321
|
+
var members_7 = getMembersOfSymbol(symbol);
|
|
57322
|
+
var callSignatures = getSignaturesOfSymbol(members_7.get("__call" /* Call */));
|
|
57323
|
+
var constructSignatures = getSignaturesOfSymbol(members_7.get("__new" /* New */));
|
|
57324
|
+
var indexInfos_2 = getIndexInfosOfSymbol(symbol);
|
|
57325
|
+
setStructuredTypeMembers(type, members_7, callSignatures, constructSignatures, indexInfos_2);
|
|
57326
|
+
return;
|
|
57330
57327
|
}
|
|
57331
|
-
|
|
57332
|
-
|
|
57333
|
-
|
|
57334
|
-
|
|
57335
|
-
|
|
57336
|
-
|
|
57337
|
-
|
|
57338
|
-
|
|
57339
|
-
|
|
57340
|
-
|
|
57341
|
-
|
|
57342
|
-
|
|
57343
|
-
|
|
57344
|
-
members = varsOnly_1;
|
|
57345
|
-
}
|
|
57328
|
+
// Combinations of function, class, enum and module
|
|
57329
|
+
var members = emptySymbols;
|
|
57330
|
+
var indexInfos;
|
|
57331
|
+
if (symbol.exports) {
|
|
57332
|
+
members = getExportsOfSymbol(symbol);
|
|
57333
|
+
if (symbol === globalThisSymbol) {
|
|
57334
|
+
var varsOnly_1 = new ts.Map();
|
|
57335
|
+
members.forEach(function (p) {
|
|
57336
|
+
if (!(p.flags & 418 /* BlockScoped */)) {
|
|
57337
|
+
varsOnly_1.set(p.escapedName, p);
|
|
57338
|
+
}
|
|
57339
|
+
});
|
|
57340
|
+
members = varsOnly_1;
|
|
57346
57341
|
}
|
|
57347
|
-
|
|
57348
|
-
|
|
57349
|
-
|
|
57350
|
-
|
|
57351
|
-
|
|
57352
|
-
|
|
57353
|
-
|
|
57354
|
-
|
|
57355
|
-
|
|
57356
|
-
else if (baseConstructorType === anyType) {
|
|
57357
|
-
baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
|
|
57358
|
-
}
|
|
57342
|
+
}
|
|
57343
|
+
var baseConstructorIndexInfo;
|
|
57344
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57345
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57346
|
+
var classType = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57347
|
+
var baseConstructorType = getBaseConstructorTypeOfClass(classType);
|
|
57348
|
+
if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
|
|
57349
|
+
members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
|
|
57350
|
+
addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
|
|
57359
57351
|
}
|
|
57360
|
-
|
|
57361
|
-
|
|
57362
|
-
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57352
|
+
else if (baseConstructorType === anyType) {
|
|
57353
|
+
baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
|
|
57363
57354
|
}
|
|
57364
|
-
|
|
57365
|
-
|
|
57366
|
-
|
|
57367
|
-
|
|
57368
|
-
|
|
57369
|
-
|
|
57370
|
-
|
|
57371
|
-
|
|
57355
|
+
}
|
|
57356
|
+
var indexSymbol = getIndexSymbolFromSymbolTable(members);
|
|
57357
|
+
if (indexSymbol) {
|
|
57358
|
+
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57359
|
+
}
|
|
57360
|
+
else {
|
|
57361
|
+
if (baseConstructorIndexInfo) {
|
|
57362
|
+
indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
|
|
57372
57363
|
}
|
|
57373
|
-
|
|
57374
|
-
|
|
57375
|
-
|
|
57376
|
-
// in the process of resolving (see issue #6072). The temporarily empty signature list
|
|
57377
|
-
// will never be observed because a qualified name can't reference signatures.
|
|
57378
|
-
if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
|
|
57379
|
-
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57364
|
+
if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
|
|
57365
|
+
ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
|
|
57366
|
+
indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
|
|
57380
57367
|
}
|
|
57381
|
-
|
|
57382
|
-
|
|
57383
|
-
|
|
57384
|
-
|
|
57385
|
-
|
|
57386
|
-
|
|
57387
|
-
|
|
57388
|
-
|
|
57389
|
-
|
|
57390
|
-
|
|
57391
|
-
|
|
57392
|
-
|
|
57393
|
-
|
|
57368
|
+
}
|
|
57369
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
|
|
57370
|
+
// We resolve the members before computing the signatures because a signature may use
|
|
57371
|
+
// typeof with a qualified name expression that circularly references the type we are
|
|
57372
|
+
// in the process of resolving (see issue #6072). The temporarily empty signature list
|
|
57373
|
+
// will never be observed because a qualified name can't reference signatures.
|
|
57374
|
+
if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
|
|
57375
|
+
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57376
|
+
}
|
|
57377
|
+
// And likewise for construct signatures for classes
|
|
57378
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57379
|
+
var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57380
|
+
var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
|
|
57381
|
+
if (symbol.flags & 16 /* Function */) {
|
|
57382
|
+
constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
|
|
57383
|
+
createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
|
|
57384
|
+
undefined; }));
|
|
57385
|
+
}
|
|
57386
|
+
if (!constructSignatures.length) {
|
|
57387
|
+
constructSignatures = getDefaultConstructSignatures(classType_1);
|
|
57394
57388
|
}
|
|
57389
|
+
type.constructSignatures = constructSignatures;
|
|
57395
57390
|
}
|
|
57396
57391
|
}
|
|
57397
57392
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
@@ -58392,8 +58387,8 @@ var ts;
|
|
|
58392
58387
|
var stringIndexInfo;
|
|
58393
58388
|
var applicableInfo;
|
|
58394
58389
|
var applicableInfos;
|
|
58395
|
-
for (var _i = 0,
|
|
58396
|
-
var info =
|
|
58390
|
+
for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
|
|
58391
|
+
var info = indexInfos_3[_i];
|
|
58397
58392
|
if (info.keyType === stringType) {
|
|
58398
58393
|
stringIndexInfo = info;
|
|
58399
58394
|
}
|
|
@@ -58966,14 +58961,14 @@ var ts;
|
|
|
58966
58961
|
}
|
|
58967
58962
|
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
58968
58963
|
if (indexSymbol.declarations) {
|
|
58969
|
-
var
|
|
58964
|
+
var indexInfos_4 = [];
|
|
58970
58965
|
var _loop_14 = function (declaration) {
|
|
58971
58966
|
if (declaration.parameters.length === 1) {
|
|
58972
58967
|
var parameter = declaration.parameters[0];
|
|
58973
58968
|
if (parameter.type) {
|
|
58974
58969
|
forEachType(getTypeFromTypeNode(parameter.type), function (keyType) {
|
|
58975
|
-
if (isValidIndexKeyType(keyType) && !findIndexInfo(
|
|
58976
|
-
|
|
58970
|
+
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_4, keyType)) {
|
|
58971
|
+
indexInfos_4.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
|
|
58977
58972
|
}
|
|
58978
58973
|
});
|
|
58979
58974
|
}
|
|
@@ -58983,7 +58978,7 @@ var ts;
|
|
|
58983
58978
|
var declaration = _a[_i];
|
|
58984
58979
|
_loop_14(declaration);
|
|
58985
58980
|
}
|
|
58986
|
-
return
|
|
58981
|
+
return indexInfos_4;
|
|
58987
58982
|
}
|
|
58988
58983
|
return ts.emptyArray;
|
|
58989
58984
|
}
|
|
@@ -59531,7 +59526,7 @@ var ts;
|
|
|
59531
59526
|
// The expression is processed as an identifier expression (section 4.3)
|
|
59532
59527
|
// or property access expression(section 4.10),
|
|
59533
59528
|
// the widened type(section 3.9) of which becomes the result.
|
|
59534
|
-
var type =
|
|
59529
|
+
var type = checkExpressionWithTypeArguments(node);
|
|
59535
59530
|
links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type));
|
|
59536
59531
|
}
|
|
59537
59532
|
return links.resolvedType;
|
|
@@ -62235,7 +62230,9 @@ var ts;
|
|
|
62235
62230
|
return result;
|
|
62236
62231
|
}
|
|
62237
62232
|
function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
62238
|
-
var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
|
|
62233
|
+
var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
|
|
62234
|
+
type.objectFlags & 16777216 /* InstantiationExpressionType */ ? type.node :
|
|
62235
|
+
type.symbol.declarations[0];
|
|
62239
62236
|
var links = getNodeLinks(declaration);
|
|
62240
62237
|
var target = type.objectFlags & 4 /* Reference */ ? links.resolvedType :
|
|
62241
62238
|
type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
@@ -62251,8 +62248,8 @@ var ts;
|
|
|
62251
62248
|
outerTypeParameters = ts.addRange(outerTypeParameters, templateTagParameters);
|
|
62252
62249
|
}
|
|
62253
62250
|
typeParameters = outerTypeParameters || ts.emptyArray;
|
|
62254
|
-
var allDeclarations_1 = type.objectFlags & 4 /* Reference */ ? [declaration] : type.symbol.declarations;
|
|
62255
|
-
typeParameters = (target.objectFlags & 4 /* Reference */ || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
|
|
62251
|
+
var allDeclarations_1 = type.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) ? [declaration] : type.symbol.declarations;
|
|
62252
|
+
typeParameters = (target.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
|
|
62256
62253
|
ts.filter(typeParameters, function (tp) { return ts.some(allDeclarations_1, function (d) { return isTypeParameterPossiblyReferenced(tp, d); }); }) :
|
|
62257
62254
|
typeParameters;
|
|
62258
62255
|
links.outerTypeParameters = typeParameters;
|
|
@@ -62424,6 +62421,9 @@ var ts;
|
|
|
62424
62421
|
mapper = combineTypeMappers(makeUnaryTypeMapper(origTypeParameter, freshTypeParameter), mapper);
|
|
62425
62422
|
freshTypeParameter.mapper = mapper;
|
|
62426
62423
|
}
|
|
62424
|
+
if (type.objectFlags & 16777216 /* InstantiationExpressionType */) {
|
|
62425
|
+
result.node = type.node;
|
|
62426
|
+
}
|
|
62427
62427
|
result.target = type;
|
|
62428
62428
|
result.mapper = mapper;
|
|
62429
62429
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -65617,8 +65617,8 @@ var ts;
|
|
|
65617
65617
|
var indexInfos = getIndexInfosOfType(target);
|
|
65618
65618
|
var targetHasStringIndex = ts.some(indexInfos, function (info) { return info.keyType === stringType; });
|
|
65619
65619
|
var result = -1 /* True */;
|
|
65620
|
-
for (var _i = 0,
|
|
65621
|
-
var targetInfo =
|
|
65620
|
+
for (var _i = 0, indexInfos_5 = indexInfos; _i < indexInfos_5.length; _i++) {
|
|
65621
|
+
var targetInfo = indexInfos_5[_i];
|
|
65622
65622
|
var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ :
|
|
65623
65623
|
isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, 3 /* Both */, reportErrors) :
|
|
65624
65624
|
typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState);
|
|
@@ -66225,10 +66225,10 @@ var ts;
|
|
|
66225
66225
|
if (!(ts.getObjectFlags(type) & 4 /* Reference */) || !(ts.getObjectFlags(type.target) & 3 /* ClassOrInterface */)) {
|
|
66226
66226
|
return undefined;
|
|
66227
66227
|
}
|
|
66228
|
-
if (ts.getObjectFlags(type) &
|
|
66229
|
-
return ts.getObjectFlags(type) &
|
|
66228
|
+
if (ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeCalculated */) {
|
|
66229
|
+
return ts.getObjectFlags(type) & 134217728 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
|
|
66230
66230
|
}
|
|
66231
|
-
type.objectFlags |=
|
|
66231
|
+
type.objectFlags |= 67108864 /* IdenticalBaseTypeCalculated */;
|
|
66232
66232
|
var target = type.target;
|
|
66233
66233
|
if (ts.getObjectFlags(target) & 1 /* Class */) {
|
|
66234
66234
|
var baseTypeNode = getBaseTypeNodeOfClass(target);
|
|
@@ -66249,7 +66249,7 @@ var ts;
|
|
|
66249
66249
|
if (ts.length(getTypeArguments(type)) > ts.length(target.typeParameters)) {
|
|
66250
66250
|
instantiatedBase = getTypeWithThisArgument(instantiatedBase, ts.last(getTypeArguments(type)));
|
|
66251
66251
|
}
|
|
66252
|
-
type.objectFlags |=
|
|
66252
|
+
type.objectFlags |= 134217728 /* IdenticalBaseTypeExists */;
|
|
66253
66253
|
return type.cachedEquivalentBaseType = instantiatedBase;
|
|
66254
66254
|
}
|
|
66255
66255
|
function isEmptyLiteralType(type) {
|
|
@@ -66913,7 +66913,7 @@ var ts;
|
|
|
66913
66913
|
var result = !!(type.flags & 465829888 /* Instantiable */ ||
|
|
66914
66914
|
type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || ts.forEach(getTypeArguments(type), couldContainTypeVariables)) ||
|
|
66915
66915
|
objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
|
|
66916
|
-
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */)) ||
|
|
66916
|
+
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */ | 16777216 /* InstantiationExpressionType */)) ||
|
|
66917
66917
|
type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && ts.some(type.types, couldContainTypeVariables));
|
|
66918
66918
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
66919
66919
|
type.objectFlags |= 1048576 /* CouldContainTypeVariablesComputed */ | (result ? 2097152 /* CouldContainTypeVariables */ : 0);
|
|
@@ -67830,8 +67830,8 @@ var ts;
|
|
|
67830
67830
|
var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* Mapped */) ? 8 /* HomomorphicMappedType */ : 0;
|
|
67831
67831
|
var indexInfos = getIndexInfosOfType(target);
|
|
67832
67832
|
if (isObjectTypeWithInferableIndex(source)) {
|
|
67833
|
-
for (var _i = 0,
|
|
67834
|
-
var targetInfo =
|
|
67833
|
+
for (var _i = 0, indexInfos_6 = indexInfos; _i < indexInfos_6.length; _i++) {
|
|
67834
|
+
var targetInfo = indexInfos_6[_i];
|
|
67835
67835
|
var propTypes = [];
|
|
67836
67836
|
for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
|
|
67837
67837
|
var prop = _b[_a];
|
|
@@ -67851,8 +67851,8 @@ var ts;
|
|
|
67851
67851
|
}
|
|
67852
67852
|
}
|
|
67853
67853
|
}
|
|
67854
|
-
for (var _e = 0,
|
|
67855
|
-
var targetInfo =
|
|
67854
|
+
for (var _e = 0, indexInfos_7 = indexInfos; _e < indexInfos_7.length; _e++) {
|
|
67855
|
+
var targetInfo = indexInfos_7[_e];
|
|
67856
67856
|
var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType);
|
|
67857
67857
|
if (sourceInfo) {
|
|
67858
67858
|
inferWithPriority(sourceInfo.type, targetInfo.type, priority);
|
|
@@ -76016,6 +76016,72 @@ var ts;
|
|
|
76016
76016
|
return node.flags & 32 /* OptionalChain */ ? checkNonNullChain(node) :
|
|
76017
76017
|
getNonNullableType(checkExpression(node.expression));
|
|
76018
76018
|
}
|
|
76019
|
+
function checkExpressionWithTypeArguments(node) {
|
|
76020
|
+
checkGrammarExpressionWithTypeArguments(node);
|
|
76021
|
+
var exprType = node.kind === 227 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) :
|
|
76022
|
+
ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) :
|
|
76023
|
+
checkExpression(node.exprName);
|
|
76024
|
+
var typeArguments = node.typeArguments;
|
|
76025
|
+
if (exprType === silentNeverType || isErrorType(exprType) || !ts.some(typeArguments)) {
|
|
76026
|
+
return exprType;
|
|
76027
|
+
}
|
|
76028
|
+
var hasSomeApplicableSignature = false;
|
|
76029
|
+
var nonApplicableType;
|
|
76030
|
+
var result = getInstantiatedType(exprType);
|
|
76031
|
+
var errorType = hasSomeApplicableSignature ? nonApplicableType : exprType;
|
|
76032
|
+
if (errorType) {
|
|
76033
|
+
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)));
|
|
76034
|
+
}
|
|
76035
|
+
return result;
|
|
76036
|
+
function getInstantiatedType(type) {
|
|
76037
|
+
var hasSignatures = false;
|
|
76038
|
+
var hasApplicableSignature = false;
|
|
76039
|
+
var result = getInstantiatedTypePart(type);
|
|
76040
|
+
hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
|
|
76041
|
+
if (hasSignatures && !hasApplicableSignature) {
|
|
76042
|
+
nonApplicableType !== null && nonApplicableType !== void 0 ? nonApplicableType : (nonApplicableType = type);
|
|
76043
|
+
}
|
|
76044
|
+
return result;
|
|
76045
|
+
function getInstantiatedTypePart(type) {
|
|
76046
|
+
if (type.flags & 524288 /* Object */) {
|
|
76047
|
+
var resolved = resolveStructuredTypeMembers(type);
|
|
76048
|
+
var callSignatures = getInstantiatedSignatures(resolved.callSignatures);
|
|
76049
|
+
var constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
|
|
76050
|
+
hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
|
|
76051
|
+
hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
|
|
76052
|
+
if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
|
|
76053
|
+
var result_11 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
|
|
76054
|
+
result_11.objectFlags |= 16777216 /* InstantiationExpressionType */;
|
|
76055
|
+
result_11.node = node;
|
|
76056
|
+
return result_11;
|
|
76057
|
+
}
|
|
76058
|
+
}
|
|
76059
|
+
else if (type.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
76060
|
+
var constraint = getBaseConstraintOfType(type);
|
|
76061
|
+
if (constraint) {
|
|
76062
|
+
var instantiated = getInstantiatedTypePart(constraint);
|
|
76063
|
+
if (instantiated !== constraint) {
|
|
76064
|
+
return instantiated;
|
|
76065
|
+
}
|
|
76066
|
+
}
|
|
76067
|
+
}
|
|
76068
|
+
else if (type.flags & 1048576 /* Union */) {
|
|
76069
|
+
return mapType(type, getInstantiatedType);
|
|
76070
|
+
}
|
|
76071
|
+
else if (type.flags & 2097152 /* Intersection */) {
|
|
76072
|
+
return getIntersectionType(ts.sameMap(type.types, getInstantiatedTypePart));
|
|
76073
|
+
}
|
|
76074
|
+
return type;
|
|
76075
|
+
}
|
|
76076
|
+
}
|
|
76077
|
+
function getInstantiatedSignatures(signatures) {
|
|
76078
|
+
var applicableSignatures = ts.filter(signatures, function (sig) { return !!sig.typeParameters && hasCorrectTypeArgumentArity(sig, typeArguments); });
|
|
76079
|
+
return ts.sameMap(applicableSignatures, function (sig) {
|
|
76080
|
+
var typeArgumentTypes = checkTypeArguments(sig, typeArguments, /*reportErrors*/ true);
|
|
76081
|
+
return typeArgumentTypes ? getSignatureInstantiation(sig, typeArgumentTypes, ts.isInJSFile(sig.declaration)) : sig;
|
|
76082
|
+
});
|
|
76083
|
+
}
|
|
76084
|
+
}
|
|
76019
76085
|
function checkMetaProperty(node) {
|
|
76020
76086
|
checkGrammarMetaProperty(node);
|
|
76021
76087
|
if (node.keywordToken === 103 /* NewKeyword */) {
|
|
@@ -78532,6 +78598,8 @@ var ts;
|
|
|
78532
78598
|
return checkAssertion(node);
|
|
78533
78599
|
case 229 /* NonNullExpression */:
|
|
78534
78600
|
return checkNonNullAssertion(node);
|
|
78601
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
78602
|
+
return checkExpressionWithTypeArguments(node);
|
|
78535
78603
|
case 230 /* MetaProperty */:
|
|
78536
78604
|
return checkMetaProperty(node);
|
|
78537
78605
|
case 214 /* DeleteExpression */:
|
|
@@ -79735,12 +79803,12 @@ var ts;
|
|
|
79735
79803
|
case 264 /* ImportEqualsDeclaration */:
|
|
79736
79804
|
case 267 /* NamespaceImport */:
|
|
79737
79805
|
case 266 /* ImportClause */:
|
|
79738
|
-
var
|
|
79806
|
+
var result_12 = 0 /* None */;
|
|
79739
79807
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
79740
79808
|
ts.forEach(target.declarations, function (d) {
|
|
79741
|
-
|
|
79809
|
+
result_12 |= getDeclarationSpaces(d);
|
|
79742
79810
|
});
|
|
79743
|
-
return
|
|
79811
|
+
return result_12;
|
|
79744
79812
|
case 253 /* VariableDeclaration */:
|
|
79745
79813
|
case 202 /* BindingElement */:
|
|
79746
79814
|
case 255 /* FunctionDeclaration */:
|
|
@@ -82299,8 +82367,8 @@ var ts;
|
|
|
82299
82367
|
}
|
|
82300
82368
|
}
|
|
82301
82369
|
if (indexInfos.length > 1) {
|
|
82302
|
-
for (var _d = 0,
|
|
82303
|
-
var info =
|
|
82370
|
+
for (var _d = 0, indexInfos_8 = indexInfos; _d < indexInfos_8.length; _d++) {
|
|
82371
|
+
var info = indexInfos_8[_d];
|
|
82304
82372
|
checkIndexConstraintForIndexSignature(type, info);
|
|
82305
82373
|
}
|
|
82306
82374
|
}
|
|
@@ -82326,8 +82394,8 @@ var ts;
|
|
|
82326
82394
|
error(errorNode, ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
|
|
82327
82395
|
}
|
|
82328
82396
|
};
|
|
82329
|
-
for (var _i = 0,
|
|
82330
|
-
var info =
|
|
82397
|
+
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
82398
|
+
var info = indexInfos_9[_i];
|
|
82331
82399
|
_loop_27(info);
|
|
82332
82400
|
}
|
|
82333
82401
|
}
|
|
@@ -82349,8 +82417,8 @@ var ts;
|
|
|
82349
82417
|
error(errorNode, ts.Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3, typeToString(checkInfo.keyType), typeToString(checkInfo.type), typeToString(info.keyType), typeToString(info.type));
|
|
82350
82418
|
}
|
|
82351
82419
|
};
|
|
82352
|
-
for (var _i = 0,
|
|
82353
|
-
var info =
|
|
82420
|
+
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
82421
|
+
var info = indexInfos_10[_i];
|
|
82354
82422
|
_loop_28(info);
|
|
82355
82423
|
}
|
|
82356
82424
|
}
|
|
@@ -87983,7 +88051,7 @@ var ts;
|
|
|
87983
88051
|
return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
|
|
87984
88052
|
case 180 /* TypeQuery */:
|
|
87985
88053
|
ts.Debug.type(node);
|
|
87986
|
-
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName));
|
|
88054
|
+
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
|
|
87987
88055
|
case 181 /* TypeLiteral */:
|
|
87988
88056
|
ts.Debug.type(node);
|
|
87989
88057
|
return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
|
|
@@ -90875,8 +90943,8 @@ var ts;
|
|
|
90875
90943
|
function generateClassElementDecorationExpressions(node, isStatic) {
|
|
90876
90944
|
var members = getDecoratedClassElements(node, isStatic);
|
|
90877
90945
|
var expressions;
|
|
90878
|
-
for (var _i = 0,
|
|
90879
|
-
var member =
|
|
90946
|
+
for (var _i = 0, members_8 = members; _i < members_8.length; _i++) {
|
|
90947
|
+
var member = members_8[_i];
|
|
90880
90948
|
var expression = generateClassElementDecorationExpression(node, member);
|
|
90881
90949
|
if (expression) {
|
|
90882
90950
|
if (!expressions) {
|
|
@@ -96221,8 +96289,8 @@ var ts;
|
|
|
96221
96289
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
96222
96290
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
96223
96291
|
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
96224
|
-
var
|
|
96225
|
-
return
|
|
96292
|
+
var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
96293
|
+
return result_13 && factory.createPropertyAssignment("children", result_13);
|
|
96226
96294
|
}
|
|
96227
96295
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
96228
96296
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -109860,6 +109928,8 @@ var ts;
|
|
|
109860
109928
|
return emitAsExpression(node);
|
|
109861
109929
|
case 229 /* NonNullExpression */:
|
|
109862
109930
|
return emitNonNullExpression(node);
|
|
109931
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
109932
|
+
return emitExpressionWithTypeArguments(node);
|
|
109863
109933
|
case 230 /* MetaProperty */:
|
|
109864
109934
|
return emitMetaProperty(node);
|
|
109865
109935
|
case 231 /* SyntheticExpression */:
|
|
@@ -110304,6 +110374,7 @@ var ts;
|
|
|
110304
110374
|
writeKeyword("typeof");
|
|
110305
110375
|
writeSpace();
|
|
110306
110376
|
emit(node.exprName);
|
|
110377
|
+
emitTypeArguments(node, node.typeArguments);
|
|
110307
110378
|
}
|
|
110308
110379
|
function emitTypeLiteral(node) {
|
|
110309
110380
|
writePunctuation("{");
|
|
@@ -115277,15 +115348,15 @@ var ts;
|
|
|
115277
115348
|
// which per above occurred during the current program creation.
|
|
115278
115349
|
// Since we assume the filesystem does not change during program creation,
|
|
115279
115350
|
// it is safe to reuse resolutions from the earlier call.
|
|
115280
|
-
var
|
|
115351
|
+
var result_14 = [];
|
|
115281
115352
|
var i = 0;
|
|
115282
115353
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
115283
115354
|
var moduleName = moduleNames_1[_i];
|
|
115284
115355
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
115285
115356
|
i++;
|
|
115286
|
-
|
|
115357
|
+
result_14.push(resolvedModule);
|
|
115287
115358
|
}
|
|
115288
|
-
return
|
|
115359
|
+
return result_14;
|
|
115289
115360
|
}
|
|
115290
115361
|
// At this point, we know at least one of the following hold:
|
|
115291
115362
|
// - file has local declarations for ambient modules
|
|
@@ -120403,9 +120474,9 @@ var ts;
|
|
|
120403
120474
|
if (!preferSymlinks) {
|
|
120404
120475
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
120405
120476
|
// so we only need to remove them from the realpath filenames.
|
|
120406
|
-
var
|
|
120407
|
-
if (
|
|
120408
|
-
return
|
|
120477
|
+
var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
120478
|
+
if (result_15)
|
|
120479
|
+
return result_15;
|
|
120409
120480
|
}
|
|
120410
120481
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
120411
120482
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -120425,10 +120496,10 @@ var ts;
|
|
|
120425
120496
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
120426
120497
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
120427
120498
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
120428
|
-
var
|
|
120499
|
+
var result_16 = cb(option, target === referenceRedirect);
|
|
120429
120500
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
120430
|
-
if (
|
|
120431
|
-
return
|
|
120501
|
+
if (result_16)
|
|
120502
|
+
return result_16;
|
|
120432
120503
|
}
|
|
120433
120504
|
});
|
|
120434
120505
|
});
|
|
@@ -124686,7 +124757,7 @@ var ts;
|
|
|
124686
124757
|
case 199 /* ImportType */:
|
|
124687
124758
|
return !node.parent.isTypeOf;
|
|
124688
124759
|
case 227 /* ExpressionWithTypeArguments */:
|
|
124689
|
-
return
|
|
124760
|
+
return ts.isPartOfTypeNode(node.parent);
|
|
124690
124761
|
}
|
|
124691
124762
|
return false;
|
|
124692
124763
|
}
|
|
@@ -157629,7 +157700,7 @@ var ts;
|
|
|
157629
157700
|
// cannot find either start or end node
|
|
157630
157701
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
|
|
157631
157702
|
}
|
|
157632
|
-
if (
|
|
157703
|
+
if (start.flags & 4194304 /* JSDoc */) {
|
|
157633
157704
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractJSDoc)] };
|
|
157634
157705
|
}
|
|
157635
157706
|
if (start.parent !== end.parent) {
|