@typescript-deploys/pr-build 4.7.0-pr-47904-2 → 4.7.0-pr-48080-12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cs/diagnosticMessages.generated.json +6 -2
- package/lib/de/diagnosticMessages.generated.json +6 -2
- package/lib/es/diagnosticMessages.generated.json +6 -2
- package/lib/fr/diagnosticMessages.generated.json +6 -2
- package/lib/it/diagnosticMessages.generated.json +6 -2
- package/lib/ja/diagnosticMessages.generated.json +6 -2
- package/lib/ko/diagnosticMessages.generated.json +6 -2
- package/lib/lib.es2015.core.d.ts +3 -3
- package/lib/lib.es2020.bigint.d.ts +3 -1
- package/lib/lib.es2020.d.ts +2 -0
- package/lib/lib.es2020.date.d.ts +44 -0
- package/lib/lib.es2020.intl.d.ts +11 -0
- package/lib/lib.es2020.number.d.ts +30 -0
- package/lib/lib.es2021.intl.d.ts +6 -6
- package/lib/lib.es5.d.ts +3 -1
- package/lib/lib.esnext.intl.d.ts +4 -4
- package/lib/pl/diagnosticMessages.generated.json +6 -2
- package/lib/pt-br/diagnosticMessages.generated.json +6 -2
- package/lib/ru/diagnosticMessages.generated.json +6 -2
- package/lib/tr/diagnosticMessages.generated.json +6 -2
- package/lib/tsc.js +425 -296
- package/lib/tsserver.js +577 -372
- package/lib/tsserverlibrary.d.ts +13 -7
- package/lib/tsserverlibrary.js +571 -367
- package/lib/typescript.d.ts +13 -7
- package/lib/typescript.js +571 -367
- package/lib/typescriptServices.d.ts +13 -7
- package/lib/typescriptServices.js +571 -367
- package/lib/typingsInstaller.js +474 -337
- package/lib/zh-cn/diagnosticMessages.generated.json +6 -2
- package/lib/zh-tw/diagnosticMessages.generated.json +6 -2
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220302";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -2423,7 +2423,7 @@ var ts;
|
|
|
2423
2423
|
Debug.checkEachDefined = checkEachDefined;
|
|
2424
2424
|
function assertNever(member, message, stackCrawlMark) {
|
|
2425
2425
|
if (message === void 0) { message = "Illegal value:"; }
|
|
2426
|
-
var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos")
|
|
2426
|
+
var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
|
|
2427
2427
|
return fail(message + " " + detail, stackCrawlMark || assertNever);
|
|
2428
2428
|
}
|
|
2429
2429
|
Debug.assertNever = assertNever;
|
|
@@ -4920,13 +4920,14 @@ var ts;
|
|
|
4920
4920
|
// Flags that require TypeFlags.Object
|
|
4921
4921
|
ObjectFlags[ObjectFlags["ContainsSpread"] = 4194304] = "ContainsSpread";
|
|
4922
4922
|
ObjectFlags[ObjectFlags["ObjectRestType"] = 8388608] = "ObjectRestType";
|
|
4923
|
+
ObjectFlags[ObjectFlags["InstantiationExpressionType"] = 16777216] = "InstantiationExpressionType";
|
|
4923
4924
|
/* @internal */
|
|
4924
|
-
ObjectFlags[ObjectFlags["IsClassInstanceClone"] =
|
|
4925
|
+
ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 33554432] = "IsClassInstanceClone";
|
|
4925
4926
|
// Flags that require TypeFlags.Object and ObjectFlags.Reference
|
|
4926
4927
|
/* @internal */
|
|
4927
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] =
|
|
4928
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 67108864] = "IdenticalBaseTypeCalculated";
|
|
4928
4929
|
/* @internal */
|
|
4929
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] =
|
|
4930
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 134217728] = "IdenticalBaseTypeExists";
|
|
4930
4931
|
// Flags that require TypeFlags.UnionOrIntersection or TypeFlags.Substitution
|
|
4931
4932
|
/* @internal */
|
|
4932
4933
|
ObjectFlags[ObjectFlags["IsGenericTypeComputed"] = 4194304] = "IsGenericTypeComputed";
|
|
@@ -8144,7 +8145,6 @@ var ts;
|
|
|
8144
8145
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
8145
8146
|
Unexpected_token_Did_you_mean_or_gt: diag(1382, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_gt_1382", "Unexpected token. Did you mean `{'>'}` or `>`?"),
|
|
8146
8147
|
Only_named_exports_may_use_export_type: diag(1383, ts.DiagnosticCategory.Error, "Only_named_exports_may_use_export_type_1383", "Only named exports may use 'export type'."),
|
|
8147
|
-
A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list: diag(1384, ts.DiagnosticCategory.Error, "A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list_1384", "A 'new' expression with type arguments must always be followed by a parenthesized argument list."),
|
|
8148
8148
|
Function_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1385, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385", "Function type notation must be parenthesized when used in a union type."),
|
|
8149
8149
|
Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1386, ts.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386", "Constructor type notation must be parenthesized when used in a union type."),
|
|
8150
8150
|
Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
|
|
@@ -8530,6 +8530,7 @@ var ts;
|
|
|
8530
8530
|
Cannot_assign_to_0_because_it_is_an_import: diag(2632, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_an_import_2632", "Cannot assign to '{0}' because it is an import."),
|
|
8531
8531
|
JSX_property_access_expressions_cannot_include_JSX_namespace_names: diag(2633, ts.DiagnosticCategory.Error, "JSX_property_access_expressions_cannot_include_JSX_namespace_names_2633", "JSX property access expressions cannot include JSX namespace names"),
|
|
8532
8532
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8533
|
+
Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
|
|
8533
8534
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
|
|
8534
8535
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
|
|
8535
8536
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
|
|
@@ -9575,7 +9576,7 @@ var ts;
|
|
|
9575
9576
|
Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"),
|
|
9576
9577
|
Wrap_invalid_character_in_an_expression_container: diag(95108, ts.DiagnosticCategory.Message, "Wrap_invalid_character_in_an_expression_container_95108", "Wrap invalid character in an expression container"),
|
|
9577
9578
|
Wrap_all_invalid_characters_in_an_expression_container: diag(95109, ts.DiagnosticCategory.Message, "Wrap_all_invalid_characters_in_an_expression_container_95109", "Wrap all invalid characters in an expression container"),
|
|
9578
|
-
|
|
9579
|
+
Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file: diag(95110, ts.DiagnosticCategory.Message, "Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file_95110", "Visit https://aka.ms/tsconfig to read more about this file"),
|
|
9579
9580
|
Add_a_return_statement: diag(95111, ts.DiagnosticCategory.Message, "Add_a_return_statement_95111", "Add a return statement"),
|
|
9580
9581
|
Remove_braces_from_arrow_function_body: diag(95112, ts.DiagnosticCategory.Message, "Remove_braces_from_arrow_function_body_95112", "Remove braces from arrow function body"),
|
|
9581
9582
|
Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal: diag(95113, ts.DiagnosticCategory.Message, "Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal_95113", "Wrap the following body with parentheses which should be an object literal"),
|
|
@@ -13421,6 +13422,7 @@ var ts;
|
|
|
13421
13422
|
case 110 /* TrueKeyword */:
|
|
13422
13423
|
case 106 /* SuperKeyword */:
|
|
13423
13424
|
case 229 /* NonNullExpression */:
|
|
13425
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
13424
13426
|
case 230 /* MetaProperty */:
|
|
13425
13427
|
case 100 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
|
|
13426
13428
|
return true;
|
|
@@ -15134,7 +15136,7 @@ var ts;
|
|
|
15134
15136
|
case 114 /* VoidKeyword */:
|
|
15135
15137
|
return node.parent.kind !== 216 /* VoidExpression */;
|
|
15136
15138
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15137
|
-
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
|
15139
|
+
return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
|
15138
15140
|
case 162 /* TypeParameter */:
|
|
15139
15141
|
return node.parent.kind === 194 /* MappedType */ || node.parent.kind === 189 /* InferType */;
|
|
15140
15142
|
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
|
@@ -15171,7 +15173,7 @@ var ts;
|
|
|
15171
15173
|
}
|
|
15172
15174
|
switch (parent.kind) {
|
|
15173
15175
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15174
|
-
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15176
|
+
return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15175
15177
|
case 162 /* TypeParameter */:
|
|
15176
15178
|
return node === parent.constraint;
|
|
15177
15179
|
case 342 /* JSDocTemplateTag */:
|
|
@@ -15874,7 +15876,7 @@ var ts;
|
|
|
15874
15876
|
case 296 /* SpreadAssignment */:
|
|
15875
15877
|
return true;
|
|
15876
15878
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15877
|
-
return parent.expression === node &&
|
|
15879
|
+
return parent.expression === node && !isPartOfTypeNode(parent);
|
|
15878
15880
|
case 295 /* ShorthandPropertyAssignment */:
|
|
15879
15881
|
return parent.objectAssignmentInitializer === node;
|
|
15880
15882
|
default:
|
|
@@ -22861,16 +22863,18 @@ var ts;
|
|
|
22861
22863
|
return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type);
|
|
22862
22864
|
}
|
|
22863
22865
|
// @api
|
|
22864
|
-
function createTypeQueryNode(exprName) {
|
|
22866
|
+
function createTypeQueryNode(exprName, typeArguments) {
|
|
22865
22867
|
var node = createBaseNode(180 /* TypeQuery */);
|
|
22866
22868
|
node.exprName = exprName;
|
|
22869
|
+
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
22867
22870
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
22868
22871
|
return node;
|
|
22869
22872
|
}
|
|
22870
22873
|
// @api
|
|
22871
|
-
function updateTypeQueryNode(node, exprName) {
|
|
22874
|
+
function updateTypeQueryNode(node, exprName, typeArguments) {
|
|
22872
22875
|
return node.exprName !== exprName
|
|
22873
|
-
|
|
22876
|
+
|| node.typeArguments !== typeArguments
|
|
22877
|
+
? update(createTypeQueryNode(exprName, typeArguments), node)
|
|
22874
22878
|
: node;
|
|
22875
22879
|
}
|
|
22876
22880
|
// @api
|
|
@@ -27186,6 +27190,19 @@ var ts;
|
|
|
27186
27190
|
return node;
|
|
27187
27191
|
}
|
|
27188
27192
|
ts.ignoreSourceNewlines = ignoreSourceNewlines;
|
|
27193
|
+
/* @internal */
|
|
27194
|
+
function setTypeNode(node, type) {
|
|
27195
|
+
var emitNode = getOrCreateEmitNode(node);
|
|
27196
|
+
emitNode.typeNode = type;
|
|
27197
|
+
return node;
|
|
27198
|
+
}
|
|
27199
|
+
ts.setTypeNode = setTypeNode;
|
|
27200
|
+
/* @internal */
|
|
27201
|
+
function getTypeNode(node) {
|
|
27202
|
+
var _a;
|
|
27203
|
+
return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.typeNode;
|
|
27204
|
+
}
|
|
27205
|
+
ts.getTypeNode = getTypeNode;
|
|
27189
27206
|
})(ts || (ts = {}));
|
|
27190
27207
|
/* @internal */
|
|
27191
27208
|
var ts;
|
|
@@ -29994,7 +30011,8 @@ var ts;
|
|
|
29994
30011
|
visitNode(cbNode, node.parameterName) ||
|
|
29995
30012
|
visitNode(cbNode, node.type);
|
|
29996
30013
|
case 180 /* TypeQuery */:
|
|
29997
|
-
return visitNode(cbNode, node.exprName)
|
|
30014
|
+
return visitNode(cbNode, node.exprName) ||
|
|
30015
|
+
visitNodes(cbNode, cbNodes, node.typeArguments);
|
|
29998
30016
|
case 181 /* TypeLiteral */:
|
|
29999
30017
|
return visitNodes(cbNode, cbNodes, node.members);
|
|
30000
30018
|
case 182 /* ArrayType */:
|
|
@@ -30673,7 +30691,7 @@ var ts;
|
|
|
30673
30691
|
initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */);
|
|
30674
30692
|
// Prime the scanner.
|
|
30675
30693
|
nextToken();
|
|
30676
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
30694
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ false);
|
|
30677
30695
|
var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
|
|
30678
30696
|
clearState();
|
|
30679
30697
|
return isInvalid ? entityName : undefined;
|
|
@@ -31359,18 +31377,8 @@ var ts;
|
|
|
31359
31377
|
if (tryParseSemicolon()) {
|
|
31360
31378
|
return;
|
|
31361
31379
|
}
|
|
31362
|
-
// If an initializer was parsed but there is still an error in finding the next semicolon,
|
|
31363
|
-
// we generally know there was an error already reported in the initializer...
|
|
31364
|
-
// class Example { a = new Map([), ) }
|
|
31365
|
-
// ~
|
|
31366
31380
|
if (initializer) {
|
|
31367
|
-
|
|
31368
|
-
// case we can know that regardless of the initializer we should complain on the block.
|
|
31369
|
-
// class Example { a = 0 {} }
|
|
31370
|
-
// ~
|
|
31371
|
-
if (token() === 18 /* OpenBraceToken */) {
|
|
31372
|
-
parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26 /* SemicolonToken */));
|
|
31373
|
-
}
|
|
31381
|
+
parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26 /* SemicolonToken */));
|
|
31374
31382
|
return;
|
|
31375
31383
|
}
|
|
31376
31384
|
parseErrorForMissingSemicolonAfter(name);
|
|
@@ -32250,7 +32258,7 @@ var ts;
|
|
|
32250
32258
|
}
|
|
32251
32259
|
return createMissingList();
|
|
32252
32260
|
}
|
|
32253
|
-
function parseEntityName(allowReservedWords, diagnosticMessage) {
|
|
32261
|
+
function parseEntityName(allowReservedWords, allowPrivateIdentifiers, diagnosticMessage) {
|
|
32254
32262
|
var pos = getNodePos();
|
|
32255
32263
|
var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
|
|
32256
32264
|
var dotPos = getNodePos();
|
|
@@ -32261,7 +32269,7 @@ var ts;
|
|
|
32261
32269
|
break;
|
|
32262
32270
|
}
|
|
32263
32271
|
dotPos = getNodePos();
|
|
32264
|
-
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords,
|
|
32272
|
+
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, allowPrivateIdentifiers)), pos);
|
|
32265
32273
|
}
|
|
32266
32274
|
return entity;
|
|
32267
32275
|
}
|
|
@@ -32394,7 +32402,7 @@ var ts;
|
|
|
32394
32402
|
}
|
|
32395
32403
|
// TYPES
|
|
32396
32404
|
function parseEntityNameOfTypeReference() {
|
|
32397
|
-
return parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
|
|
32405
|
+
return parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ false, ts.Diagnostics.Type_expected);
|
|
32398
32406
|
}
|
|
32399
32407
|
function parseTypeArgumentsOfTypeReference() {
|
|
32400
32408
|
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
|
|
@@ -32527,7 +32535,9 @@ var ts;
|
|
|
32527
32535
|
function parseTypeQuery() {
|
|
32528
32536
|
var pos = getNodePos();
|
|
32529
32537
|
parseExpected(112 /* TypeOfKeyword */);
|
|
32530
|
-
|
|
32538
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
32539
|
+
var typeArguments = tryParseTypeArguments();
|
|
32540
|
+
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
32531
32541
|
}
|
|
32532
32542
|
function parseTypeParameter() {
|
|
32533
32543
|
var pos = getNodePos();
|
|
@@ -33453,10 +33463,10 @@ var ts;
|
|
|
33453
33463
|
setDecoratorContext(/*val*/ false);
|
|
33454
33464
|
}
|
|
33455
33465
|
var pos = getNodePos();
|
|
33456
|
-
var expr = parseAssignmentExpressionOrHigher();
|
|
33466
|
+
var expr = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
|
|
33457
33467
|
var operatorToken;
|
|
33458
33468
|
while ((operatorToken = parseOptionalToken(27 /* CommaToken */))) {
|
|
33459
|
-
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
|
|
33469
|
+
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false), pos);
|
|
33460
33470
|
}
|
|
33461
33471
|
if (saveDecoratorContext) {
|
|
33462
33472
|
setDecoratorContext(/*val*/ true);
|
|
@@ -33464,9 +33474,9 @@ var ts;
|
|
|
33464
33474
|
return expr;
|
|
33465
33475
|
}
|
|
33466
33476
|
function parseInitializer() {
|
|
33467
|
-
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
33477
|
+
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false) : undefined;
|
|
33468
33478
|
}
|
|
33469
|
-
function parseAssignmentExpressionOrHigher() {
|
|
33479
|
+
function parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) {
|
|
33470
33480
|
// AssignmentExpression[in,yield]:
|
|
33471
33481
|
// 1) ConditionalExpression[?in,?yield]
|
|
33472
33482
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -33492,7 +33502,7 @@ var ts;
|
|
|
33492
33502
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
33493
33503
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
33494
33504
|
// with AssignmentExpression if we see one.
|
|
33495
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
33505
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) || tryParseAsyncSimpleArrowFunctionExpression(disallowReturnTypeInArrowFunction);
|
|
33496
33506
|
if (arrowExpression) {
|
|
33497
33507
|
return arrowExpression;
|
|
33498
33508
|
}
|
|
@@ -33511,7 +33521,7 @@ var ts;
|
|
|
33511
33521
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
33512
33522
|
// identifier and the current token is an arrow.
|
|
33513
33523
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
33514
|
-
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
33524
|
+
return parseSimpleArrowFunctionExpression(pos, expr, disallowReturnTypeInArrowFunction, /*asyncModifier*/ undefined);
|
|
33515
33525
|
}
|
|
33516
33526
|
// Now see if we might be in cases '2' or '3'.
|
|
33517
33527
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -33520,7 +33530,7 @@ var ts;
|
|
|
33520
33530
|
// Note: we call reScanGreaterToken so that we get an appropriately merged token
|
|
33521
33531
|
// for cases like `> > =` becoming `>>=`
|
|
33522
33532
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
33523
|
-
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
33533
|
+
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
33524
33534
|
}
|
|
33525
33535
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
33526
33536
|
return parseConditionalExpressionRest(expr, pos);
|
|
@@ -33563,7 +33573,7 @@ var ts;
|
|
|
33563
33573
|
nextToken();
|
|
33564
33574
|
if (!scanner.hasPrecedingLineBreak() &&
|
|
33565
33575
|
(token() === 41 /* AsteriskToken */ || isStartOfExpression())) {
|
|
33566
|
-
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher()), pos);
|
|
33576
|
+
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false)), pos);
|
|
33567
33577
|
}
|
|
33568
33578
|
else {
|
|
33569
33579
|
// if the next token is not on the same line as yield. or we don't have an '*' or
|
|
@@ -33571,7 +33581,7 @@ var ts;
|
|
|
33571
33581
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
33572
33582
|
}
|
|
33573
33583
|
}
|
|
33574
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
33584
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, disallowReturnTypeInArrowFunction, asyncModifier) {
|
|
33575
33585
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
33576
33586
|
var parameter = factory.createParameterDeclaration(
|
|
33577
33587
|
/*decorators*/ undefined,
|
|
@@ -33583,11 +33593,11 @@ var ts;
|
|
|
33583
33593
|
finishNode(parameter, identifier.pos);
|
|
33584
33594
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
33585
33595
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
33586
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
33596
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, disallowReturnTypeInArrowFunction);
|
|
33587
33597
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
33588
33598
|
return addJSDocComment(finishNode(node, pos));
|
|
33589
33599
|
}
|
|
33590
|
-
function tryParseParenthesizedArrowFunctionExpression() {
|
|
33600
|
+
function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
33591
33601
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
33592
33602
|
if (triState === 0 /* False */) {
|
|
33593
33603
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -33598,8 +33608,8 @@ var ts;
|
|
|
33598
33608
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
33599
33609
|
// expression instead.
|
|
33600
33610
|
return triState === 1 /* True */ ?
|
|
33601
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
33602
|
-
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
33611
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, /*disallowReturnTypeInArrowFunction*/ false) :
|
|
33612
|
+
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
33603
33613
|
}
|
|
33604
33614
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
33605
33615
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -33729,25 +33739,25 @@ var ts;
|
|
|
33729
33739
|
return 2 /* Unknown */;
|
|
33730
33740
|
}
|
|
33731
33741
|
}
|
|
33732
|
-
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
33742
|
+
function parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
33733
33743
|
var tokenPos = scanner.getTokenPos();
|
|
33734
33744
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
33735
33745
|
return undefined;
|
|
33736
33746
|
}
|
|
33737
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
33747
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, disallowReturnTypeInArrowFunction);
|
|
33738
33748
|
if (!result) {
|
|
33739
33749
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
33740
33750
|
}
|
|
33741
33751
|
return result;
|
|
33742
33752
|
}
|
|
33743
|
-
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
33753
|
+
function tryParseAsyncSimpleArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
33744
33754
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
33745
33755
|
if (token() === 131 /* AsyncKeyword */) {
|
|
33746
33756
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
33747
33757
|
var pos = getNodePos();
|
|
33748
33758
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
33749
33759
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
33750
|
-
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
33760
|
+
return parseSimpleArrowFunctionExpression(pos, expr, disallowReturnTypeInArrowFunction, asyncModifier);
|
|
33751
33761
|
}
|
|
33752
33762
|
}
|
|
33753
33763
|
return undefined;
|
|
@@ -33771,7 +33781,7 @@ var ts;
|
|
|
33771
33781
|
}
|
|
33772
33782
|
return 0 /* False */;
|
|
33773
33783
|
}
|
|
33774
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
33784
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, disallowReturnTypeInArrowFunction) {
|
|
33775
33785
|
var pos = getNodePos();
|
|
33776
33786
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
33777
33787
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -33797,6 +33807,23 @@ var ts;
|
|
|
33797
33807
|
return undefined;
|
|
33798
33808
|
}
|
|
33799
33809
|
}
|
|
33810
|
+
// Given:
|
|
33811
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
33812
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
33813
|
+
// ({ y }) : z => ({ z })
|
|
33814
|
+
// This is a valid arrow function with "z" as the return type.
|
|
33815
|
+
//
|
|
33816
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
33817
|
+
// terminates the expression, so we cannot allow a return type if we aren't
|
|
33818
|
+
// certain whether or not the preceding text was parsed as a parameter list.
|
|
33819
|
+
//
|
|
33820
|
+
// For example,
|
|
33821
|
+
// a() ? (b: number, c?: string): void => d() : e
|
|
33822
|
+
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
33823
|
+
// be an arrow expression, so we allow a return type.
|
|
33824
|
+
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
33825
|
+
return undefined;
|
|
33826
|
+
}
|
|
33800
33827
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
33801
33828
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
33802
33829
|
return undefined;
|
|
@@ -33825,12 +33852,12 @@ var ts;
|
|
|
33825
33852
|
var lastToken = token();
|
|
33826
33853
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
33827
33854
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
33828
|
-
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
|
|
33855
|
+
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
33829
33856
|
: parseIdentifier();
|
|
33830
33857
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
33831
33858
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
33832
33859
|
}
|
|
33833
|
-
function parseArrowFunctionExpressionBody(isAsync) {
|
|
33860
|
+
function parseArrowFunctionExpressionBody(isAsync, disallowReturnTypeInArrowFunction) {
|
|
33834
33861
|
if (token() === 18 /* OpenBraceToken */) {
|
|
33835
33862
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
33836
33863
|
}
|
|
@@ -33858,8 +33885,8 @@ var ts;
|
|
|
33858
33885
|
var savedTopLevel = topLevel;
|
|
33859
33886
|
topLevel = false;
|
|
33860
33887
|
var node = isAsync
|
|
33861
|
-
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
33862
|
-
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
33888
|
+
? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction); })
|
|
33889
|
+
: doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction); });
|
|
33863
33890
|
topLevel = savedTopLevel;
|
|
33864
33891
|
return node;
|
|
33865
33892
|
}
|
|
@@ -33872,8 +33899,8 @@ var ts;
|
|
|
33872
33899
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
33873
33900
|
// we do not that for the 'whenFalse' part.
|
|
33874
33901
|
var colonToken;
|
|
33875
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
33876
|
-
? parseAssignmentExpressionOrHigher()
|
|
33902
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
33903
|
+
? parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true)
|
|
33877
33904
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
33878
33905
|
}
|
|
33879
33906
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -34597,20 +34624,30 @@ var ts;
|
|
|
34597
34624
|
expression = parsePropertyAccessExpressionRest(pos, expression, questionDotToken);
|
|
34598
34625
|
continue;
|
|
34599
34626
|
}
|
|
34600
|
-
if (!questionDotToken && token() === 53 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
|
|
34601
|
-
nextToken();
|
|
34602
|
-
expression = finishNode(factory.createNonNullExpression(expression), pos);
|
|
34603
|
-
continue;
|
|
34604
|
-
}
|
|
34605
34627
|
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
|
|
34606
34628
|
if ((questionDotToken || !inDecoratorContext()) && parseOptional(22 /* OpenBracketToken */)) {
|
|
34607
34629
|
expression = parseElementAccessExpressionRest(pos, expression, questionDotToken);
|
|
34608
34630
|
continue;
|
|
34609
34631
|
}
|
|
34610
34632
|
if (isTemplateStartOfTaggedTemplate()) {
|
|
34611
|
-
|
|
34633
|
+
// Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments
|
|
34634
|
+
expression = !questionDotToken && expression.kind === 227 /* ExpressionWithTypeArguments */ ?
|
|
34635
|
+
parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) :
|
|
34636
|
+
parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined);
|
|
34612
34637
|
continue;
|
|
34613
34638
|
}
|
|
34639
|
+
if (!questionDotToken) {
|
|
34640
|
+
if (token() === 53 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
|
|
34641
|
+
nextToken();
|
|
34642
|
+
expression = finishNode(factory.createNonNullExpression(expression), pos);
|
|
34643
|
+
continue;
|
|
34644
|
+
}
|
|
34645
|
+
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34646
|
+
if (typeArguments) {
|
|
34647
|
+
expression = finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
34648
|
+
continue;
|
|
34649
|
+
}
|
|
34650
|
+
}
|
|
34614
34651
|
return expression;
|
|
34615
34652
|
}
|
|
34616
34653
|
}
|
|
@@ -34630,38 +34667,30 @@ var ts;
|
|
|
34630
34667
|
function parseCallExpressionRest(pos, expression) {
|
|
34631
34668
|
while (true) {
|
|
34632
34669
|
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
|
|
34670
|
+
var typeArguments = void 0;
|
|
34633
34671
|
var questionDotToken = parseOptionalToken(28 /* QuestionDotToken */);
|
|
34634
|
-
|
|
34635
|
-
|
|
34636
|
-
|
|
34637
|
-
|
|
34638
|
-
// keep checking for postfix expressions. Otherwise, it's just a '<' that's
|
|
34639
|
-
// part of an arithmetic expression. Break out so we consume it higher in the
|
|
34640
|
-
// stack.
|
|
34641
|
-
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34642
|
-
if (typeArguments) {
|
|
34643
|
-
if (isTemplateStartOfTaggedTemplate()) {
|
|
34644
|
-
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
|
|
34645
|
-
continue;
|
|
34646
|
-
}
|
|
34647
|
-
var argumentList = parseArgumentList();
|
|
34648
|
-
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34649
|
-
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
|
|
34650
|
-
factory.createCallExpression(expression, typeArguments, argumentList);
|
|
34651
|
-
expression = finishNode(callExpr, pos);
|
|
34672
|
+
if (questionDotToken) {
|
|
34673
|
+
typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34674
|
+
if (isTemplateStartOfTaggedTemplate()) {
|
|
34675
|
+
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
|
|
34652
34676
|
continue;
|
|
34653
34677
|
}
|
|
34654
34678
|
}
|
|
34655
|
-
|
|
34679
|
+
if (typeArguments || token() === 20 /* OpenParenToken */) {
|
|
34680
|
+
// Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments
|
|
34681
|
+
if (!questionDotToken && expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
34682
|
+
typeArguments = expression.typeArguments;
|
|
34683
|
+
expression = expression.expression;
|
|
34684
|
+
}
|
|
34656
34685
|
var argumentList = parseArgumentList();
|
|
34657
34686
|
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34658
|
-
factory.createCallChain(expression, questionDotToken,
|
|
34659
|
-
factory.createCallExpression(expression,
|
|
34687
|
+
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
|
|
34688
|
+
factory.createCallExpression(expression, typeArguments, argumentList);
|
|
34660
34689
|
expression = finishNode(callExpr, pos);
|
|
34661
34690
|
continue;
|
|
34662
34691
|
}
|
|
34663
34692
|
if (questionDotToken) {
|
|
34664
|
-
// We failed to parse anything, so report a missing identifier here.
|
|
34693
|
+
// We parsed `?.` but then failed to parse anything, so report a missing identifier here.
|
|
34665
34694
|
var name = createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.Identifier_expected);
|
|
34666
34695
|
expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos);
|
|
34667
34696
|
}
|
|
@@ -34689,21 +34718,25 @@ var ts;
|
|
|
34689
34718
|
// If it doesn't have the closing `>` then it's definitely not an type argument list.
|
|
34690
34719
|
return undefined;
|
|
34691
34720
|
}
|
|
34692
|
-
//
|
|
34693
|
-
//
|
|
34694
|
-
|
|
34695
|
-
|
|
34696
|
-
|
|
34721
|
+
// We successfully parsed a type argument list. The next token determines whether we want to
|
|
34722
|
+
// treat it as such. If the type argument list is followed by `(` or a template literal, as in
|
|
34723
|
+
// `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
|
|
34724
|
+
// it as a relational expression.
|
|
34725
|
+
return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined;
|
|
34697
34726
|
}
|
|
34698
34727
|
function canFollowTypeArgumentsInExpression() {
|
|
34699
34728
|
switch (token()) {
|
|
34729
|
+
// These tokens can follow a type argument list in a call expression.
|
|
34700
34730
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
34701
34731
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
34702
34732
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
34703
|
-
//
|
|
34704
|
-
//
|
|
34733
|
+
// These tokens can't follow in a call expression, nor can they start an
|
|
34734
|
+
// expression. So, consider the type argument list part of an instantiation
|
|
34735
|
+
// expression.
|
|
34705
34736
|
// falls through
|
|
34737
|
+
case 27 /* CommaToken */: // foo<x>,
|
|
34706
34738
|
case 24 /* DotToken */: // foo<x>.
|
|
34739
|
+
case 28 /* QuestionDotToken */: // foo<x>?.
|
|
34707
34740
|
case 21 /* CloseParenToken */: // foo<x>)
|
|
34708
34741
|
case 23 /* CloseBracketToken */: // foo<x>]
|
|
34709
34742
|
case 58 /* ColonToken */: // foo<x>:
|
|
@@ -34721,20 +34754,10 @@ var ts;
|
|
|
34721
34754
|
case 51 /* BarToken */: // foo<x> |
|
|
34722
34755
|
case 19 /* CloseBraceToken */: // foo<x> }
|
|
34723
34756
|
case 1 /* EndOfFileToken */: // foo<x>
|
|
34724
|
-
// these cases can't legally follow a type arg list. However, they're not legal
|
|
34725
|
-
// expressions either. The user is probably in the middle of a generic type. So
|
|
34726
|
-
// treat it as such.
|
|
34727
34757
|
return true;
|
|
34728
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
34729
|
-
case 18 /* OpenBraceToken */: // foo<x> {
|
|
34730
|
-
// We don't want to treat these as type arguments. Otherwise we'll parse this
|
|
34731
|
-
// as an invocation expression. Instead, we want to parse out the expression
|
|
34732
|
-
// in isolation from the type arguments.
|
|
34733
|
-
// falls through
|
|
34734
|
-
default:
|
|
34735
|
-
// Anything else treat as an expression.
|
|
34736
|
-
return false;
|
|
34737
34758
|
}
|
|
34759
|
+
// Treat anything else as an expression.
|
|
34760
|
+
return false;
|
|
34738
34761
|
}
|
|
34739
34762
|
function parsePrimaryExpression() {
|
|
34740
34763
|
switch (token()) {
|
|
@@ -34793,13 +34816,13 @@ var ts;
|
|
|
34793
34816
|
function parseSpreadElement() {
|
|
34794
34817
|
var pos = getNodePos();
|
|
34795
34818
|
parseExpected(25 /* DotDotDotToken */);
|
|
34796
|
-
var expression = parseAssignmentExpressionOrHigher();
|
|
34819
|
+
var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
|
|
34797
34820
|
return finishNode(factory.createSpreadElement(expression), pos);
|
|
34798
34821
|
}
|
|
34799
34822
|
function parseArgumentOrArrayLiteralElement() {
|
|
34800
34823
|
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
|
|
34801
34824
|
token() === 27 /* CommaToken */ ? finishNode(factory.createOmittedExpression(), getNodePos()) :
|
|
34802
|
-
parseAssignmentExpressionOrHigher();
|
|
34825
|
+
parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
|
|
34803
34826
|
}
|
|
34804
34827
|
function parseArgumentExpression() {
|
|
34805
34828
|
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
|
|
@@ -34816,7 +34839,7 @@ var ts;
|
|
|
34816
34839
|
var pos = getNodePos();
|
|
34817
34840
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
34818
34841
|
if (parseOptionalToken(25 /* DotDotDotToken */)) {
|
|
34819
|
-
var expression = parseAssignmentExpressionOrHigher();
|
|
34842
|
+
var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
|
|
34820
34843
|
return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
|
|
34821
34844
|
}
|
|
34822
34845
|
var decorators = parseDecorators();
|
|
@@ -34845,7 +34868,7 @@ var ts;
|
|
|
34845
34868
|
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58 /* ColonToken */);
|
|
34846
34869
|
if (isShorthandPropertyAssignment) {
|
|
34847
34870
|
var equalsToken = parseOptionalToken(63 /* EqualsToken */);
|
|
34848
|
-
var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
|
|
34871
|
+
var objectAssignmentInitializer = equalsToken ? allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); }) : undefined;
|
|
34849
34872
|
node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
|
|
34850
34873
|
// Save equals token for error reporting.
|
|
34851
34874
|
// TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
|
|
@@ -34853,7 +34876,7 @@ var ts;
|
|
|
34853
34876
|
}
|
|
34854
34877
|
else {
|
|
34855
34878
|
parseExpected(58 /* ColonToken */);
|
|
34856
|
-
var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
34879
|
+
var initializer = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); });
|
|
34857
34880
|
node = factory.createPropertyAssignment(name, initializer);
|
|
34858
34881
|
}
|
|
34859
34882
|
// Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
|
|
@@ -34915,26 +34938,15 @@ var ts;
|
|
|
34915
34938
|
return finishNode(factory.createMetaProperty(103 /* NewKeyword */, name), pos);
|
|
34916
34939
|
}
|
|
34917
34940
|
var expressionPos = getNodePos();
|
|
34918
|
-
var expression = parsePrimaryExpression();
|
|
34941
|
+
var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false);
|
|
34919
34942
|
var typeArguments;
|
|
34920
|
-
|
|
34921
|
-
|
|
34922
|
-
typeArguments =
|
|
34923
|
-
|
|
34924
|
-
ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
|
|
34925
|
-
expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
|
|
34926
|
-
typeArguments = undefined;
|
|
34927
|
-
}
|
|
34928
|
-
break;
|
|
34929
|
-
}
|
|
34930
|
-
var argumentsArray;
|
|
34931
|
-
if (token() === 20 /* OpenParenToken */) {
|
|
34932
|
-
argumentsArray = parseArgumentList();
|
|
34943
|
+
// Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments
|
|
34944
|
+
if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
34945
|
+
typeArguments = expression.typeArguments;
|
|
34946
|
+
expression = expression.expression;
|
|
34933
34947
|
}
|
|
34934
|
-
|
|
34935
|
-
|
|
34936
|
-
}
|
|
34937
|
-
return finishNode(factory.createNewExpression(expression, typeArguments, argumentsArray), pos);
|
|
34948
|
+
var argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : undefined;
|
|
34949
|
+
return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos);
|
|
34938
34950
|
}
|
|
34939
34951
|
// STATEMENTS
|
|
34940
34952
|
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
|
|
@@ -35044,7 +35056,7 @@ var ts;
|
|
|
35044
35056
|
}
|
|
35045
35057
|
var node;
|
|
35046
35058
|
if (awaitToken ? parseExpected(159 /* OfKeyword */) : parseOptional(159 /* OfKeyword */)) {
|
|
35047
|
-
var expression = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35059
|
+
var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); });
|
|
35048
35060
|
parseExpected(21 /* CloseParenToken */);
|
|
35049
35061
|
node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
|
|
35050
35062
|
}
|
|
@@ -36023,6 +36035,9 @@ var ts;
|
|
|
36023
36035
|
function parseExpressionWithTypeArguments() {
|
|
36024
36036
|
var pos = getNodePos();
|
|
36025
36037
|
var expression = parseLeftHandSideExpressionOrHigher();
|
|
36038
|
+
if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
36039
|
+
return expression;
|
|
36040
|
+
}
|
|
36026
36041
|
var typeArguments = tryParseTypeArguments();
|
|
36027
36042
|
return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
36028
36043
|
}
|
|
@@ -36208,7 +36223,7 @@ var ts;
|
|
|
36208
36223
|
var pos = getNodePos();
|
|
36209
36224
|
var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
|
|
36210
36225
|
parseExpected(58 /* ColonToken */);
|
|
36211
|
-
var value = parseAssignmentExpressionOrHigher();
|
|
36226
|
+
var value = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
|
|
36212
36227
|
return finishNode(factory.createAssertEntry(name, value), pos);
|
|
36213
36228
|
}
|
|
36214
36229
|
function parseAssertClause() {
|
|
@@ -36266,7 +36281,7 @@ var ts;
|
|
|
36266
36281
|
function parseModuleReference() {
|
|
36267
36282
|
return isExternalModuleReference()
|
|
36268
36283
|
? parseExternalModuleReference()
|
|
36269
|
-
: parseEntityName(/*allowReservedWords*/ false);
|
|
36284
|
+
: parseEntityName(/*allowReservedWords*/ false, /*allowPrivateIdentifiers*/ false);
|
|
36270
36285
|
}
|
|
36271
36286
|
function parseExternalModuleReference() {
|
|
36272
36287
|
var pos = getNodePos();
|
|
@@ -36445,7 +36460,7 @@ var ts;
|
|
|
36445
36460
|
else {
|
|
36446
36461
|
parseExpected(88 /* DefaultKeyword */);
|
|
36447
36462
|
}
|
|
36448
|
-
var expression = parseAssignmentExpressionOrHigher();
|
|
36463
|
+
var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
|
|
36449
36464
|
parseSemicolon();
|
|
36450
36465
|
setAwaitContext(savedAwaitContext);
|
|
36451
36466
|
var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
|
|
@@ -36548,7 +36563,7 @@ var ts;
|
|
|
36548
36563
|
var pos = getNodePos();
|
|
36549
36564
|
var hasBrace = parseOptional(18 /* OpenBraceToken */);
|
|
36550
36565
|
var p2 = getNodePos();
|
|
36551
|
-
var entityName = parseEntityName(/* allowReservedWords*/ false);
|
|
36566
|
+
var entityName = parseEntityName(/* allowReservedWords*/ false, /*allowPrivateIdentifiers*/ false);
|
|
36552
36567
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
36553
36568
|
reScanHashToken(); // rescan #id as # id
|
|
36554
36569
|
nextTokenJSDoc(); // then skip the #
|
|
@@ -36991,7 +37006,7 @@ var ts;
|
|
|
36991
37006
|
// parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error
|
|
36992
37007
|
var p2 = getNodePos();
|
|
36993
37008
|
var name = ts.tokenIsIdentifierOrKeyword(token())
|
|
36994
|
-
? parseEntityName(/*allowReservedWords*/ true)
|
|
37009
|
+
? parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ false)
|
|
36995
37010
|
: undefined;
|
|
36996
37011
|
if (name) {
|
|
36997
37012
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
@@ -37016,11 +37031,13 @@ var ts;
|
|
|
37016
37031
|
&& nextTokenJSDoc() === 59 /* AtToken */
|
|
37017
37032
|
&& ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc())) {
|
|
37018
37033
|
var kind = scanner.getTokenValue();
|
|
37019
|
-
if (kind
|
|
37034
|
+
if (isJSDocLinkTag(kind))
|
|
37020
37035
|
return kind;
|
|
37021
|
-
}
|
|
37022
37036
|
}
|
|
37023
37037
|
}
|
|
37038
|
+
function isJSDocLinkTag(kind) {
|
|
37039
|
+
return kind === "link" || kind === "linkcode" || kind === "linkplain";
|
|
37040
|
+
}
|
|
37024
37041
|
function parseUnknownTag(start, tagName, indent, indentText) {
|
|
37025
37042
|
return finishNode(factory.createJSDocUnknownTag(tagName, parseTrailingTagComments(start, getNodePos(), indent, indentText)), start);
|
|
37026
37043
|
}
|
|
@@ -37126,7 +37143,7 @@ var ts;
|
|
|
37126
37143
|
}
|
|
37127
37144
|
function parseSeeTag(start, tagName, indent, indentText) {
|
|
37128
37145
|
var isMarkdownOrJSDocLink = token() === 22 /* OpenBracketToken */
|
|
37129
|
-
|| lookAhead(function () { return nextTokenJSDoc() === 59 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenValue()
|
|
37146
|
+
|| lookAhead(function () { return nextTokenJSDoc() === 59 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && isJSDocLinkTag(scanner.getTokenValue()); });
|
|
37130
37147
|
var nameExpression = isMarkdownOrJSDocLink ? undefined : parseJSDocNameReference();
|
|
37131
37148
|
var comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, getNodePos(), indent, indentText) : undefined;
|
|
37132
37149
|
return finishNode(factory.createJSDocSeeTag(tagName, nameExpression, comments), start);
|
|
@@ -38298,11 +38315,13 @@ var ts;
|
|
|
38298
38315
|
["es2019.string", "lib.es2019.string.d.ts"],
|
|
38299
38316
|
["es2019.symbol", "lib.es2019.symbol.d.ts"],
|
|
38300
38317
|
["es2020.bigint", "lib.es2020.bigint.d.ts"],
|
|
38318
|
+
["es2020.date", "lib.es2020.date.d.ts"],
|
|
38301
38319
|
["es2020.promise", "lib.es2020.promise.d.ts"],
|
|
38302
38320
|
["es2020.sharedmemory", "lib.es2020.sharedmemory.d.ts"],
|
|
38303
38321
|
["es2020.string", "lib.es2020.string.d.ts"],
|
|
38304
38322
|
["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
|
|
38305
38323
|
["es2020.intl", "lib.es2020.intl.d.ts"],
|
|
38324
|
+
["es2020.number", "lib.es2020.number.d.ts"],
|
|
38306
38325
|
["es2021.promise", "lib.es2021.promise.d.ts"],
|
|
38307
38326
|
["es2021.string", "lib.es2021.string.d.ts"],
|
|
38308
38327
|
["es2021.weakref", "lib.es2021.weakref.d.ts"],
|
|
@@ -40466,7 +40485,7 @@ var ts;
|
|
|
40466
40485
|
var result = [];
|
|
40467
40486
|
result.push("{");
|
|
40468
40487
|
result.push(tab + "\"compilerOptions\": {");
|
|
40469
|
-
result.push("" + tab + tab + "/* " + ts.getLocaleSpecificMessage(ts.Diagnostics.
|
|
40488
|
+
result.push("" + tab + tab + "/* " + ts.getLocaleSpecificMessage(ts.Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file) + " */");
|
|
40470
40489
|
result.push("");
|
|
40471
40490
|
// Print out each row, aligning all the descriptions on the same column.
|
|
40472
40491
|
for (var _a = 0, entries_2 = entries; _a < entries_2.length; _a++) {
|
|
@@ -46024,14 +46043,12 @@ var ts;
|
|
|
46024
46043
|
}
|
|
46025
46044
|
}
|
|
46026
46045
|
function setCommonJsModuleIndicator(node) {
|
|
46027
|
-
if (file.externalModuleIndicator
|
|
46046
|
+
if (file.externalModuleIndicator) {
|
|
46028
46047
|
return false;
|
|
46029
46048
|
}
|
|
46030
|
-
if (file.commonJsModuleIndicator
|
|
46049
|
+
if (!file.commonJsModuleIndicator) {
|
|
46031
46050
|
file.commonJsModuleIndicator = node;
|
|
46032
|
-
|
|
46033
|
-
bindSourceFileAsExternalModule();
|
|
46034
|
-
}
|
|
46051
|
+
bindSourceFileAsExternalModule();
|
|
46035
46052
|
}
|
|
46036
46053
|
return true;
|
|
46037
46054
|
}
|
|
@@ -47153,6 +47170,8 @@ var ts;
|
|
|
47153
47170
|
var instantiationCount = 0;
|
|
47154
47171
|
var instantiationDepth = 0;
|
|
47155
47172
|
var inlineLevel = 0;
|
|
47173
|
+
var varianceLevel = 0;
|
|
47174
|
+
var nestedVarianceSymbols;
|
|
47156
47175
|
var currentNode;
|
|
47157
47176
|
var emptySymbols = ts.createSymbolTable();
|
|
47158
47177
|
var arrayVariances = [1 /* Covariant */];
|
|
@@ -51031,7 +51050,7 @@ var ts;
|
|
|
51031
51050
|
// get symbol of the first identifier of the entityName
|
|
51032
51051
|
var meaning;
|
|
51033
51052
|
if (entityName.parent.kind === 180 /* TypeQuery */ ||
|
|
51034
|
-
ts.
|
|
51053
|
+
entityName.parent.kind === 227 /* ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) ||
|
|
51035
51054
|
entityName.parent.kind === 161 /* ComputedPropertyName */) {
|
|
51036
51055
|
// Typeof value
|
|
51037
51056
|
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
@@ -51142,7 +51161,7 @@ var ts;
|
|
|
51142
51161
|
return flags & 814775659 /* NodeBuilderFlagsMask */;
|
|
51143
51162
|
}
|
|
51144
51163
|
function isClassInstanceSide(type) {
|
|
51145
|
-
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) &
|
|
51164
|
+
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 33554432 /* IsClassInstanceClone */)));
|
|
51146
51165
|
}
|
|
51147
51166
|
function createNodeBuilder() {
|
|
51148
51167
|
return {
|
|
@@ -55071,7 +55090,7 @@ var ts;
|
|
|
55071
55090
|
members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
|
|
55072
55091
|
result.objectFlags |= (ts.getObjectFlags(type) & 8192 /* JSLiteral */); // Propagate JSLiteral flag
|
|
55073
55092
|
if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
|
|
55074
|
-
result.objectFlags |=
|
|
55093
|
+
result.objectFlags |= 33554432 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
|
|
55075
55094
|
}
|
|
55076
55095
|
return result;
|
|
55077
55096
|
}
|
|
@@ -55238,8 +55257,8 @@ var ts;
|
|
|
55238
55257
|
var memberDeclaration = root.kind === 163 /* Parameter */ ? root.parent : root;
|
|
55239
55258
|
return isPrivateWithinAmbient(memberDeclaration);
|
|
55240
55259
|
}
|
|
55241
|
-
function tryGetTypeFromEffectiveTypeNode(
|
|
55242
|
-
var typeNode = ts.getEffectiveTypeAnnotationNode(
|
|
55260
|
+
function tryGetTypeFromEffectiveTypeNode(node) {
|
|
55261
|
+
var typeNode = ts.getEffectiveTypeAnnotationNode(node);
|
|
55243
55262
|
if (typeNode) {
|
|
55244
55263
|
return getTypeFromTypeNode(typeNode);
|
|
55245
55264
|
}
|
|
@@ -57117,87 +57136,87 @@ var ts;
|
|
|
57117
57136
|
* Converts an AnonymousType to a ResolvedType.
|
|
57118
57137
|
*/
|
|
57119
57138
|
function resolveAnonymousTypeMembers(type) {
|
|
57120
|
-
var symbol = getMergedSymbol(type.symbol);
|
|
57121
57139
|
if (type.target) {
|
|
57122
57140
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57123
|
-
var
|
|
57141
|
+
var members_6 = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
|
|
57124
57142
|
var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper);
|
|
57125
57143
|
var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper);
|
|
57126
|
-
var
|
|
57127
|
-
setStructuredTypeMembers(type,
|
|
57144
|
+
var indexInfos_1 = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
|
|
57145
|
+
setStructuredTypeMembers(type, members_6, callSignatures, constructSignatures, indexInfos_1);
|
|
57146
|
+
return;
|
|
57128
57147
|
}
|
|
57129
|
-
|
|
57148
|
+
var symbol = getMergedSymbol(type.symbol);
|
|
57149
|
+
if (symbol.flags & 2048 /* TypeLiteral */) {
|
|
57130
57150
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57131
|
-
var
|
|
57132
|
-
var callSignatures = getSignaturesOfSymbol(
|
|
57133
|
-
var constructSignatures = getSignaturesOfSymbol(
|
|
57134
|
-
var
|
|
57135
|
-
setStructuredTypeMembers(type,
|
|
57151
|
+
var members_7 = getMembersOfSymbol(symbol);
|
|
57152
|
+
var callSignatures = getSignaturesOfSymbol(members_7.get("__call" /* Call */));
|
|
57153
|
+
var constructSignatures = getSignaturesOfSymbol(members_7.get("__new" /* New */));
|
|
57154
|
+
var indexInfos_2 = getIndexInfosOfSymbol(symbol);
|
|
57155
|
+
setStructuredTypeMembers(type, members_7, callSignatures, constructSignatures, indexInfos_2);
|
|
57156
|
+
return;
|
|
57136
57157
|
}
|
|
57137
|
-
|
|
57138
|
-
|
|
57139
|
-
|
|
57140
|
-
|
|
57141
|
-
|
|
57142
|
-
|
|
57143
|
-
|
|
57144
|
-
|
|
57145
|
-
|
|
57146
|
-
|
|
57147
|
-
|
|
57148
|
-
|
|
57149
|
-
|
|
57150
|
-
members = varsOnly_1;
|
|
57151
|
-
}
|
|
57158
|
+
// Combinations of function, class, enum and module
|
|
57159
|
+
var members = emptySymbols;
|
|
57160
|
+
var indexInfos;
|
|
57161
|
+
if (symbol.exports) {
|
|
57162
|
+
members = getExportsOfSymbol(symbol);
|
|
57163
|
+
if (symbol === globalThisSymbol) {
|
|
57164
|
+
var varsOnly_1 = new ts.Map();
|
|
57165
|
+
members.forEach(function (p) {
|
|
57166
|
+
if (!(p.flags & 418 /* BlockScoped */)) {
|
|
57167
|
+
varsOnly_1.set(p.escapedName, p);
|
|
57168
|
+
}
|
|
57169
|
+
});
|
|
57170
|
+
members = varsOnly_1;
|
|
57152
57171
|
}
|
|
57153
|
-
|
|
57154
|
-
|
|
57155
|
-
|
|
57156
|
-
|
|
57157
|
-
|
|
57158
|
-
|
|
57159
|
-
|
|
57160
|
-
|
|
57161
|
-
|
|
57162
|
-
else if (baseConstructorType === anyType) {
|
|
57163
|
-
baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
|
|
57164
|
-
}
|
|
57172
|
+
}
|
|
57173
|
+
var baseConstructorIndexInfo;
|
|
57174
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57175
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57176
|
+
var classType = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57177
|
+
var baseConstructorType = getBaseConstructorTypeOfClass(classType);
|
|
57178
|
+
if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
|
|
57179
|
+
members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
|
|
57180
|
+
addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
|
|
57165
57181
|
}
|
|
57166
|
-
|
|
57167
|
-
|
|
57168
|
-
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57182
|
+
else if (baseConstructorType === anyType) {
|
|
57183
|
+
baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
|
|
57169
57184
|
}
|
|
57170
|
-
|
|
57171
|
-
|
|
57172
|
-
|
|
57173
|
-
|
|
57174
|
-
|
|
57175
|
-
|
|
57176
|
-
|
|
57177
|
-
|
|
57185
|
+
}
|
|
57186
|
+
var indexSymbol = getIndexSymbolFromSymbolTable(members);
|
|
57187
|
+
if (indexSymbol) {
|
|
57188
|
+
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57189
|
+
}
|
|
57190
|
+
else {
|
|
57191
|
+
if (baseConstructorIndexInfo) {
|
|
57192
|
+
indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
|
|
57178
57193
|
}
|
|
57179
|
-
|
|
57180
|
-
|
|
57181
|
-
|
|
57182
|
-
// in the process of resolving (see issue #6072). The temporarily empty signature list
|
|
57183
|
-
// will never be observed because a qualified name can't reference signatures.
|
|
57184
|
-
if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
|
|
57185
|
-
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57194
|
+
if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
|
|
57195
|
+
ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
|
|
57196
|
+
indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
|
|
57186
57197
|
}
|
|
57187
|
-
|
|
57188
|
-
|
|
57189
|
-
|
|
57190
|
-
|
|
57191
|
-
|
|
57192
|
-
|
|
57193
|
-
|
|
57194
|
-
|
|
57195
|
-
|
|
57196
|
-
|
|
57197
|
-
|
|
57198
|
-
|
|
57199
|
-
|
|
57198
|
+
}
|
|
57199
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
|
|
57200
|
+
// We resolve the members before computing the signatures because a signature may use
|
|
57201
|
+
// typeof with a qualified name expression that circularly references the type we are
|
|
57202
|
+
// in the process of resolving (see issue #6072). The temporarily empty signature list
|
|
57203
|
+
// will never be observed because a qualified name can't reference signatures.
|
|
57204
|
+
if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
|
|
57205
|
+
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57206
|
+
}
|
|
57207
|
+
// And likewise for construct signatures for classes
|
|
57208
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57209
|
+
var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57210
|
+
var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
|
|
57211
|
+
if (symbol.flags & 16 /* Function */) {
|
|
57212
|
+
constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
|
|
57213
|
+
createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
|
|
57214
|
+
undefined; }));
|
|
57200
57215
|
}
|
|
57216
|
+
if (!constructSignatures.length) {
|
|
57217
|
+
constructSignatures = getDefaultConstructSignatures(classType_1);
|
|
57218
|
+
}
|
|
57219
|
+
type.constructSignatures = constructSignatures;
|
|
57201
57220
|
}
|
|
57202
57221
|
}
|
|
57203
57222
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
@@ -58198,8 +58217,8 @@ var ts;
|
|
|
58198
58217
|
var stringIndexInfo;
|
|
58199
58218
|
var applicableInfo;
|
|
58200
58219
|
var applicableInfos;
|
|
58201
|
-
for (var _i = 0,
|
|
58202
|
-
var info =
|
|
58220
|
+
for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
|
|
58221
|
+
var info = indexInfos_3[_i];
|
|
58203
58222
|
if (info.keyType === stringType) {
|
|
58204
58223
|
stringIndexInfo = info;
|
|
58205
58224
|
}
|
|
@@ -58772,14 +58791,14 @@ var ts;
|
|
|
58772
58791
|
}
|
|
58773
58792
|
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
58774
58793
|
if (indexSymbol.declarations) {
|
|
58775
|
-
var
|
|
58794
|
+
var indexInfos_4 = [];
|
|
58776
58795
|
var _loop_14 = function (declaration) {
|
|
58777
58796
|
if (declaration.parameters.length === 1) {
|
|
58778
58797
|
var parameter = declaration.parameters[0];
|
|
58779
58798
|
if (parameter.type) {
|
|
58780
58799
|
forEachType(getTypeFromTypeNode(parameter.type), function (keyType) {
|
|
58781
|
-
if (isValidIndexKeyType(keyType) && !findIndexInfo(
|
|
58782
|
-
|
|
58800
|
+
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_4, keyType)) {
|
|
58801
|
+
indexInfos_4.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
|
|
58783
58802
|
}
|
|
58784
58803
|
});
|
|
58785
58804
|
}
|
|
@@ -58789,7 +58808,7 @@ var ts;
|
|
|
58789
58808
|
var declaration = _a[_i];
|
|
58790
58809
|
_loop_14(declaration);
|
|
58791
58810
|
}
|
|
58792
|
-
return
|
|
58811
|
+
return indexInfos_4;
|
|
58793
58812
|
}
|
|
58794
58813
|
return ts.emptyArray;
|
|
58795
58814
|
}
|
|
@@ -59337,7 +59356,7 @@ var ts;
|
|
|
59337
59356
|
// The expression is processed as an identifier expression (section 4.3)
|
|
59338
59357
|
// or property access expression(section 4.10),
|
|
59339
59358
|
// the widened type(section 3.9) of which becomes the result.
|
|
59340
|
-
var type =
|
|
59359
|
+
var type = checkExpressionWithTypeArguments(node);
|
|
59341
59360
|
links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type));
|
|
59342
59361
|
}
|
|
59343
59362
|
return links.resolvedType;
|
|
@@ -59674,7 +59693,7 @@ var ts;
|
|
|
59674
59693
|
}
|
|
59675
59694
|
}
|
|
59676
59695
|
var fixedLength = properties.length;
|
|
59677
|
-
var lengthSymbol = createSymbol(4 /* Property */, "length");
|
|
59696
|
+
var lengthSymbol = createSymbol(4 /* Property */, "length", readonly ? 8 /* Readonly */ : 0);
|
|
59678
59697
|
if (combinedFlags & 12 /* Variable */) {
|
|
59679
59698
|
lengthSymbol.type = numberType;
|
|
59680
59699
|
}
|
|
@@ -62041,7 +62060,9 @@ var ts;
|
|
|
62041
62060
|
return result;
|
|
62042
62061
|
}
|
|
62043
62062
|
function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
62044
|
-
var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
|
|
62063
|
+
var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
|
|
62064
|
+
type.objectFlags & 16777216 /* InstantiationExpressionType */ ? type.node :
|
|
62065
|
+
type.symbol.declarations[0];
|
|
62045
62066
|
var links = getNodeLinks(declaration);
|
|
62046
62067
|
var target = type.objectFlags & 4 /* Reference */ ? links.resolvedType :
|
|
62047
62068
|
type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
@@ -62057,8 +62078,8 @@ var ts;
|
|
|
62057
62078
|
outerTypeParameters = ts.addRange(outerTypeParameters, templateTagParameters);
|
|
62058
62079
|
}
|
|
62059
62080
|
typeParameters = outerTypeParameters || ts.emptyArray;
|
|
62060
|
-
var allDeclarations_1 = type.objectFlags & 4 /* Reference */ ? [declaration] : type.symbol.declarations;
|
|
62061
|
-
typeParameters = (target.objectFlags & 4 /* Reference */ || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
|
|
62081
|
+
var allDeclarations_1 = type.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) ? [declaration] : type.symbol.declarations;
|
|
62082
|
+
typeParameters = (target.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
|
|
62062
62083
|
ts.filter(typeParameters, function (tp) { return ts.some(allDeclarations_1, function (d) { return isTypeParameterPossiblyReferenced(tp, d); }); }) :
|
|
62063
62084
|
typeParameters;
|
|
62064
62085
|
links.outerTypeParameters = typeParameters;
|
|
@@ -62230,6 +62251,9 @@ var ts;
|
|
|
62230
62251
|
mapper = combineTypeMappers(makeUnaryTypeMapper(origTypeParameter, freshTypeParameter), mapper);
|
|
62231
62252
|
freshTypeParameter.mapper = mapper;
|
|
62232
62253
|
}
|
|
62254
|
+
if (type.objectFlags & 16777216 /* InstantiationExpressionType */) {
|
|
62255
|
+
result.node = type.node;
|
|
62256
|
+
}
|
|
62233
62257
|
result.target = type;
|
|
62234
62258
|
result.mapper = mapper;
|
|
62235
62259
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -62253,7 +62277,7 @@ var ts;
|
|
|
62253
62277
|
// distributive conditional type T extends U ? X : Y is instantiated with A | B for T, the
|
|
62254
62278
|
// result is (A extends U ? X : Y) | (B extends U ? X : Y).
|
|
62255
62279
|
result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ?
|
|
62256
|
-
mapTypeWithAlias(distributionType, function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
|
|
62280
|
+
mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
|
|
62257
62281
|
getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments);
|
|
62258
62282
|
root.instantiations.set(id, result);
|
|
62259
62283
|
}
|
|
@@ -62995,10 +63019,6 @@ var ts;
|
|
|
62995
63019
|
if (sourceRestType || targetRestType) {
|
|
62996
63020
|
void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers);
|
|
62997
63021
|
}
|
|
62998
|
-
if (sourceRestType && targetRestType && sourceCount !== targetCount) {
|
|
62999
|
-
// We're not able to relate misaligned complex rest parameters
|
|
63000
|
-
return 0 /* False */;
|
|
63001
|
-
}
|
|
63002
63022
|
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
63003
63023
|
var strictVariance = !(checkMode & 3 /* Callback */) && strictFunctionTypes && kind !== 168 /* MethodDeclaration */ &&
|
|
63004
63024
|
kind !== 167 /* MethodSignature */ && kind !== 170 /* Constructor */;
|
|
@@ -63263,7 +63283,7 @@ var ts;
|
|
|
63263
63283
|
}
|
|
63264
63284
|
if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
|
|
63265
63285
|
var related = relation.get(getRelationKey(source, target, 0 /* None */, relation, /*ignoreConstraints*/ false));
|
|
63266
|
-
if (related !== undefined) {
|
|
63286
|
+
if (related !== undefined && !(related & 24 /* ReportsMask */)) {
|
|
63267
63287
|
return !!(related & 1 /* Succeeded */);
|
|
63268
63288
|
}
|
|
63269
63289
|
}
|
|
@@ -65000,8 +65020,9 @@ var ts;
|
|
|
65000
65020
|
// This ensures the subtype relationship is ordered, and preventing declaration order
|
|
65001
65021
|
// from deciding which type "wins" in union subtype reduction.
|
|
65002
65022
|
// They're still assignable to one another, since `readonly` doesn't affect assignability.
|
|
65003
|
-
|
|
65004
|
-
|
|
65023
|
+
// This is only applied during the strictSubtypeRelation -- currently used in subtype reduction
|
|
65024
|
+
if (relation === strictSubtypeRelation &&
|
|
65025
|
+
isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp)) {
|
|
65005
65026
|
return 0 /* False */;
|
|
65006
65027
|
}
|
|
65007
65028
|
// If the target comes from a partial union prop, allow `undefined` in the target type
|
|
@@ -65423,8 +65444,8 @@ var ts;
|
|
|
65423
65444
|
var indexInfos = getIndexInfosOfType(target);
|
|
65424
65445
|
var targetHasStringIndex = ts.some(indexInfos, function (info) { return info.keyType === stringType; });
|
|
65425
65446
|
var result = -1 /* True */;
|
|
65426
|
-
for (var _i = 0,
|
|
65427
|
-
var targetInfo =
|
|
65447
|
+
for (var _i = 0, indexInfos_5 = indexInfos; _i < indexInfos_5.length; _i++) {
|
|
65448
|
+
var targetInfo = indexInfos_5[_i];
|
|
65428
65449
|
var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ :
|
|
65429
65450
|
isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, 3 /* Both */, reportErrors) :
|
|
65430
65451
|
typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState);
|
|
@@ -65587,35 +65608,46 @@ var ts;
|
|
|
65587
65608
|
}
|
|
65588
65609
|
return false;
|
|
65589
65610
|
}
|
|
65611
|
+
function getVariances(type) {
|
|
65612
|
+
// Arrays and tuples are known to be covariant, no need to spend time computing this.
|
|
65613
|
+
if (type === globalArrayType || type === globalReadonlyArrayType || type.objectFlags & 8 /* Tuple */) {
|
|
65614
|
+
return arrayVariances;
|
|
65615
|
+
}
|
|
65616
|
+
return getVariancesWorker(type.symbol, type.typeParameters, getMarkerTypeReference);
|
|
65617
|
+
}
|
|
65590
65618
|
// Return a type reference where the source type parameter is replaced with the target marker
|
|
65591
65619
|
// type, and flag the result as a marker type reference.
|
|
65592
|
-
function getMarkerTypeReference(
|
|
65620
|
+
function getMarkerTypeReference(symbol, source, target) {
|
|
65621
|
+
var type = getDeclaredTypeOfSymbol(symbol);
|
|
65593
65622
|
var result = createTypeReference(type, ts.map(type.typeParameters, function (t) { return t === source ? target : t; }));
|
|
65594
65623
|
result.objectFlags |= 4096 /* MarkerType */;
|
|
65595
65624
|
return result;
|
|
65596
65625
|
}
|
|
65597
65626
|
function getAliasVariances(symbol) {
|
|
65598
|
-
|
|
65599
|
-
|
|
65600
|
-
|
|
65601
|
-
|
|
65602
|
-
|
|
65603
|
-
|
|
65627
|
+
return getVariancesWorker(symbol, getSymbolLinks(symbol).typeParameters, getMarkerTypeAliasReference);
|
|
65628
|
+
}
|
|
65629
|
+
function getMarkerTypeAliasReference(symbol, source, target) {
|
|
65630
|
+
var result = getTypeAliasInstantiation(symbol, instantiateTypes(getSymbolLinks(symbol).typeParameters, makeUnaryTypeMapper(source, target)));
|
|
65631
|
+
result.aliasTypeArgumentsContainsMarker = true;
|
|
65632
|
+
return result;
|
|
65604
65633
|
}
|
|
65605
65634
|
// Return an array containing the variance of each type parameter. The variance is effectively
|
|
65606
65635
|
// a digest of the type comparisons that occur for each type argument when instantiations of the
|
|
65607
65636
|
// generic type are structurally compared. We infer the variance information by comparing
|
|
65608
65637
|
// instantiations of the generic type for type arguments with known relations. The function
|
|
65609
65638
|
// returns the emptyArray singleton when invoked recursively for the given generic type.
|
|
65610
|
-
function getVariancesWorker(
|
|
65611
|
-
var _a, _b, _c;
|
|
65639
|
+
function getVariancesWorker(symbol, typeParameters, createMarkerType) {
|
|
65612
65640
|
if (typeParameters === void 0) { typeParameters = ts.emptyArray; }
|
|
65613
|
-
var
|
|
65614
|
-
if (!variances) {
|
|
65615
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: (
|
|
65641
|
+
var links = getSymbolLinks(symbol);
|
|
65642
|
+
if (!links.variances) {
|
|
65643
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getSymbolId(symbol) });
|
|
65644
|
+
if (varianceLevel > 0) {
|
|
65645
|
+
nestedVarianceSymbols = ts.append(nestedVarianceSymbols, symbol);
|
|
65646
|
+
}
|
|
65647
|
+
varianceLevel++;
|
|
65616
65648
|
// The emptyArray singleton is used to signal a recursive invocation.
|
|
65617
|
-
|
|
65618
|
-
variances = [];
|
|
65649
|
+
links.variances = ts.emptyArray;
|
|
65650
|
+
var variances = [];
|
|
65619
65651
|
var _loop_21 = function (tp) {
|
|
65620
65652
|
var unmeasurable = false;
|
|
65621
65653
|
var unreliable = false;
|
|
@@ -65624,15 +65656,15 @@ var ts;
|
|
|
65624
65656
|
// We first compare instantiations where the type parameter is replaced with
|
|
65625
65657
|
// marker types that have a known subtype relationship. From this we can infer
|
|
65626
65658
|
// invariance, covariance, contravariance or bivariance.
|
|
65627
|
-
var typeWithSuper = createMarkerType(
|
|
65628
|
-
var typeWithSub = createMarkerType(
|
|
65659
|
+
var typeWithSuper = createMarkerType(symbol, tp, markerSuperType);
|
|
65660
|
+
var typeWithSub = createMarkerType(symbol, tp, markerSubType);
|
|
65629
65661
|
var variance = (isTypeAssignableTo(typeWithSub, typeWithSuper) ? 1 /* Covariant */ : 0) |
|
|
65630
65662
|
(isTypeAssignableTo(typeWithSuper, typeWithSub) ? 2 /* Contravariant */ : 0);
|
|
65631
65663
|
// If the instantiations appear to be related bivariantly it may be because the
|
|
65632
65664
|
// type parameter is independent (i.e. it isn't witnessed anywhere in the generic
|
|
65633
65665
|
// type). To determine this we compare instantiations where the type parameter is
|
|
65634
65666
|
// replaced with marker types that are known to be unrelated.
|
|
65635
|
-
if (variance === 3 /* Bivariant */ && isTypeAssignableTo(createMarkerType(
|
|
65667
|
+
if (variance === 3 /* Bivariant */ && isTypeAssignableTo(createMarkerType(symbol, tp, markerOtherType), typeWithSuper)) {
|
|
65636
65668
|
variance = 4 /* Independent */;
|
|
65637
65669
|
}
|
|
65638
65670
|
outofbandVarianceMarkerHandler = oldHandler;
|
|
@@ -65650,17 +65682,23 @@ var ts;
|
|
|
65650
65682
|
var tp = typeParameters_1[_i];
|
|
65651
65683
|
_loop_21(tp);
|
|
65652
65684
|
}
|
|
65653
|
-
|
|
65685
|
+
links.variances = variances;
|
|
65686
|
+
varianceLevel--;
|
|
65687
|
+
// Recursive invocations of getVariancesWorker occur when two or more types circularly reference each
|
|
65688
|
+
// other. In such cases, the nested invocations might observe in-process variance computations, i.e.
|
|
65689
|
+
// cases where getVariancesWorker returns emptyArray, and thus might compute incomplete variances. For
|
|
65690
|
+
// this reason we clear (and thus re-compute) the results of nested variance computations and only
|
|
65691
|
+
// permanently record the outermost result. See #44572.
|
|
65692
|
+
if (varianceLevel === 0 && nestedVarianceSymbols) {
|
|
65693
|
+
for (var _a = 0, nestedVarianceSymbols_1 = nestedVarianceSymbols; _a < nestedVarianceSymbols_1.length; _a++) {
|
|
65694
|
+
var sym = nestedVarianceSymbols_1[_a];
|
|
65695
|
+
getSymbolLinks(sym).variances = undefined;
|
|
65696
|
+
}
|
|
65697
|
+
nestedVarianceSymbols = undefined;
|
|
65698
|
+
}
|
|
65654
65699
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
65655
65700
|
}
|
|
65656
|
-
return variances;
|
|
65657
|
-
}
|
|
65658
|
-
function getVariances(type) {
|
|
65659
|
-
// Arrays and tuples are known to be covariant, no need to spend time computing this.
|
|
65660
|
-
if (type === globalArrayType || type === globalReadonlyArrayType || type.objectFlags & 8 /* Tuple */) {
|
|
65661
|
-
return arrayVariances;
|
|
65662
|
-
}
|
|
65663
|
-
return getVariancesWorker(type.typeParameters, type, getMarkerTypeReference);
|
|
65701
|
+
return links.variances;
|
|
65664
65702
|
}
|
|
65665
65703
|
// Return true if the given type reference has a 'void' type argument for a covariant type parameter.
|
|
65666
65704
|
// See comment at call in recursiveTypeRelatedTo for when this case matters.
|
|
@@ -66031,10 +66069,10 @@ var ts;
|
|
|
66031
66069
|
if (!(ts.getObjectFlags(type) & 4 /* Reference */) || !(ts.getObjectFlags(type.target) & 3 /* ClassOrInterface */)) {
|
|
66032
66070
|
return undefined;
|
|
66033
66071
|
}
|
|
66034
|
-
if (ts.getObjectFlags(type) &
|
|
66035
|
-
return ts.getObjectFlags(type) &
|
|
66072
|
+
if (ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeCalculated */) {
|
|
66073
|
+
return ts.getObjectFlags(type) & 134217728 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
|
|
66036
66074
|
}
|
|
66037
|
-
type.objectFlags |=
|
|
66075
|
+
type.objectFlags |= 67108864 /* IdenticalBaseTypeCalculated */;
|
|
66038
66076
|
var target = type.target;
|
|
66039
66077
|
if (ts.getObjectFlags(target) & 1 /* Class */) {
|
|
66040
66078
|
var baseTypeNode = getBaseTypeNodeOfClass(target);
|
|
@@ -66055,7 +66093,7 @@ var ts;
|
|
|
66055
66093
|
if (ts.length(getTypeArguments(type)) > ts.length(target.typeParameters)) {
|
|
66056
66094
|
instantiatedBase = getTypeWithThisArgument(instantiatedBase, ts.last(getTypeArguments(type)));
|
|
66057
66095
|
}
|
|
66058
|
-
type.objectFlags |=
|
|
66096
|
+
type.objectFlags |= 134217728 /* IdenticalBaseTypeExists */;
|
|
66059
66097
|
return type.cachedEquivalentBaseType = instantiatedBase;
|
|
66060
66098
|
}
|
|
66061
66099
|
function isEmptyLiteralType(type) {
|
|
@@ -66719,7 +66757,7 @@ var ts;
|
|
|
66719
66757
|
var result = !!(type.flags & 465829888 /* Instantiable */ ||
|
|
66720
66758
|
type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || ts.forEach(getTypeArguments(type), couldContainTypeVariables)) ||
|
|
66721
66759
|
objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
|
|
66722
|
-
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */)) ||
|
|
66760
|
+
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */ | 16777216 /* InstantiationExpressionType */)) ||
|
|
66723
66761
|
type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && ts.some(type.types, couldContainTypeVariables));
|
|
66724
66762
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
66725
66763
|
type.objectFlags |= 1048576 /* CouldContainTypeVariablesComputed */ | (result ? 2097152 /* CouldContainTypeVariables */ : 0);
|
|
@@ -67636,8 +67674,8 @@ var ts;
|
|
|
67636
67674
|
var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* Mapped */) ? 8 /* HomomorphicMappedType */ : 0;
|
|
67637
67675
|
var indexInfos = getIndexInfosOfType(target);
|
|
67638
67676
|
if (isObjectTypeWithInferableIndex(source)) {
|
|
67639
|
-
for (var _i = 0,
|
|
67640
|
-
var targetInfo =
|
|
67677
|
+
for (var _i = 0, indexInfos_6 = indexInfos; _i < indexInfos_6.length; _i++) {
|
|
67678
|
+
var targetInfo = indexInfos_6[_i];
|
|
67641
67679
|
var propTypes = [];
|
|
67642
67680
|
for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
|
|
67643
67681
|
var prop = _b[_a];
|
|
@@ -67657,8 +67695,8 @@ var ts;
|
|
|
67657
67695
|
}
|
|
67658
67696
|
}
|
|
67659
67697
|
}
|
|
67660
|
-
for (var _e = 0,
|
|
67661
|
-
var targetInfo =
|
|
67698
|
+
for (var _e = 0, indexInfos_7 = indexInfos; _e < indexInfos_7.length; _e++) {
|
|
67699
|
+
var targetInfo = indexInfos_7[_e];
|
|
67662
67700
|
var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType);
|
|
67663
67701
|
if (sourceInfo) {
|
|
67664
67702
|
inferWithPriority(sourceInfo.type, targetInfo.type, priority);
|
|
@@ -70056,7 +70094,7 @@ var ts;
|
|
|
70056
70094
|
var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
|
|
70057
70095
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
70058
70096
|
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
70059
|
-
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */
|
|
70097
|
+
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
|
|
70060
70098
|
}
|
|
70061
70099
|
function isExportOrExportExpression(location) {
|
|
70062
70100
|
return !!ts.findAncestor(location, function (n) {
|
|
@@ -70128,6 +70166,9 @@ var ts;
|
|
|
70128
70166
|
if (parentType && parentType.flags & 1048576 /* Union */ && !(parent.kind === 163 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
70129
70167
|
var pattern = declaration.parent;
|
|
70130
70168
|
var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode);
|
|
70169
|
+
if (narrowedType.flags & 131072 /* Never */) {
|
|
70170
|
+
return neverType;
|
|
70171
|
+
}
|
|
70131
70172
|
return getBindingElementTypeFromParentType(declaration, narrowedType);
|
|
70132
70173
|
}
|
|
70133
70174
|
}
|
|
@@ -71558,6 +71599,8 @@ var ts;
|
|
|
71558
71599
|
}
|
|
71559
71600
|
case 229 /* NonNullExpression */:
|
|
71560
71601
|
return getContextualType(parent, contextFlags);
|
|
71602
|
+
case 270 /* ExportAssignment */:
|
|
71603
|
+
return tryGetTypeFromEffectiveTypeNode(parent);
|
|
71561
71604
|
case 287 /* JsxExpression */:
|
|
71562
71605
|
return getContextualTypeForJsxExpression(parent);
|
|
71563
71606
|
case 284 /* JsxAttribute */:
|
|
@@ -73203,6 +73246,9 @@ var ts;
|
|
|
73203
73246
|
if (compilerOptions.noPropertyAccessFromIndexSignature && ts.isPropertyAccessExpression(node)) {
|
|
73204
73247
|
error(right, ts.Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, ts.unescapeLeadingUnderscores(right.escapedText));
|
|
73205
73248
|
}
|
|
73249
|
+
if (indexInfo.declaration && ts.getCombinedNodeFlags(indexInfo.declaration) & 134217728 /* Deprecated */) {
|
|
73250
|
+
addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
|
|
73251
|
+
}
|
|
73206
73252
|
}
|
|
73207
73253
|
else {
|
|
73208
73254
|
if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
|
|
@@ -75819,6 +75865,72 @@ var ts;
|
|
|
75819
75865
|
return node.flags & 32 /* OptionalChain */ ? checkNonNullChain(node) :
|
|
75820
75866
|
getNonNullableType(checkExpression(node.expression));
|
|
75821
75867
|
}
|
|
75868
|
+
function checkExpressionWithTypeArguments(node) {
|
|
75869
|
+
checkGrammarExpressionWithTypeArguments(node);
|
|
75870
|
+
var exprType = node.kind === 227 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) :
|
|
75871
|
+
ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) :
|
|
75872
|
+
checkExpression(node.exprName);
|
|
75873
|
+
var typeArguments = node.typeArguments;
|
|
75874
|
+
if (exprType === silentNeverType || isErrorType(exprType) || !ts.some(typeArguments)) {
|
|
75875
|
+
return exprType;
|
|
75876
|
+
}
|
|
75877
|
+
var hasSomeApplicableSignature = false;
|
|
75878
|
+
var nonApplicableType;
|
|
75879
|
+
var result = getInstantiatedType(exprType);
|
|
75880
|
+
var errorType = hasSomeApplicableSignature ? nonApplicableType : exprType;
|
|
75881
|
+
if (errorType) {
|
|
75882
|
+
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)));
|
|
75883
|
+
}
|
|
75884
|
+
return result;
|
|
75885
|
+
function getInstantiatedType(type) {
|
|
75886
|
+
var hasSignatures = false;
|
|
75887
|
+
var hasApplicableSignature = false;
|
|
75888
|
+
var result = getInstantiatedTypePart(type);
|
|
75889
|
+
hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
|
|
75890
|
+
if (hasSignatures && !hasApplicableSignature) {
|
|
75891
|
+
nonApplicableType !== null && nonApplicableType !== void 0 ? nonApplicableType : (nonApplicableType = type);
|
|
75892
|
+
}
|
|
75893
|
+
return result;
|
|
75894
|
+
function getInstantiatedTypePart(type) {
|
|
75895
|
+
if (type.flags & 524288 /* Object */) {
|
|
75896
|
+
var resolved = resolveStructuredTypeMembers(type);
|
|
75897
|
+
var callSignatures = getInstantiatedSignatures(resolved.callSignatures);
|
|
75898
|
+
var constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
|
|
75899
|
+
hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
|
|
75900
|
+
hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
|
|
75901
|
+
if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
|
|
75902
|
+
var result_11 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
|
|
75903
|
+
result_11.objectFlags |= 16777216 /* InstantiationExpressionType */;
|
|
75904
|
+
result_11.node = node;
|
|
75905
|
+
return result_11;
|
|
75906
|
+
}
|
|
75907
|
+
}
|
|
75908
|
+
else if (type.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
75909
|
+
var constraint = getBaseConstraintOfType(type);
|
|
75910
|
+
if (constraint) {
|
|
75911
|
+
var instantiated = getInstantiatedTypePart(constraint);
|
|
75912
|
+
if (instantiated !== constraint) {
|
|
75913
|
+
return instantiated;
|
|
75914
|
+
}
|
|
75915
|
+
}
|
|
75916
|
+
}
|
|
75917
|
+
else if (type.flags & 1048576 /* Union */) {
|
|
75918
|
+
return mapType(type, getInstantiatedType);
|
|
75919
|
+
}
|
|
75920
|
+
else if (type.flags & 2097152 /* Intersection */) {
|
|
75921
|
+
return getIntersectionType(ts.sameMap(type.types, getInstantiatedTypePart));
|
|
75922
|
+
}
|
|
75923
|
+
return type;
|
|
75924
|
+
}
|
|
75925
|
+
}
|
|
75926
|
+
function getInstantiatedSignatures(signatures) {
|
|
75927
|
+
var applicableSignatures = ts.filter(signatures, function (sig) { return !!sig.typeParameters && hasCorrectTypeArgumentArity(sig, typeArguments); });
|
|
75928
|
+
return ts.sameMap(applicableSignatures, function (sig) {
|
|
75929
|
+
var typeArgumentTypes = checkTypeArguments(sig, typeArguments, /*reportErrors*/ true);
|
|
75930
|
+
return typeArgumentTypes ? getSignatureInstantiation(sig, typeArgumentTypes, ts.isInJSFile(sig.declaration)) : sig;
|
|
75931
|
+
});
|
|
75932
|
+
}
|
|
75933
|
+
}
|
|
75822
75934
|
function checkMetaProperty(node) {
|
|
75823
75935
|
checkGrammarMetaProperty(node);
|
|
75824
75936
|
if (node.keywordToken === 103 /* NewKeyword */) {
|
|
@@ -77308,7 +77420,7 @@ var ts;
|
|
|
77308
77420
|
if (operator === 55 /* AmpersandAmpersandToken */ || operator === 56 /* BarBarToken */ || operator === 60 /* QuestionQuestionToken */) {
|
|
77309
77421
|
if (operator === 55 /* AmpersandAmpersandToken */) {
|
|
77310
77422
|
var parent = ts.walkUpParenthesizedExpressions(node.parent);
|
|
77311
|
-
checkTestingKnownTruthyCallableOrAwaitableType(node.left,
|
|
77423
|
+
checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
|
|
77312
77424
|
}
|
|
77313
77425
|
checkTruthinessOfType(leftType, node.left);
|
|
77314
77426
|
}
|
|
@@ -77815,8 +77927,8 @@ var ts;
|
|
|
77815
77927
|
return type;
|
|
77816
77928
|
}
|
|
77817
77929
|
function checkConditionalExpression(node, checkMode) {
|
|
77818
|
-
|
|
77819
|
-
checkTestingKnownTruthyCallableOrAwaitableType(node.condition,
|
|
77930
|
+
checkTruthinessExpression(node.condition);
|
|
77931
|
+
checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue);
|
|
77820
77932
|
var type1 = checkExpression(node.whenTrue, checkMode);
|
|
77821
77933
|
var type2 = checkExpression(node.whenFalse, checkMode);
|
|
77822
77934
|
return getUnionType([type1, type2], 2 /* Subtype */);
|
|
@@ -78335,6 +78447,8 @@ var ts;
|
|
|
78335
78447
|
return checkAssertion(node);
|
|
78336
78448
|
case 229 /* NonNullExpression */:
|
|
78337
78449
|
return checkNonNullAssertion(node);
|
|
78450
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
78451
|
+
return checkExpressionWithTypeArguments(node);
|
|
78338
78452
|
case 230 /* MetaProperty */:
|
|
78339
78453
|
return checkMetaProperty(node);
|
|
78340
78454
|
case 214 /* DeleteExpression */:
|
|
@@ -79538,12 +79652,12 @@ var ts;
|
|
|
79538
79652
|
case 264 /* ImportEqualsDeclaration */:
|
|
79539
79653
|
case 267 /* NamespaceImport */:
|
|
79540
79654
|
case 266 /* ImportClause */:
|
|
79541
|
-
var
|
|
79655
|
+
var result_12 = 0 /* None */;
|
|
79542
79656
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
79543
79657
|
ts.forEach(target.declarations, function (d) {
|
|
79544
|
-
|
|
79658
|
+
result_12 |= getDeclarationSpaces(d);
|
|
79545
79659
|
});
|
|
79546
|
-
return
|
|
79660
|
+
return result_12;
|
|
79547
79661
|
case 253 /* VariableDeclaration */:
|
|
79548
79662
|
case 202 /* BindingElement */:
|
|
79549
79663
|
case 255 /* FunctionDeclaration */:
|
|
@@ -80970,50 +81084,59 @@ var ts;
|
|
|
80970
81084
|
function checkIfStatement(node) {
|
|
80971
81085
|
// Grammar checking
|
|
80972
81086
|
checkGrammarStatementInAmbientContext(node);
|
|
80973
|
-
|
|
80974
|
-
checkTestingKnownTruthyCallableOrAwaitableType(node.expression,
|
|
81087
|
+
checkTruthinessExpression(node.expression);
|
|
81088
|
+
checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement);
|
|
80975
81089
|
checkSourceElement(node.thenStatement);
|
|
80976
81090
|
if (node.thenStatement.kind === 235 /* EmptyStatement */) {
|
|
80977
81091
|
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
|
|
80978
81092
|
}
|
|
80979
81093
|
checkSourceElement(node.elseStatement);
|
|
80980
81094
|
}
|
|
80981
|
-
function checkTestingKnownTruthyCallableOrAwaitableType(condExpr,
|
|
81095
|
+
function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) {
|
|
80982
81096
|
if (!strictNullChecks)
|
|
80983
81097
|
return;
|
|
80984
|
-
|
|
80985
|
-
|
|
80986
|
-
|
|
80987
|
-
|
|
80988
|
-
|
|
80989
|
-
|
|
80990
|
-
|
|
80991
|
-
|
|
80992
|
-
|
|
80993
|
-
|
|
80994
|
-
|
|
80995
|
-
|
|
80996
|
-
|
|
80997
|
-
|
|
80998
|
-
|
|
80999
|
-
|
|
81000
|
-
|
|
81001
|
-
|
|
81002
|
-
|
|
81003
|
-
|
|
81004
|
-
|
|
81005
|
-
|
|
81006
|
-
|
|
81007
|
-
}
|
|
81008
|
-
var isUsed = testedSymbol && ts.isBinaryExpression(condExpr.parent) && isSymbolUsedInBinaryExpressionChain(condExpr.parent, testedSymbol)
|
|
81009
|
-
|| testedSymbol && body && isSymbolUsedInConditionBody(condExpr, body, testedNode, testedSymbol);
|
|
81010
|
-
if (!isUsed) {
|
|
81011
|
-
if (isPromise) {
|
|
81012
|
-
errorAndMaybeSuggestAwait(location,
|
|
81013
|
-
/*maybeMissingAwait*/ true, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined, getTypeNameForErrorDisplay(type));
|
|
81098
|
+
helper(condExpr, body);
|
|
81099
|
+
while (ts.isBinaryExpression(condExpr) && condExpr.operatorToken.kind === 56 /* BarBarToken */) {
|
|
81100
|
+
condExpr = condExpr.left;
|
|
81101
|
+
helper(condExpr, body);
|
|
81102
|
+
}
|
|
81103
|
+
function helper(condExpr, body) {
|
|
81104
|
+
var location = ts.isBinaryExpression(condExpr) &&
|
|
81105
|
+
(condExpr.operatorToken.kind === 56 /* BarBarToken */ || condExpr.operatorToken.kind === 55 /* AmpersandAmpersandToken */)
|
|
81106
|
+
? condExpr.right
|
|
81107
|
+
: condExpr;
|
|
81108
|
+
var type = checkTruthinessExpression(location);
|
|
81109
|
+
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
81110
|
+
if (getFalsyFlags(type) || isPropertyExpressionCast)
|
|
81111
|
+
return;
|
|
81112
|
+
// While it technically should be invalid for any known-truthy value
|
|
81113
|
+
// to be tested, we de-scope to functions and Promises unreferenced in
|
|
81114
|
+
// the block as a heuristic to identify the most common bugs. There
|
|
81115
|
+
// are too many false positives for values sourced from type
|
|
81116
|
+
// definitions without strictNullChecks otherwise.
|
|
81117
|
+
var callSignatures = getSignaturesOfType(type, 0 /* Call */);
|
|
81118
|
+
var isPromise = !!getAwaitedTypeOfPromise(type);
|
|
81119
|
+
if (callSignatures.length === 0 && !isPromise) {
|
|
81120
|
+
return;
|
|
81014
81121
|
}
|
|
81015
|
-
|
|
81016
|
-
|
|
81122
|
+
var testedNode = ts.isIdentifier(location) ? location
|
|
81123
|
+
: ts.isPropertyAccessExpression(location) ? location.name
|
|
81124
|
+
: ts.isBinaryExpression(location) && ts.isIdentifier(location.right) ? location.right
|
|
81125
|
+
: undefined;
|
|
81126
|
+
var testedSymbol = testedNode && getSymbolAtLocation(testedNode);
|
|
81127
|
+
if (!testedSymbol && !isPromise) {
|
|
81128
|
+
return;
|
|
81129
|
+
}
|
|
81130
|
+
var isUsed = testedSymbol && ts.isBinaryExpression(condExpr.parent) && isSymbolUsedInBinaryExpressionChain(condExpr.parent, testedSymbol)
|
|
81131
|
+
|| testedSymbol && body && isSymbolUsedInConditionBody(condExpr, body, testedNode, testedSymbol);
|
|
81132
|
+
if (!isUsed) {
|
|
81133
|
+
if (isPromise) {
|
|
81134
|
+
errorAndMaybeSuggestAwait(location,
|
|
81135
|
+
/*maybeMissingAwait*/ true, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined, getTypeNameForErrorDisplay(type));
|
|
81136
|
+
}
|
|
81137
|
+
else {
|
|
81138
|
+
error(location, ts.Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead);
|
|
81139
|
+
}
|
|
81017
81140
|
}
|
|
81018
81141
|
}
|
|
81019
81142
|
}
|
|
@@ -82102,8 +82225,8 @@ var ts;
|
|
|
82102
82225
|
}
|
|
82103
82226
|
}
|
|
82104
82227
|
if (indexInfos.length > 1) {
|
|
82105
|
-
for (var _d = 0,
|
|
82106
|
-
var info =
|
|
82228
|
+
for (var _d = 0, indexInfos_8 = indexInfos; _d < indexInfos_8.length; _d++) {
|
|
82229
|
+
var info = indexInfos_8[_d];
|
|
82107
82230
|
checkIndexConstraintForIndexSignature(type, info);
|
|
82108
82231
|
}
|
|
82109
82232
|
}
|
|
@@ -82129,8 +82252,8 @@ var ts;
|
|
|
82129
82252
|
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));
|
|
82130
82253
|
}
|
|
82131
82254
|
};
|
|
82132
|
-
for (var _i = 0,
|
|
82133
|
-
var info =
|
|
82255
|
+
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
82256
|
+
var info = indexInfos_9[_i];
|
|
82134
82257
|
_loop_27(info);
|
|
82135
82258
|
}
|
|
82136
82259
|
}
|
|
@@ -82152,8 +82275,8 @@ var ts;
|
|
|
82152
82275
|
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));
|
|
82153
82276
|
}
|
|
82154
82277
|
};
|
|
82155
|
-
for (var _i = 0,
|
|
82156
|
-
var info =
|
|
82278
|
+
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
82279
|
+
var info = indexInfos_10[_i];
|
|
82157
82280
|
_loop_28(info);
|
|
82158
82281
|
}
|
|
82159
82282
|
}
|
|
@@ -82202,9 +82325,9 @@ var ts;
|
|
|
82202
82325
|
var containsArguments = containsArgumentsReference(node);
|
|
82203
82326
|
if (containsArguments) {
|
|
82204
82327
|
var lastJSDocParam = ts.lastOrUndefined(jsdocParameters);
|
|
82205
|
-
if (lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
82328
|
+
if (isJs && lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
82206
82329
|
lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
82207
|
-
|
|
82330
|
+
error(lastJSDocParam.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(lastJSDocParam.name));
|
|
82208
82331
|
}
|
|
82209
82332
|
}
|
|
82210
82333
|
else {
|
|
@@ -82214,7 +82337,9 @@ var ts;
|
|
|
82214
82337
|
return;
|
|
82215
82338
|
}
|
|
82216
82339
|
if (ts.isQualifiedName(name)) {
|
|
82217
|
-
|
|
82340
|
+
if (isJs) {
|
|
82341
|
+
error(name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
|
|
82342
|
+
}
|
|
82218
82343
|
}
|
|
82219
82344
|
else {
|
|
82220
82345
|
errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
|
|
@@ -83807,10 +83932,10 @@ var ts;
|
|
|
83807
83932
|
}
|
|
83808
83933
|
// ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries.
|
|
83809
83934
|
// (TS Exceptions: namespaces, function overloads, enums, and interfaces)
|
|
83810
|
-
if (flags & (1920 /* Namespace */ |
|
|
83935
|
+
if (flags & (1920 /* Namespace */ | 384 /* Enum */)) {
|
|
83811
83936
|
return;
|
|
83812
83937
|
}
|
|
83813
|
-
var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverloadAndNotAccessor);
|
|
83938
|
+
var exportedDeclarationsCount = ts.countWhere(declarations, ts.and(isNotOverloadAndNotAccessor, ts.not(ts.isInterfaceDeclaration)));
|
|
83814
83939
|
if (flags & 524288 /* TypeAlias */ && exportedDeclarationsCount <= 2) {
|
|
83815
83940
|
// it is legal to merge type alias with other values
|
|
83816
83941
|
// so count should be either 1 (just type alias) or 2 (type alias + merged value)
|
|
@@ -87786,7 +87911,7 @@ var ts;
|
|
|
87786
87911
|
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));
|
|
87787
87912
|
case 180 /* TypeQuery */:
|
|
87788
87913
|
ts.Debug.type(node);
|
|
87789
|
-
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName));
|
|
87914
|
+
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
|
|
87790
87915
|
case 181 /* TypeLiteral */:
|
|
87791
87916
|
ts.Debug.type(node);
|
|
87792
87917
|
return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
|
|
@@ -90678,8 +90803,8 @@ var ts;
|
|
|
90678
90803
|
function generateClassElementDecorationExpressions(node, isStatic) {
|
|
90679
90804
|
var members = getDecoratedClassElements(node, isStatic);
|
|
90680
90805
|
var expressions;
|
|
90681
|
-
for (var _i = 0,
|
|
90682
|
-
var member =
|
|
90806
|
+
for (var _i = 0, members_8 = members; _i < members_8.length; _i++) {
|
|
90807
|
+
var member = members_8[_i];
|
|
90683
90808
|
var expression = generateClassElementDecorationExpression(node, member);
|
|
90684
90809
|
if (expression) {
|
|
90685
90810
|
if (!expressions) {
|
|
@@ -91539,9 +91664,13 @@ var ts;
|
|
|
91539
91664
|
}
|
|
91540
91665
|
}
|
|
91541
91666
|
function visitVariableDeclaration(node) {
|
|
91542
|
-
|
|
91667
|
+
var updated = factory.updateVariableDeclaration(node, ts.visitNode(node.name, visitor, ts.isBindingName),
|
|
91543
91668
|
/*exclamationToken*/ undefined,
|
|
91544
91669
|
/*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
|
|
91670
|
+
if (node.type) {
|
|
91671
|
+
ts.setTypeNode(updated.name, node.type);
|
|
91672
|
+
}
|
|
91673
|
+
return updated;
|
|
91545
91674
|
}
|
|
91546
91675
|
function visitParenthesizedExpression(node) {
|
|
91547
91676
|
var innerExpression = ts.skipOuterExpressions(node.expression, ~6 /* Assertions */);
|
|
@@ -96024,8 +96153,8 @@ var ts;
|
|
|
96024
96153
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
96025
96154
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
96026
96155
|
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
96027
|
-
var
|
|
96028
|
-
return
|
|
96156
|
+
var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
96157
|
+
return result_13 && factory.createPropertyAssignment("children", result_13);
|
|
96029
96158
|
}
|
|
96030
96159
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
96031
96160
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -109663,6 +109792,8 @@ var ts;
|
|
|
109663
109792
|
return emitAsExpression(node);
|
|
109664
109793
|
case 229 /* NonNullExpression */:
|
|
109665
109794
|
return emitNonNullExpression(node);
|
|
109795
|
+
case 227 /* ExpressionWithTypeArguments */:
|
|
109796
|
+
return emitExpressionWithTypeArguments(node);
|
|
109666
109797
|
case 230 /* MetaProperty */:
|
|
109667
109798
|
return emitMetaProperty(node);
|
|
109668
109799
|
case 231 /* SyntheticExpression */:
|
|
@@ -110107,6 +110238,7 @@ var ts;
|
|
|
110107
110238
|
writeKeyword("typeof");
|
|
110108
110239
|
writeSpace();
|
|
110109
110240
|
emit(node.exprName);
|
|
110241
|
+
emitTypeArguments(node, node.typeArguments);
|
|
110110
110242
|
}
|
|
110111
110243
|
function emitTypeLiteral(node) {
|
|
110112
110244
|
writePunctuation("{");
|
|
@@ -110870,10 +111002,11 @@ var ts;
|
|
|
110870
111002
|
// Declarations
|
|
110871
111003
|
//
|
|
110872
111004
|
function emitVariableDeclaration(node) {
|
|
111005
|
+
var _a, _b, _c, _d, _e;
|
|
110873
111006
|
emit(node.name);
|
|
110874
111007
|
emit(node.exclamationToken);
|
|
110875
111008
|
emitTypeAnnotation(node.type);
|
|
110876
|
-
emitInitializer(node.initializer, node.type ? node.
|
|
111009
|
+
emitInitializer(node.initializer, (_e = (_b = (_a = node.type) === null || _a === void 0 ? void 0 : _a.end) !== null && _b !== void 0 ? _b : (_d = (_c = node.name.emitNode) === null || _c === void 0 ? void 0 : _c.typeNode) === null || _d === void 0 ? void 0 : _d.end) !== null && _e !== void 0 ? _e : node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma);
|
|
110877
111010
|
}
|
|
110878
111011
|
function emitVariableDeclarationList(node) {
|
|
110879
111012
|
writeKeyword(ts.isLet(node) ? "let" : ts.isVarConst(node) ? "const" : "var");
|
|
@@ -112855,6 +112988,10 @@ var ts;
|
|
|
112855
112988
|
commentsDisabled = false;
|
|
112856
112989
|
}
|
|
112857
112990
|
emitTrailingCommentsOfNode(node, emitFlags, commentRange.pos, commentRange.end, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd);
|
|
112991
|
+
var typeNode = ts.getTypeNode(node);
|
|
112992
|
+
if (typeNode) {
|
|
112993
|
+
emitTrailingCommentsOfNode(node, emitFlags, typeNode.pos, typeNode.end, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd);
|
|
112994
|
+
}
|
|
112858
112995
|
}
|
|
112859
112996
|
function emitLeadingCommentsOfNode(node, emitFlags, pos, end) {
|
|
112860
112997
|
enterComment();
|
|
@@ -115080,15 +115217,15 @@ var ts;
|
|
|
115080
115217
|
// which per above occurred during the current program creation.
|
|
115081
115218
|
// Since we assume the filesystem does not change during program creation,
|
|
115082
115219
|
// it is safe to reuse resolutions from the earlier call.
|
|
115083
|
-
var
|
|
115220
|
+
var result_14 = [];
|
|
115084
115221
|
var i = 0;
|
|
115085
115222
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
115086
115223
|
var moduleName = moduleNames_1[_i];
|
|
115087
115224
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
115088
115225
|
i++;
|
|
115089
|
-
|
|
115226
|
+
result_14.push(resolvedModule);
|
|
115090
115227
|
}
|
|
115091
|
-
return
|
|
115228
|
+
return result_14;
|
|
115092
115229
|
}
|
|
115093
115230
|
// At this point, we know at least one of the following hold:
|
|
115094
115231
|
// - file has local declarations for ambient modules
|
|
@@ -120206,9 +120343,9 @@ var ts;
|
|
|
120206
120343
|
if (!preferSymlinks) {
|
|
120207
120344
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
120208
120345
|
// so we only need to remove them from the realpath filenames.
|
|
120209
|
-
var
|
|
120210
|
-
if (
|
|
120211
|
-
return
|
|
120346
|
+
var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
120347
|
+
if (result_15)
|
|
120348
|
+
return result_15;
|
|
120212
120349
|
}
|
|
120213
120350
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
120214
120351
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -120228,10 +120365,10 @@ var ts;
|
|
|
120228
120365
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
120229
120366
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
120230
120367
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
120231
|
-
var
|
|
120368
|
+
var result_16 = cb(option, target === referenceRedirect);
|
|
120232
120369
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
120233
|
-
if (
|
|
120234
|
-
return
|
|
120370
|
+
if (result_16)
|
|
120371
|
+
return result_16;
|
|
120235
120372
|
}
|
|
120236
120373
|
});
|
|
120237
120374
|
});
|
|
@@ -124072,7 +124209,7 @@ var ts;
|
|
|
124072
124209
|
case 199 /* ImportType */:
|
|
124073
124210
|
return !node.parent.isTypeOf;
|
|
124074
124211
|
case 227 /* ExpressionWithTypeArguments */:
|
|
124075
|
-
return
|
|
124212
|
+
return ts.isPartOfTypeNode(node.parent);
|
|
124076
124213
|
}
|
|
124077
124214
|
return false;
|
|
124078
124215
|
}
|
|
@@ -126099,14 +126236,15 @@ var ts;
|
|
|
126099
126236
|
: "linkplain";
|
|
126100
126237
|
var parts = [linkPart("{@" + prefix + " ")];
|
|
126101
126238
|
if (!link.name) {
|
|
126102
|
-
if (link.text)
|
|
126239
|
+
if (link.text) {
|
|
126103
126240
|
parts.push(linkTextPart(link.text));
|
|
126241
|
+
}
|
|
126104
126242
|
}
|
|
126105
126243
|
else {
|
|
126106
126244
|
var symbol = checker === null || checker === void 0 ? void 0 : checker.getSymbolAtLocation(link.name);
|
|
126107
126245
|
var suffix = findLinkNameEnd(link.text);
|
|
126108
126246
|
var name = ts.getTextOfNode(link.name) + link.text.slice(0, suffix);
|
|
126109
|
-
var text = link.text.slice(suffix);
|
|
126247
|
+
var text = skipSeparatorFromLinkText(link.text.slice(suffix));
|
|
126110
126248
|
var decl = (symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) || ((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]);
|
|
126111
126249
|
if (decl) {
|
|
126112
126250
|
parts.push(linkNamePart(name, decl));
|
|
@@ -126121,6 +126259,15 @@ var ts;
|
|
|
126121
126259
|
return parts;
|
|
126122
126260
|
}
|
|
126123
126261
|
ts.buildLinkParts = buildLinkParts;
|
|
126262
|
+
function skipSeparatorFromLinkText(text) {
|
|
126263
|
+
var pos = 0;
|
|
126264
|
+
if (text.charCodeAt(pos++) === 124 /* bar */) {
|
|
126265
|
+
while (pos < text.length && text.charCodeAt(pos) === 32 /* space */)
|
|
126266
|
+
pos++;
|
|
126267
|
+
return text.slice(pos);
|
|
126268
|
+
}
|
|
126269
|
+
return text;
|
|
126270
|
+
}
|
|
126124
126271
|
function findLinkNameEnd(text) {
|
|
126125
126272
|
if (text.indexOf("()") === 0)
|
|
126126
126273
|
return 2;
|
|
@@ -129985,7 +130132,7 @@ var ts;
|
|
|
129985
130132
|
completionKind === 3 /* MemberLike */ &&
|
|
129986
130133
|
isClassLikeMemberCompletion(symbol, location)) {
|
|
129987
130134
|
var importAdder = void 0;
|
|
129988
|
-
(_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder);
|
|
130135
|
+
(_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan);
|
|
129989
130136
|
if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) {
|
|
129990
130137
|
hasAction = true;
|
|
129991
130138
|
source = CompletionSource.ClassMemberSnippet;
|
|
@@ -130089,6 +130236,7 @@ var ts;
|
|
|
130089
130236
|
return { insertText: name };
|
|
130090
130237
|
}
|
|
130091
130238
|
var isSnippet;
|
|
130239
|
+
var replacementSpan;
|
|
130092
130240
|
var insertText = name;
|
|
130093
130241
|
var checker = program.getTypeChecker();
|
|
130094
130242
|
var sourceFile = location.getSourceFile();
|
|
@@ -130117,10 +130265,8 @@ var ts;
|
|
|
130117
130265
|
var modifiers = 0 /* None */;
|
|
130118
130266
|
// Whether the suggested member should be abstract.
|
|
130119
130267
|
// e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`.
|
|
130120
|
-
|
|
130121
|
-
|
|
130122
|
-
// However, that is not true for the e.g. `override` modifier, so this check has its limitations.
|
|
130123
|
-
var isAbstract = contextToken && isModifierLike(contextToken) === 126 /* AbstractKeyword */;
|
|
130268
|
+
var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span;
|
|
130269
|
+
var isAbstract = !!(presentModifiers & 128 /* Abstract */);
|
|
130124
130270
|
var completionNodes = [];
|
|
130125
130271
|
ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder,
|
|
130126
130272
|
// `addNewNodeForMemberSymbol` calls this callback function for each new member node
|
|
@@ -130139,22 +130285,18 @@ var ts;
|
|
|
130139
130285
|
&& checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
|
|
130140
130286
|
requiredModifiers |= 16384 /* Override */;
|
|
130141
130287
|
}
|
|
130142
|
-
var presentModifiers = 0 /* None */;
|
|
130143
130288
|
if (!completionNodes.length) {
|
|
130144
|
-
// Omit already present modifiers from the first completion node/signature.
|
|
130145
|
-
if (contextToken) {
|
|
130146
|
-
presentModifiers = getPresentModifiers(contextToken);
|
|
130147
|
-
}
|
|
130148
130289
|
// Keep track of added missing required modifiers and modifiers already present.
|
|
130149
130290
|
// This is needed when we have overloaded signatures,
|
|
130150
130291
|
// so this callback will be called for multiple nodes/signatures,
|
|
130151
130292
|
// and we need to make sure the modifiers are uniform for all nodes/signatures.
|
|
130152
130293
|
modifiers = node.modifierFlagsCache | requiredModifiers | presentModifiers;
|
|
130153
130294
|
}
|
|
130154
|
-
node = ts.factory.updateModifiers(node, modifiers
|
|
130295
|
+
node = ts.factory.updateModifiers(node, modifiers);
|
|
130155
130296
|
completionNodes.push(node);
|
|
130156
130297
|
}, body, 2 /* Property */, isAbstract);
|
|
130157
130298
|
if (completionNodes.length) {
|
|
130299
|
+
replacementSpan = modifiersSpan;
|
|
130158
130300
|
// If we have access to formatting settings, we print the nodes using the emitter,
|
|
130159
130301
|
// and then format the printed text.
|
|
130160
130302
|
if (formatContext) {
|
|
@@ -130177,10 +130319,14 @@ var ts;
|
|
|
130177
130319
|
insertText = printer.printSnippetList(1 /* MultiLine */ | 131072 /* NoTrailingNewLine */, ts.factory.createNodeArray(completionNodes), sourceFile);
|
|
130178
130320
|
}
|
|
130179
130321
|
}
|
|
130180
|
-
return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder };
|
|
130322
|
+
return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder, replacementSpan: replacementSpan };
|
|
130181
130323
|
}
|
|
130182
130324
|
function getPresentModifiers(contextToken) {
|
|
130325
|
+
if (!contextToken) {
|
|
130326
|
+
return { modifiers: 0 /* None */ };
|
|
130327
|
+
}
|
|
130183
130328
|
var modifiers = 0 /* None */;
|
|
130329
|
+
var span;
|
|
130184
130330
|
var contextMod;
|
|
130185
130331
|
/*
|
|
130186
130332
|
Cases supported:
|
|
@@ -130203,11 +130349,13 @@ var ts;
|
|
|
130203
130349
|
*/
|
|
130204
130350
|
if (contextMod = isModifierLike(contextToken)) {
|
|
130205
130351
|
modifiers |= ts.modifierToFlag(contextMod);
|
|
130352
|
+
span = ts.createTextSpanFromNode(contextToken);
|
|
130206
130353
|
}
|
|
130207
130354
|
if (ts.isPropertyDeclaration(contextToken.parent)) {
|
|
130208
130355
|
modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers);
|
|
130356
|
+
span = ts.createTextSpanFromNode(contextToken.parent);
|
|
130209
130357
|
}
|
|
130210
|
-
return modifiers;
|
|
130358
|
+
return { modifiers: modifiers, span: span };
|
|
130211
130359
|
}
|
|
130212
130360
|
function isModifierLike(node) {
|
|
130213
130361
|
if (ts.isModifier(node)) {
|
|
@@ -130697,14 +130845,15 @@ var ts;
|
|
|
130697
130845
|
if (tag.tagName.pos <= position && position <= tag.tagName.end) {
|
|
130698
130846
|
return { kind: 1 /* JsDocTagName */ };
|
|
130699
130847
|
}
|
|
130700
|
-
|
|
130848
|
+
var typeExpression = tryGetTypeExpressionFromTag(tag);
|
|
130849
|
+
if (typeExpression) {
|
|
130701
130850
|
currentToken = ts.getTokenAtPosition(sourceFile, position);
|
|
130702
130851
|
if (!currentToken ||
|
|
130703
130852
|
(!ts.isDeclarationName(currentToken) &&
|
|
130704
130853
|
(currentToken.parent.kind !== 345 /* JSDocPropertyTag */ ||
|
|
130705
130854
|
currentToken.parent.name !== currentToken))) {
|
|
130706
130855
|
// Use as type location if inside tag's type expression
|
|
130707
|
-
insideJsDocTagTypeExpression = isCurrentlyEditingNode(
|
|
130856
|
+
insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression);
|
|
130708
130857
|
}
|
|
130709
130858
|
}
|
|
130710
130859
|
if (!insideJsDocTagTypeExpression && ts.isJSDocParameterTag(tag) && (ts.nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) {
|
|
@@ -130961,10 +131110,19 @@ var ts;
|
|
|
130961
131110
|
case 341 /* JSDocTypeTag */:
|
|
130962
131111
|
case 343 /* JSDocTypedefTag */:
|
|
130963
131112
|
return true;
|
|
131113
|
+
case 342 /* JSDocTemplateTag */:
|
|
131114
|
+
return !!tag.constraint;
|
|
130964
131115
|
default:
|
|
130965
131116
|
return false;
|
|
130966
131117
|
}
|
|
130967
131118
|
}
|
|
131119
|
+
function tryGetTypeExpressionFromTag(tag) {
|
|
131120
|
+
if (isTagWithTypeExpression(tag)) {
|
|
131121
|
+
var typeExpression = ts.isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression;
|
|
131122
|
+
return typeExpression && typeExpression.kind === 307 /* JSDocTypeExpression */ ? typeExpression : undefined;
|
|
131123
|
+
}
|
|
131124
|
+
return undefined;
|
|
131125
|
+
}
|
|
130968
131126
|
function getTypeScriptMemberSymbols() {
|
|
130969
131127
|
// Right of dot member completion list
|
|
130970
131128
|
completionKind = 2 /* PropertyAccess */;
|
|
@@ -134784,6 +134942,9 @@ var ts;
|
|
|
134784
134942
|
// *don’t* include readonly member modifiers.
|
|
134785
134943
|
return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 144 /* ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined);
|
|
134786
134944
|
}
|
|
134945
|
+
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
134946
|
+
return getAllReferencesForImportMeta(sourceFiles, cancellationToken);
|
|
134947
|
+
}
|
|
134787
134948
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
134788
134949
|
return [{ definition: { type: 2 /* Keyword */, node: node }, references: [nodeEntry(node)] }];
|
|
134789
134950
|
}
|
|
@@ -135265,6 +135426,18 @@ var ts;
|
|
|
135265
135426
|
return false;
|
|
135266
135427
|
}
|
|
135267
135428
|
}
|
|
135429
|
+
function getAllReferencesForImportMeta(sourceFiles, cancellationToken) {
|
|
135430
|
+
var references = ts.flatMap(sourceFiles, function (sourceFile) {
|
|
135431
|
+
cancellationToken.throwIfCancellationRequested();
|
|
135432
|
+
return ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "meta", sourceFile), function (node) {
|
|
135433
|
+
var parent = node.parent;
|
|
135434
|
+
if (ts.isImportMeta(parent)) {
|
|
135435
|
+
return nodeEntry(parent);
|
|
135436
|
+
}
|
|
135437
|
+
});
|
|
135438
|
+
});
|
|
135439
|
+
return references.length ? [{ definition: { type: 2 /* Keyword */, node: references[0].node }, references: references }] : undefined;
|
|
135440
|
+
}
|
|
135268
135441
|
function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken, filter) {
|
|
135269
135442
|
var references = ts.flatMap(sourceFiles, function (sourceFile) {
|
|
135270
135443
|
cancellationToken.throwIfCancellationRequested();
|
|
@@ -136977,6 +137150,9 @@ var ts;
|
|
|
136977
137150
|
if (node === sourceFile) {
|
|
136978
137151
|
return undefined;
|
|
136979
137152
|
}
|
|
137153
|
+
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
137154
|
+
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent);
|
|
137155
|
+
}
|
|
136980
137156
|
var symbol = getSymbol(node, typeChecker);
|
|
136981
137157
|
if (!symbol)
|
|
136982
137158
|
return undefined;
|
|
@@ -137347,9 +137523,18 @@ var ts;
|
|
|
137347
137523
|
JsDoc.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations;
|
|
137348
137524
|
function getDisplayPartsFromComment(comment, checker) {
|
|
137349
137525
|
if (typeof comment === "string") {
|
|
137350
|
-
return [ts.textPart(comment)];
|
|
137526
|
+
return [ts.textPart(skipSeparatorFromComment(comment))];
|
|
137527
|
+
}
|
|
137528
|
+
return ts.flatMap(comment, function (node) { return node.kind === 319 /* JSDocText */ ? [ts.textPart(skipSeparatorFromComment(node.text))] : ts.buildLinkParts(node, checker); });
|
|
137529
|
+
}
|
|
137530
|
+
function skipSeparatorFromComment(text) {
|
|
137531
|
+
var pos = 0;
|
|
137532
|
+
if (text.charCodeAt(pos++) === 45 /* minus */) {
|
|
137533
|
+
while (pos < text.length && text.charCodeAt(pos) === 32 /* space */)
|
|
137534
|
+
pos++;
|
|
137535
|
+
return text.slice(pos);
|
|
137351
137536
|
}
|
|
137352
|
-
return
|
|
137537
|
+
return text;
|
|
137353
137538
|
}
|
|
137354
137539
|
function getCommentDisplayParts(tag, checker) {
|
|
137355
137540
|
var comment = tag.comment, kind = tag.kind;
|
|
@@ -139333,6 +139518,8 @@ var ts;
|
|
|
139333
139518
|
return spanForArrowFunction(n);
|
|
139334
139519
|
case 207 /* CallExpression */:
|
|
139335
139520
|
return spanForCallExpression(n);
|
|
139521
|
+
case 211 /* ParenthesizedExpression */:
|
|
139522
|
+
return spanForParenthesizedExpression(n);
|
|
139336
139523
|
}
|
|
139337
139524
|
function spanForCallExpression(node) {
|
|
139338
139525
|
if (!node.arguments.length) {
|
|
@@ -139346,7 +139533,7 @@ var ts;
|
|
|
139346
139533
|
return spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ false, /*useFullStart*/ true);
|
|
139347
139534
|
}
|
|
139348
139535
|
function spanForArrowFunction(node) {
|
|
139349
|
-
if (ts.isBlock(node.body) || ts.positionsAreOnSameLine(node.body.getFullStart(), node.body.getEnd(), sourceFile)) {
|
|
139536
|
+
if (ts.isBlock(node.body) || ts.isParenthesizedExpression(node.body) || ts.positionsAreOnSameLine(node.body.getFullStart(), node.body.getEnd(), sourceFile)) {
|
|
139350
139537
|
return undefined;
|
|
139351
139538
|
}
|
|
139352
139539
|
var textSpan = ts.createTextSpanFromBounds(node.body.getFullStart(), node.body.getEnd());
|
|
@@ -139394,6 +139581,12 @@ var ts;
|
|
|
139394
139581
|
function spanForNodeArray(nodeArray) {
|
|
139395
139582
|
return nodeArray.length ? createOutliningSpan(ts.createTextSpanFromRange(nodeArray), "code" /* Code */) : undefined;
|
|
139396
139583
|
}
|
|
139584
|
+
function spanForParenthesizedExpression(node) {
|
|
139585
|
+
if (ts.positionsAreOnSameLine(node.getStart(), node.getEnd(), sourceFile))
|
|
139586
|
+
return undefined;
|
|
139587
|
+
var textSpan = ts.createTextSpanFromBounds(node.getStart(), node.getEnd());
|
|
139588
|
+
return createOutliningSpan(textSpan, "code" /* Code */, ts.createTextSpanFromNode(node));
|
|
139589
|
+
}
|
|
139397
139590
|
}
|
|
139398
139591
|
function functionSpan(node, body, sourceFile) {
|
|
139399
139592
|
var openToken = tryGetFunctionOpenToken(node, body, sourceFile);
|
|
@@ -154727,7 +154920,7 @@ var ts;
|
|
|
154727
154920
|
/*dotDotDotToken*/ undefined,
|
|
154728
154921
|
/*name*/ names && names[i] || "arg" + i,
|
|
154729
154922
|
/*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined,
|
|
154730
|
-
/*type*/ inJs ? undefined : types && types[i] || ts.factory.createKeywordTypeNode(
|
|
154923
|
+
/*type*/ inJs ? undefined : types && types[i] || ts.factory.createKeywordTypeNode(154 /* UnknownKeyword */),
|
|
154731
154924
|
/*initializer*/ undefined);
|
|
154732
154925
|
parameters.push(newParameter);
|
|
154733
154926
|
}
|
|
@@ -154755,11 +154948,10 @@ var ts;
|
|
|
154755
154948
|
var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.name; });
|
|
154756
154949
|
var parameters = createDummyParameters(maxNonRestArgs, maxArgsParameterSymbolNames, /* types */ undefined, minArgumentCount, /*inJs*/ false);
|
|
154757
154950
|
if (someSigHasRestParameter) {
|
|
154758
|
-
var anyArrayType = ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(130 /* AnyKeyword */));
|
|
154759
154951
|
var restParameter = ts.factory.createParameterDeclaration(
|
|
154760
154952
|
/*decorators*/ undefined,
|
|
154761
154953
|
/*modifiers*/ undefined, ts.factory.createToken(25 /* DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest",
|
|
154762
|
-
/*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined,
|
|
154954
|
+
/*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(154 /* UnknownKeyword */)),
|
|
154763
154955
|
/*initializer*/ undefined);
|
|
154764
154956
|
parameters.push(restParameter);
|
|
154765
154957
|
}
|
|
@@ -157005,7 +157197,7 @@ var ts;
|
|
|
157005
157197
|
// cannot find either start or end node
|
|
157006
157198
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
|
|
157007
157199
|
}
|
|
157008
|
-
if (
|
|
157200
|
+
if (start.flags & 4194304 /* JSDoc */) {
|
|
157009
157201
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractJSDoc)] };
|
|
157010
157202
|
}
|
|
157011
157203
|
if (start.parent !== end.parent) {
|
|
@@ -157128,7 +157320,7 @@ var ts;
|
|
|
157128
157320
|
ts.Debug.assert(nodeToCheck.pos <= nodeToCheck.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (1)");
|
|
157129
157321
|
// For understanding how skipTrivia functioned:
|
|
157130
157322
|
ts.Debug.assert(!ts.positionIsSynthesized(nodeToCheck.pos), "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (2)");
|
|
157131
|
-
if (!ts.isStatement(nodeToCheck) && !(ts.isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck))) {
|
|
157323
|
+
if (!ts.isStatement(nodeToCheck) && !(ts.isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck)) && !isStringLiteralJsxAttribute(nodeToCheck)) {
|
|
157132
157324
|
return [ts.createDiagnosticForNode(nodeToCheck, Messages.statementOrExpressionExpected)];
|
|
157133
157325
|
}
|
|
157134
157326
|
if (nodeToCheck.flags & 8388608 /* Ambient */) {
|
|
@@ -157308,13 +157500,16 @@ var ts;
|
|
|
157308
157500
|
if (ts.isStatement(node)) {
|
|
157309
157501
|
return [node];
|
|
157310
157502
|
}
|
|
157311
|
-
|
|
157503
|
+
if (ts.isExpressionNode(node)) {
|
|
157312
157504
|
// If our selection is the expression in an ExpressionStatement, expand
|
|
157313
157505
|
// the selection to include the enclosing Statement (this stops us
|
|
157314
157506
|
// from trying to care about the return value of the extracted function
|
|
157315
157507
|
// and eliminates double semicolon insertion in certain scenarios)
|
|
157316
157508
|
return ts.isExpressionStatement(node.parent) ? [node.parent] : node;
|
|
157317
157509
|
}
|
|
157510
|
+
if (isStringLiteralJsxAttribute(node)) {
|
|
157511
|
+
return node;
|
|
157512
|
+
}
|
|
157318
157513
|
return undefined;
|
|
157319
157514
|
}
|
|
157320
157515
|
function isScope(node) {
|
|
@@ -158124,7 +158319,7 @@ var ts;
|
|
|
158124
158319
|
// Unfortunately, this code takes advantage of the knowledge that the generated method
|
|
158125
158320
|
// will use the contextual type of an expression as the return type of the extracted
|
|
158126
158321
|
// method (and will therefore "use" all the types involved).
|
|
158127
|
-
if (inGenericContext && !isReadonlyArray(targetRange.range)) {
|
|
158322
|
+
if (inGenericContext && !isReadonlyArray(targetRange.range) && !ts.isJsxAttribute(targetRange.range)) {
|
|
158128
158323
|
var contextualType = checker.getContextualType(targetRange.range); // TODO: GH#18217
|
|
158129
158324
|
recordTypeParameterUsages(contextualType);
|
|
158130
158325
|
}
|
|
@@ -158449,7 +158644,11 @@ var ts;
|
|
|
158449
158644
|
}
|
|
158450
158645
|
}
|
|
158451
158646
|
function isInJSXContent(node) {
|
|
158452
|
-
return (
|
|
158647
|
+
return isStringLiteralJsxAttribute(node) ||
|
|
158648
|
+
(ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node) || ts.isJsxFragment(node)) && (ts.isJsxElement(node.parent) || ts.isJsxFragment(node.parent));
|
|
158649
|
+
}
|
|
158650
|
+
function isStringLiteralJsxAttribute(node) {
|
|
158651
|
+
return ts.isStringLiteral(node) && node.parent && ts.isJsxAttribute(node.parent);
|
|
158453
158652
|
}
|
|
158454
158653
|
})(extractSymbol = refactor.extractSymbol || (refactor.extractSymbol = {}));
|
|
158455
158654
|
})(refactor = ts.refactor || (ts.refactor = {}));
|
|
@@ -160307,7 +160506,7 @@ var ts;
|
|
|
160307
160506
|
var isLastSpan = index === currentNode.templateSpans.length - 1;
|
|
160308
160507
|
var text = span.literal.text + (isLastSpan ? subsequentText : "");
|
|
160309
160508
|
var rawText = getRawTextOfTemplate(span.literal) + (isLastSpan ? rawSubsequentText : "");
|
|
160310
|
-
return ts.factory.createTemplateSpan(span.expression, isLast
|
|
160509
|
+
return ts.factory.createTemplateSpan(span.expression, isLast && isLastSpan
|
|
160311
160510
|
? ts.factory.createTemplateTail(text, rawText)
|
|
160312
160511
|
: ts.factory.createTemplateMiddle(text, rawText));
|
|
160313
160512
|
});
|
|
@@ -162082,6 +162281,9 @@ var ts;
|
|
|
162082
162281
|
if (ts.isNamedTupleMember(node.parent) && node.pos === node.parent.pos) {
|
|
162083
162282
|
return node.parent;
|
|
162084
162283
|
}
|
|
162284
|
+
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
162285
|
+
return node.parent;
|
|
162286
|
+
}
|
|
162085
162287
|
return node;
|
|
162086
162288
|
}
|
|
162087
162289
|
function shouldGetType(sourceFile, node, position) {
|
|
@@ -162097,6 +162299,8 @@ var ts;
|
|
|
162097
162299
|
case 106 /* SuperKeyword */:
|
|
162098
162300
|
case 196 /* NamedTupleMember */:
|
|
162099
162301
|
return true;
|
|
162302
|
+
case 230 /* MetaProperty */:
|
|
162303
|
+
return ts.isImportMeta(node);
|
|
162100
162304
|
default:
|
|
162101
162305
|
return false;
|
|
162102
162306
|
}
|
|
@@ -176956,6 +177160,7 @@ var ts;
|
|
|
176956
177160
|
})(server = ts.server || (ts.server = {}));
|
|
176957
177161
|
})(ts || (ts = {}));
|
|
176958
177162
|
/*@internal*/
|
|
177163
|
+
/// <reference lib="webworker" />
|
|
176959
177164
|
var ts;
|
|
176960
177165
|
(function (ts) {
|
|
176961
177166
|
var server;
|
|
@@ -177037,7 +177242,7 @@ var ts;
|
|
|
177037
177242
|
}
|
|
177038
177243
|
}
|
|
177039
177244
|
function hrtime(previous) {
|
|
177040
|
-
var now = self.performance.now(
|
|
177245
|
+
var now = self.performance.now() * 1e-3;
|
|
177041
177246
|
var seconds = Math.floor(now);
|
|
177042
177247
|
var nanoseconds = Math.floor((now % 1) * 1e9);
|
|
177043
177248
|
if (previous) {
|
|
@@ -177059,7 +177264,7 @@ var ts;
|
|
|
177059
177264
|
WorkerSession.prototype.exit = function () {
|
|
177060
177265
|
this.logger.info("Exiting...");
|
|
177061
177266
|
this.projectService.closeLog();
|
|
177062
|
-
close(
|
|
177267
|
+
close();
|
|
177063
177268
|
};
|
|
177064
177269
|
WorkerSession.prototype.listen = function () {
|
|
177065
177270
|
var _this = this;
|
|
@@ -177090,9 +177295,9 @@ var ts;
|
|
|
177090
177295
|
function getLogLevel(level) {
|
|
177091
177296
|
if (level) {
|
|
177092
177297
|
var l = level.toLowerCase();
|
|
177093
|
-
for (var
|
|
177094
|
-
if (isNaN(+
|
|
177095
|
-
return server.LogLevel[
|
|
177298
|
+
for (var name_1 in server.LogLevel) {
|
|
177299
|
+
if (isNaN(+name_1) && l === name_1.toLowerCase()) {
|
|
177300
|
+
return server.LogLevel[name_1];
|
|
177096
177301
|
}
|
|
177097
177302
|
}
|
|
177098
177303
|
}
|