@typescript-deploys/pr-build 4.6.0-pr-47607-13 → 4.6.0-pr-47550-11
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 +19 -4
- package/lib/de/diagnosticMessages.generated.json +19 -4
- package/lib/es/diagnosticMessages.generated.json +19 -4
- package/lib/fr/diagnosticMessages.generated.json +2 -0
- package/lib/ja/diagnosticMessages.generated.json +2 -0
- package/lib/ko/diagnosticMessages.generated.json +2 -0
- package/lib/lib.dom.d.ts +1 -1
- package/lib/pt-br/diagnosticMessages.generated.json +19 -4
- package/lib/ru/diagnosticMessages.generated.json +2 -0
- package/lib/tsc.js +222 -298
- package/lib/tsserver.js +376 -359
- package/lib/tsserverlibrary.d.ts +7 -7
- package/lib/tsserverlibrary.js +376 -359
- package/lib/typescript.d.ts +7 -7
- package/lib/typescript.js +376 -359
- package/lib/typescriptServices.d.ts +7 -7
- package/lib/typescriptServices.js +376 -359
- package/lib/typingsInstaller.js +263 -327
- package/lib/zh-cn/diagnosticMessages.generated.json +19 -4
- package/lib/zh-tw/diagnosticMessages.generated.json +2 -0
- 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.20220128";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -4918,14 +4918,13 @@ var ts;
|
|
|
4918
4918
|
// Flags that require TypeFlags.Object
|
|
4919
4919
|
ObjectFlags[ObjectFlags["ContainsSpread"] = 4194304] = "ContainsSpread";
|
|
4920
4920
|
ObjectFlags[ObjectFlags["ObjectRestType"] = 8388608] = "ObjectRestType";
|
|
4921
|
-
ObjectFlags[ObjectFlags["InstantiationExpressionType"] = 16777216] = "InstantiationExpressionType";
|
|
4922
4921
|
/* @internal */
|
|
4923
|
-
ObjectFlags[ObjectFlags["IsClassInstanceClone"] =
|
|
4922
|
+
ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
4924
4923
|
// Flags that require TypeFlags.Object and ObjectFlags.Reference
|
|
4925
4924
|
/* @internal */
|
|
4926
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] =
|
|
4925
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
4927
4926
|
/* @internal */
|
|
4928
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] =
|
|
4927
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
|
4929
4928
|
// Flags that require TypeFlags.UnionOrIntersection or TypeFlags.Substitution
|
|
4930
4929
|
/* @internal */
|
|
4931
4930
|
ObjectFlags[ObjectFlags["IsGenericTypeComputed"] = 4194304] = "IsGenericTypeComputed";
|
|
@@ -8531,7 +8530,6 @@ var ts;
|
|
|
8531
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."),
|
|
8532
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"),
|
|
8533
8532
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8534
|
-
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."),
|
|
8535
8533
|
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."),
|
|
8536
8534
|
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."),
|
|
8537
8535
|
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."),
|
|
@@ -9445,9 +9443,8 @@ var ts;
|
|
|
9445
9443
|
Remove_variable_statement: diag(90010, ts.DiagnosticCategory.Message, "Remove_variable_statement_90010", "Remove variable statement"),
|
|
9446
9444
|
Remove_template_tag: diag(90011, ts.DiagnosticCategory.Message, "Remove_template_tag_90011", "Remove template tag"),
|
|
9447
9445
|
Remove_type_parameters: diag(90012, ts.DiagnosticCategory.Message, "Remove_type_parameters_90012", "Remove type parameters"),
|
|
9448
|
-
|
|
9446
|
+
Import_0_from_1: diag(90013, ts.DiagnosticCategory.Message, "Import_0_from_1_90013", "Import '{0}' from \"{1}\""),
|
|
9449
9447
|
Change_0_to_1: diag(90014, ts.DiagnosticCategory.Message, "Change_0_to_1_90014", "Change '{0}' to '{1}'"),
|
|
9450
|
-
Add_0_to_existing_import_declaration_from_1: diag(90015, ts.DiagnosticCategory.Message, "Add_0_to_existing_import_declaration_from_1_90015", "Add '{0}' to existing import declaration from \"{1}\""),
|
|
9451
9448
|
Declare_property_0: diag(90016, ts.DiagnosticCategory.Message, "Declare_property_0_90016", "Declare property '{0}'"),
|
|
9452
9449
|
Add_index_signature_for_property_0: diag(90017, ts.DiagnosticCategory.Message, "Add_index_signature_for_property_0_90017", "Add index signature for property '{0}'"),
|
|
9453
9450
|
Disable_checking_for_this_file: diag(90018, ts.DiagnosticCategory.Message, "Disable_checking_for_this_file_90018", "Disable checking for this file"),
|
|
@@ -9464,8 +9461,6 @@ var ts;
|
|
|
9464
9461
|
Add_async_modifier_to_containing_function: diag(90029, ts.DiagnosticCategory.Message, "Add_async_modifier_to_containing_function_90029", "Add async modifier to containing function"),
|
|
9465
9462
|
Replace_infer_0_with_unknown: diag(90030, ts.DiagnosticCategory.Message, "Replace_infer_0_with_unknown_90030", "Replace 'infer {0}' with 'unknown'"),
|
|
9466
9463
|
Replace_all_unused_infer_with_unknown: diag(90031, ts.DiagnosticCategory.Message, "Replace_all_unused_infer_with_unknown_90031", "Replace all unused 'infer' with 'unknown'"),
|
|
9467
|
-
Import_default_0_from_module_1: diag(90032, ts.DiagnosticCategory.Message, "Import_default_0_from_module_1_90032", "Import default '{0}' from module \"{1}\""),
|
|
9468
|
-
Add_default_import_0_to_existing_import_declaration_from_1: diag(90033, ts.DiagnosticCategory.Message, "Add_default_import_0_to_existing_import_declaration_from_1_90033", "Add default import '{0}' to existing import declaration from \"{1}\""),
|
|
9469
9464
|
Add_parameter_name: diag(90034, ts.DiagnosticCategory.Message, "Add_parameter_name_90034", "Add parameter name"),
|
|
9470
9465
|
Declare_private_property_0: diag(90035, ts.DiagnosticCategory.Message, "Declare_private_property_0_90035", "Declare private property '{0}'"),
|
|
9471
9466
|
Replace_0_with_Promise_1: diag(90036, ts.DiagnosticCategory.Message, "Replace_0_with_Promise_1_90036", "Replace '{0}' with 'Promise<{1}>'"),
|
|
@@ -9477,6 +9472,8 @@ var ts;
|
|
|
9477
9472
|
Includes_imports_of_types_referenced_by_0: diag(90054, ts.DiagnosticCategory.Message, "Includes_imports_of_types_referenced_by_0_90054", "Includes imports of types referenced by '{0}'"),
|
|
9478
9473
|
Remove_type_from_import_declaration_from_0: diag(90055, ts.DiagnosticCategory.Message, "Remove_type_from_import_declaration_from_0_90055", "Remove 'type' from import declaration from \"{0}\""),
|
|
9479
9474
|
Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""),
|
|
9475
|
+
Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""),
|
|
9476
|
+
Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""),
|
|
9480
9477
|
Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
9481
9478
|
Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
9482
9479
|
Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -13417,7 +13414,6 @@ var ts;
|
|
|
13417
13414
|
case 110 /* TrueKeyword */:
|
|
13418
13415
|
case 106 /* SuperKeyword */:
|
|
13419
13416
|
case 229 /* NonNullExpression */:
|
|
13420
|
-
case 227 /* ExpressionWithTypeArguments */:
|
|
13421
13417
|
case 230 /* MetaProperty */:
|
|
13422
13418
|
case 100 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
|
|
13423
13419
|
return true;
|
|
@@ -15119,7 +15115,7 @@ var ts;
|
|
|
15119
15115
|
case 114 /* VoidKeyword */:
|
|
15120
15116
|
return node.parent.kind !== 216 /* VoidExpression */;
|
|
15121
15117
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15122
|
-
return
|
|
15118
|
+
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
|
15123
15119
|
case 162 /* TypeParameter */:
|
|
15124
15120
|
return node.parent.kind === 194 /* MappedType */ || node.parent.kind === 189 /* InferType */;
|
|
15125
15121
|
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
|
@@ -15156,7 +15152,7 @@ var ts;
|
|
|
15156
15152
|
}
|
|
15157
15153
|
switch (parent.kind) {
|
|
15158
15154
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15159
|
-
return
|
|
15155
|
+
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15160
15156
|
case 162 /* TypeParameter */:
|
|
15161
15157
|
return node === parent.constraint;
|
|
15162
15158
|
case 342 /* JSDocTemplateTag */:
|
|
@@ -15859,7 +15855,7 @@ var ts;
|
|
|
15859
15855
|
case 296 /* SpreadAssignment */:
|
|
15860
15856
|
return true;
|
|
15861
15857
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15862
|
-
return parent.expression === node &&
|
|
15858
|
+
return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15863
15859
|
case 295 /* ShorthandPropertyAssignment */:
|
|
15864
15860
|
return parent.objectAssignmentInitializer === node;
|
|
15865
15861
|
default:
|
|
@@ -20876,6 +20872,59 @@ var ts;
|
|
|
20876
20872
|
return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType);
|
|
20877
20873
|
}
|
|
20878
20874
|
ts.isThisTypeParameter = isThisTypeParameter;
|
|
20875
|
+
function getNodeModulePathParts(fullPath) {
|
|
20876
|
+
// If fullPath can't be valid module file within node_modules, returns undefined.
|
|
20877
|
+
// Example of expected pattern: /base/path/node_modules/[@scope/otherpackage/@otherscope/node_modules/]package/[subdirectory/]file.js
|
|
20878
|
+
// Returns indices: ^ ^ ^ ^
|
|
20879
|
+
var topLevelNodeModulesIndex = 0;
|
|
20880
|
+
var topLevelPackageNameIndex = 0;
|
|
20881
|
+
var packageRootIndex = 0;
|
|
20882
|
+
var fileNameIndex = 0;
|
|
20883
|
+
var States;
|
|
20884
|
+
(function (States) {
|
|
20885
|
+
States[States["BeforeNodeModules"] = 0] = "BeforeNodeModules";
|
|
20886
|
+
States[States["NodeModules"] = 1] = "NodeModules";
|
|
20887
|
+
States[States["Scope"] = 2] = "Scope";
|
|
20888
|
+
States[States["PackageContent"] = 3] = "PackageContent";
|
|
20889
|
+
})(States || (States = {}));
|
|
20890
|
+
var partStart = 0;
|
|
20891
|
+
var partEnd = 0;
|
|
20892
|
+
var state = 0 /* BeforeNodeModules */;
|
|
20893
|
+
while (partEnd >= 0) {
|
|
20894
|
+
partStart = partEnd;
|
|
20895
|
+
partEnd = fullPath.indexOf("/", partStart + 1);
|
|
20896
|
+
switch (state) {
|
|
20897
|
+
case 0 /* BeforeNodeModules */:
|
|
20898
|
+
if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
|
|
20899
|
+
topLevelNodeModulesIndex = partStart;
|
|
20900
|
+
topLevelPackageNameIndex = partEnd;
|
|
20901
|
+
state = 1 /* NodeModules */;
|
|
20902
|
+
}
|
|
20903
|
+
break;
|
|
20904
|
+
case 1 /* NodeModules */:
|
|
20905
|
+
case 2 /* Scope */:
|
|
20906
|
+
if (state === 1 /* NodeModules */ && fullPath.charAt(partStart + 1) === "@") {
|
|
20907
|
+
state = 2 /* Scope */;
|
|
20908
|
+
}
|
|
20909
|
+
else {
|
|
20910
|
+
packageRootIndex = partEnd;
|
|
20911
|
+
state = 3 /* PackageContent */;
|
|
20912
|
+
}
|
|
20913
|
+
break;
|
|
20914
|
+
case 3 /* PackageContent */:
|
|
20915
|
+
if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
|
|
20916
|
+
state = 1 /* NodeModules */;
|
|
20917
|
+
}
|
|
20918
|
+
else {
|
|
20919
|
+
state = 3 /* PackageContent */;
|
|
20920
|
+
}
|
|
20921
|
+
break;
|
|
20922
|
+
}
|
|
20923
|
+
}
|
|
20924
|
+
fileNameIndex = partStart;
|
|
20925
|
+
return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
|
|
20926
|
+
}
|
|
20927
|
+
ts.getNodeModulePathParts = getNodeModulePathParts;
|
|
20879
20928
|
})(ts || (ts = {}));
|
|
20880
20929
|
/* @internal */
|
|
20881
20930
|
var ts;
|
|
@@ -22793,18 +22842,16 @@ var ts;
|
|
|
22793
22842
|
return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type);
|
|
22794
22843
|
}
|
|
22795
22844
|
// @api
|
|
22796
|
-
function createTypeQueryNode(exprName
|
|
22845
|
+
function createTypeQueryNode(exprName) {
|
|
22797
22846
|
var node = createBaseNode(180 /* TypeQuery */);
|
|
22798
22847
|
node.exprName = exprName;
|
|
22799
|
-
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
22800
22848
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
22801
22849
|
return node;
|
|
22802
22850
|
}
|
|
22803
22851
|
// @api
|
|
22804
|
-
function updateTypeQueryNode(node, exprName
|
|
22852
|
+
function updateTypeQueryNode(node, exprName) {
|
|
22805
22853
|
return node.exprName !== exprName
|
|
22806
|
-
|
|
22807
|
-
? update(createTypeQueryNode(exprName, typeArguments), node)
|
|
22854
|
+
? update(createTypeQueryNode(exprName), node)
|
|
22808
22855
|
: node;
|
|
22809
22856
|
}
|
|
22810
22857
|
// @api
|
|
@@ -29920,8 +29967,7 @@ var ts;
|
|
|
29920
29967
|
visitNode(cbNode, node.parameterName) ||
|
|
29921
29968
|
visitNode(cbNode, node.type);
|
|
29922
29969
|
case 180 /* TypeQuery */:
|
|
29923
|
-
return visitNode(cbNode, node.exprName)
|
|
29924
|
-
visitNodes(cbNode, cbNodes, node.typeArguments);
|
|
29970
|
+
return visitNode(cbNode, node.exprName);
|
|
29925
29971
|
case 181 /* TypeLiteral */:
|
|
29926
29972
|
return visitNodes(cbNode, cbNodes, node.members);
|
|
29927
29973
|
case 182 /* ArrayType */:
|
|
@@ -32454,9 +32500,7 @@ var ts;
|
|
|
32454
32500
|
function parseTypeQuery() {
|
|
32455
32501
|
var pos = getNodePos();
|
|
32456
32502
|
parseExpected(112 /* TypeOfKeyword */);
|
|
32457
|
-
|
|
32458
|
-
var typeArguments = tryParseTypeArguments();
|
|
32459
|
-
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
32503
|
+
return finishNode(factory.createTypeQueryNode(parseEntityName(/*allowReservedWords*/ true)), pos);
|
|
32460
32504
|
}
|
|
32461
32505
|
function parseTypeParameter() {
|
|
32462
32506
|
var pos = getNodePos();
|
|
@@ -33395,7 +33439,7 @@ var ts;
|
|
|
33395
33439
|
function parseInitializer() {
|
|
33396
33440
|
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
33397
33441
|
}
|
|
33398
|
-
function parseAssignmentExpressionOrHigher() {
|
|
33442
|
+
function parseAssignmentExpressionOrHigher(parsingConditionalExpression) {
|
|
33399
33443
|
// AssignmentExpression[in,yield]:
|
|
33400
33444
|
// 1) ConditionalExpression[?in,?yield]
|
|
33401
33445
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -33421,7 +33465,7 @@ var ts;
|
|
|
33421
33465
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
33422
33466
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
33423
33467
|
// with AssignmentExpression if we see one.
|
|
33424
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
33468
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(parsingConditionalExpression) || tryParseAsyncSimpleArrowFunctionExpression(parsingConditionalExpression);
|
|
33425
33469
|
if (arrowExpression) {
|
|
33426
33470
|
return arrowExpression;
|
|
33427
33471
|
}
|
|
@@ -33440,7 +33484,7 @@ var ts;
|
|
|
33440
33484
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
33441
33485
|
// identifier and the current token is an arrow.
|
|
33442
33486
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
33443
|
-
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
33487
|
+
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined, parsingConditionalExpression);
|
|
33444
33488
|
}
|
|
33445
33489
|
// Now see if we might be in cases '2' or '3'.
|
|
33446
33490
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -33449,7 +33493,7 @@ var ts;
|
|
|
33449
33493
|
// Note: we call reScanGreaterToken so that we get an appropriately merged token
|
|
33450
33494
|
// for cases like `> > =` becoming `>>=`
|
|
33451
33495
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
33452
|
-
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
33496
|
+
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(parsingConditionalExpression), pos);
|
|
33453
33497
|
}
|
|
33454
33498
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
33455
33499
|
return parseConditionalExpressionRest(expr, pos);
|
|
@@ -33500,7 +33544,7 @@ var ts;
|
|
|
33500
33544
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
33501
33545
|
}
|
|
33502
33546
|
}
|
|
33503
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
33547
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier, parsingConditionalExpression) {
|
|
33504
33548
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
33505
33549
|
var parameter = factory.createParameterDeclaration(
|
|
33506
33550
|
/*decorators*/ undefined,
|
|
@@ -33512,11 +33556,11 @@ var ts;
|
|
|
33512
33556
|
finishNode(parameter, identifier.pos);
|
|
33513
33557
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
33514
33558
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
33515
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
33559
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, parsingConditionalExpression);
|
|
33516
33560
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
33517
33561
|
return addJSDocComment(finishNode(node, pos));
|
|
33518
33562
|
}
|
|
33519
|
-
function tryParseParenthesizedArrowFunctionExpression() {
|
|
33563
|
+
function tryParseParenthesizedArrowFunctionExpression(parsingConditionalExpression) {
|
|
33520
33564
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
33521
33565
|
if (triState === 0 /* False */) {
|
|
33522
33566
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -33527,8 +33571,8 @@ var ts;
|
|
|
33527
33571
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
33528
33572
|
// expression instead.
|
|
33529
33573
|
return triState === 1 /* True */ ?
|
|
33530
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
33531
|
-
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
33574
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, parsingConditionalExpression) :
|
|
33575
|
+
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalExpression); });
|
|
33532
33576
|
}
|
|
33533
33577
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
33534
33578
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -33658,25 +33702,25 @@ var ts;
|
|
|
33658
33702
|
return 2 /* Unknown */;
|
|
33659
33703
|
}
|
|
33660
33704
|
}
|
|
33661
|
-
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
33705
|
+
function parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalExpression) {
|
|
33662
33706
|
var tokenPos = scanner.getTokenPos();
|
|
33663
33707
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
33664
33708
|
return undefined;
|
|
33665
33709
|
}
|
|
33666
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
33710
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, parsingConditionalExpression);
|
|
33667
33711
|
if (!result) {
|
|
33668
33712
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
33669
33713
|
}
|
|
33670
33714
|
return result;
|
|
33671
33715
|
}
|
|
33672
|
-
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
33716
|
+
function tryParseAsyncSimpleArrowFunctionExpression(parsingConditionalExpression) {
|
|
33673
33717
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
33674
33718
|
if (token() === 131 /* AsyncKeyword */) {
|
|
33675
33719
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
33676
33720
|
var pos = getNodePos();
|
|
33677
33721
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
33678
33722
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
33679
|
-
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
33723
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier, parsingConditionalExpression);
|
|
33680
33724
|
}
|
|
33681
33725
|
}
|
|
33682
33726
|
return undefined;
|
|
@@ -33700,7 +33744,7 @@ var ts;
|
|
|
33700
33744
|
}
|
|
33701
33745
|
return 0 /* False */;
|
|
33702
33746
|
}
|
|
33703
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
33747
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, parsingConditionalExpression) {
|
|
33704
33748
|
var pos = getNodePos();
|
|
33705
33749
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
33706
33750
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -33726,6 +33770,20 @@ var ts;
|
|
|
33726
33770
|
return undefined;
|
|
33727
33771
|
}
|
|
33728
33772
|
}
|
|
33773
|
+
// Given:
|
|
33774
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
33775
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
33776
|
+
// ({ y }) : z => ({ z })
|
|
33777
|
+
// This is a valid arrow function with "z" as the return type.
|
|
33778
|
+
//
|
|
33779
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
33780
|
+
// terminates the true side, so cannot be the return type. If we are in the
|
|
33781
|
+
// false side, we may still be within the true side of a parent conditional
|
|
33782
|
+
// expression, so don't allow it to be a return type either.
|
|
33783
|
+
if (parsingConditionalExpression && token() === 58 /* ColonToken */) {
|
|
33784
|
+
ts.Debug.assert(!allowAmbiguity);
|
|
33785
|
+
return undefined;
|
|
33786
|
+
}
|
|
33729
33787
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
33730
33788
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
33731
33789
|
return undefined;
|
|
@@ -33754,12 +33812,12 @@ var ts;
|
|
|
33754
33812
|
var lastToken = token();
|
|
33755
33813
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
33756
33814
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
33757
|
-
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
|
|
33815
|
+
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), parsingConditionalExpression)
|
|
33758
33816
|
: parseIdentifier();
|
|
33759
33817
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
33760
33818
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
33761
33819
|
}
|
|
33762
|
-
function parseArrowFunctionExpressionBody(isAsync) {
|
|
33820
|
+
function parseArrowFunctionExpressionBody(isAsync, parsingConditionalExpression) {
|
|
33763
33821
|
if (token() === 18 /* OpenBraceToken */) {
|
|
33764
33822
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
33765
33823
|
}
|
|
@@ -33787,8 +33845,8 @@ var ts;
|
|
|
33787
33845
|
var savedTopLevel = topLevel;
|
|
33788
33846
|
topLevel = false;
|
|
33789
33847
|
var node = isAsync
|
|
33790
|
-
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
33791
|
-
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
33848
|
+
? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalExpression); })
|
|
33849
|
+
: doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalExpression); });
|
|
33792
33850
|
topLevel = savedTopLevel;
|
|
33793
33851
|
return node;
|
|
33794
33852
|
}
|
|
@@ -33801,8 +33859,8 @@ var ts;
|
|
|
33801
33859
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
33802
33860
|
// we do not that for the 'whenFalse' part.
|
|
33803
33861
|
var colonToken;
|
|
33804
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
33805
|
-
? parseAssignmentExpressionOrHigher()
|
|
33862
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*parsingConditionalExpression*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
33863
|
+
? parseAssignmentExpressionOrHigher(/*parsingConditionalExpression*/ true)
|
|
33806
33864
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
33807
33865
|
}
|
|
33808
33866
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -34573,16 +34631,12 @@ var ts;
|
|
|
34573
34631
|
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
|
|
34574
34632
|
continue;
|
|
34575
34633
|
}
|
|
34576
|
-
|
|
34577
|
-
|
|
34578
|
-
|
|
34579
|
-
|
|
34580
|
-
|
|
34581
|
-
|
|
34582
|
-
continue;
|
|
34583
|
-
}
|
|
34584
|
-
expression = finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
34585
|
-
break;
|
|
34634
|
+
var argumentList = parseArgumentList();
|
|
34635
|
+
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34636
|
+
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
|
|
34637
|
+
factory.createCallExpression(expression, typeArguments, argumentList);
|
|
34638
|
+
expression = finishNode(callExpr, pos);
|
|
34639
|
+
continue;
|
|
34586
34640
|
}
|
|
34587
34641
|
}
|
|
34588
34642
|
else if (token() === 20 /* OpenParenToken */) {
|
|
@@ -34622,23 +34676,20 @@ var ts;
|
|
|
34622
34676
|
// If it doesn't have the closing `>` then it's definitely not an type argument list.
|
|
34623
34677
|
return undefined;
|
|
34624
34678
|
}
|
|
34625
|
-
//
|
|
34626
|
-
//
|
|
34627
|
-
|
|
34628
|
-
|
|
34629
|
-
|
|
34679
|
+
// If we have a '<', then only parse this as a argument list if the type arguments
|
|
34680
|
+
// are complete and we have an open paren. if we don't, rewind and return nothing.
|
|
34681
|
+
return typeArguments && canFollowTypeArgumentsInExpression()
|
|
34682
|
+
? typeArguments
|
|
34683
|
+
: undefined;
|
|
34630
34684
|
}
|
|
34631
34685
|
function canFollowTypeArgumentsInExpression() {
|
|
34632
34686
|
switch (token()) {
|
|
34633
|
-
// These tokens can follow a type argument list in a call expression.
|
|
34634
34687
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
34635
34688
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
34636
34689
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
34637
|
-
//
|
|
34638
|
-
//
|
|
34639
|
-
// expression.
|
|
34690
|
+
// these are the only tokens can legally follow a type argument
|
|
34691
|
+
// list. So we definitely want to treat them as type arg lists.
|
|
34640
34692
|
// falls through
|
|
34641
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
34642
34693
|
case 24 /* DotToken */: // foo<x>.
|
|
34643
34694
|
case 21 /* CloseParenToken */: // foo<x>)
|
|
34644
34695
|
case 23 /* CloseBracketToken */: // foo<x>]
|
|
@@ -34657,10 +34708,20 @@ var ts;
|
|
|
34657
34708
|
case 51 /* BarToken */: // foo<x> |
|
|
34658
34709
|
case 19 /* CloseBraceToken */: // foo<x> }
|
|
34659
34710
|
case 1 /* EndOfFileToken */: // foo<x>
|
|
34711
|
+
// these cases can't legally follow a type arg list. However, they're not legal
|
|
34712
|
+
// expressions either. The user is probably in the middle of a generic type. So
|
|
34713
|
+
// treat it as such.
|
|
34660
34714
|
return true;
|
|
34715
|
+
case 27 /* CommaToken */: // foo<x>,
|
|
34716
|
+
case 18 /* OpenBraceToken */: // foo<x> {
|
|
34717
|
+
// We don't want to treat these as type arguments. Otherwise we'll parse this
|
|
34718
|
+
// as an invocation expression. Instead, we want to parse out the expression
|
|
34719
|
+
// in isolation from the type arguments.
|
|
34720
|
+
// falls through
|
|
34721
|
+
default:
|
|
34722
|
+
// Anything else treat as an expression.
|
|
34723
|
+
return false;
|
|
34661
34724
|
}
|
|
34662
|
-
// Treat anything else as an expression.
|
|
34663
|
-
return false;
|
|
34664
34725
|
}
|
|
34665
34726
|
function parsePrimaryExpression() {
|
|
34666
34727
|
switch (token()) {
|
|
@@ -34841,12 +34902,17 @@ var ts;
|
|
|
34841
34902
|
return finishNode(factory.createMetaProperty(103 /* NewKeyword */, name), pos);
|
|
34842
34903
|
}
|
|
34843
34904
|
var expressionPos = getNodePos();
|
|
34844
|
-
var expression =
|
|
34845
|
-
var typeArguments
|
|
34846
|
-
|
|
34847
|
-
|
|
34848
|
-
|
|
34849
|
-
|
|
34905
|
+
var expression = parsePrimaryExpression();
|
|
34906
|
+
var typeArguments;
|
|
34907
|
+
while (true) {
|
|
34908
|
+
expression = parseMemberExpressionRest(expressionPos, expression, /*allowOptionalChain*/ false);
|
|
34909
|
+
typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
34910
|
+
if (isTemplateStartOfTaggedTemplate()) {
|
|
34911
|
+
ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
|
|
34912
|
+
expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
|
|
34913
|
+
typeArguments = undefined;
|
|
34914
|
+
}
|
|
34915
|
+
break;
|
|
34850
34916
|
}
|
|
34851
34917
|
var argumentsArray;
|
|
34852
34918
|
if (token() === 20 /* OpenParenToken */) {
|
|
@@ -35943,9 +36009,6 @@ var ts;
|
|
|
35943
36009
|
function parseExpressionWithTypeArguments() {
|
|
35944
36010
|
var pos = getNodePos();
|
|
35945
36011
|
var expression = parseLeftHandSideExpressionOrHigher();
|
|
35946
|
-
if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
35947
|
-
return expression;
|
|
35948
|
-
}
|
|
35949
36012
|
var typeArguments = tryParseTypeArguments();
|
|
35950
36013
|
return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
35951
36014
|
}
|
|
@@ -48770,24 +48833,19 @@ var ts;
|
|
|
48770
48833
|
error(errorLocation, ts.Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), ts.declarationNameToString(errorLocation));
|
|
48771
48834
|
}
|
|
48772
48835
|
}
|
|
48773
|
-
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */) {
|
|
48774
|
-
|
|
48836
|
+
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
48837
|
+
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result);
|
|
48838
|
+
if (typeOnlyDeclaration) {
|
|
48839
|
+
var message = typeOnlyDeclaration.kind === 274 /* ExportSpecifier */
|
|
48840
|
+
? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
|
|
48841
|
+
: ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
48842
|
+
var unescapedName = ts.unescapeLeadingUnderscores(name);
|
|
48843
|
+
addTypeOnlyDeclarationRelatedInfo(error(errorLocation, message, unescapedName), typeOnlyDeclaration, unescapedName);
|
|
48844
|
+
}
|
|
48775
48845
|
}
|
|
48776
48846
|
}
|
|
48777
48847
|
return result;
|
|
48778
48848
|
}
|
|
48779
|
-
function checkSymbolUsageInExpressionContext(symbol, name, useSite) {
|
|
48780
|
-
if (!ts.isValidTypeOnlyAliasUseSite(useSite)) {
|
|
48781
|
-
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(symbol);
|
|
48782
|
-
if (typeOnlyDeclaration) {
|
|
48783
|
-
var message = typeOnlyDeclaration.kind === 274 /* ExportSpecifier */
|
|
48784
|
-
? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
|
|
48785
|
-
: ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
48786
|
-
var unescapedName = ts.unescapeLeadingUnderscores(name);
|
|
48787
|
-
addTypeOnlyDeclarationRelatedInfo(error(useSite, message, unescapedName), typeOnlyDeclaration, unescapedName);
|
|
48788
|
-
}
|
|
48789
|
-
}
|
|
48790
|
-
}
|
|
48791
48849
|
function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) {
|
|
48792
48850
|
if (!typeOnlyDeclaration)
|
|
48793
48851
|
return diagnostic;
|
|
@@ -50874,7 +50932,7 @@ var ts;
|
|
|
50874
50932
|
// get symbol of the first identifier of the entityName
|
|
50875
50933
|
var meaning;
|
|
50876
50934
|
if (entityName.parent.kind === 180 /* TypeQuery */ ||
|
|
50877
|
-
|
|
50935
|
+
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
|
|
50878
50936
|
entityName.parent.kind === 161 /* ComputedPropertyName */) {
|
|
50879
50937
|
// Typeof value
|
|
50880
50938
|
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
@@ -50985,7 +51043,7 @@ var ts;
|
|
|
50985
51043
|
return flags & 814775659 /* NodeBuilderFlagsMask */;
|
|
50986
51044
|
}
|
|
50987
51045
|
function isClassInstanceSide(type) {
|
|
50988
|
-
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) &
|
|
51046
|
+
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 16777216 /* IsClassInstanceClone */)));
|
|
50989
51047
|
}
|
|
50990
51048
|
function createNodeBuilder() {
|
|
50991
51049
|
return {
|
|
@@ -54913,7 +54971,7 @@ var ts;
|
|
|
54913
54971
|
members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
|
|
54914
54972
|
result.objectFlags |= (ts.getObjectFlags(type) & 8192 /* JSLiteral */); // Propagate JSLiteral flag
|
|
54915
54973
|
if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
|
|
54916
|
-
result.objectFlags |=
|
|
54974
|
+
result.objectFlags |= 16777216 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
|
|
54917
54975
|
}
|
|
54918
54976
|
return result;
|
|
54919
54977
|
}
|
|
@@ -56923,87 +56981,87 @@ var ts;
|
|
|
56923
56981
|
* Converts an AnonymousType to a ResolvedType.
|
|
56924
56982
|
*/
|
|
56925
56983
|
function resolveAnonymousTypeMembers(type) {
|
|
56984
|
+
var symbol = getMergedSymbol(type.symbol);
|
|
56926
56985
|
if (type.target) {
|
|
56927
56986
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
56928
|
-
var
|
|
56987
|
+
var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
|
|
56929
56988
|
var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper);
|
|
56930
56989
|
var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper);
|
|
56931
|
-
var
|
|
56932
|
-
setStructuredTypeMembers(type,
|
|
56933
|
-
return;
|
|
56990
|
+
var indexInfos = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
|
|
56991
|
+
setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
|
|
56934
56992
|
}
|
|
56935
|
-
|
|
56936
|
-
if (symbol.flags & 2048 /* TypeLiteral */) {
|
|
56993
|
+
else if (symbol.flags & 2048 /* TypeLiteral */) {
|
|
56937
56994
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
56938
|
-
var
|
|
56939
|
-
var callSignatures = getSignaturesOfSymbol(
|
|
56940
|
-
var constructSignatures = getSignaturesOfSymbol(
|
|
56941
|
-
var
|
|
56942
|
-
setStructuredTypeMembers(type,
|
|
56943
|
-
return;
|
|
56944
|
-
}
|
|
56945
|
-
// Combinations of function, class, enum and module
|
|
56946
|
-
var members = emptySymbols;
|
|
56947
|
-
var indexInfos;
|
|
56948
|
-
if (symbol.exports) {
|
|
56949
|
-
members = getExportsOfSymbol(symbol);
|
|
56950
|
-
if (symbol === globalThisSymbol) {
|
|
56951
|
-
var varsOnly_1 = new ts.Map();
|
|
56952
|
-
members.forEach(function (p) {
|
|
56953
|
-
if (!(p.flags & 418 /* BlockScoped */)) {
|
|
56954
|
-
varsOnly_1.set(p.escapedName, p);
|
|
56955
|
-
}
|
|
56956
|
-
});
|
|
56957
|
-
members = varsOnly_1;
|
|
56958
|
-
}
|
|
56995
|
+
var members = getMembersOfSymbol(symbol);
|
|
56996
|
+
var callSignatures = getSignaturesOfSymbol(members.get("__call" /* Call */));
|
|
56997
|
+
var constructSignatures = getSignaturesOfSymbol(members.get("__new" /* New */));
|
|
56998
|
+
var indexInfos = getIndexInfosOfSymbol(symbol);
|
|
56999
|
+
setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
|
|
56959
57000
|
}
|
|
56960
|
-
|
|
56961
|
-
|
|
56962
|
-
|
|
56963
|
-
var
|
|
56964
|
-
|
|
56965
|
-
|
|
56966
|
-
|
|
56967
|
-
|
|
57001
|
+
else {
|
|
57002
|
+
// Combinations of function, class, enum and module
|
|
57003
|
+
var members = emptySymbols;
|
|
57004
|
+
var indexInfos = void 0;
|
|
57005
|
+
if (symbol.exports) {
|
|
57006
|
+
members = getExportsOfSymbol(symbol);
|
|
57007
|
+
if (symbol === globalThisSymbol) {
|
|
57008
|
+
var varsOnly_1 = new ts.Map();
|
|
57009
|
+
members.forEach(function (p) {
|
|
57010
|
+
if (!(p.flags & 418 /* BlockScoped */)) {
|
|
57011
|
+
varsOnly_1.set(p.escapedName, p);
|
|
57012
|
+
}
|
|
57013
|
+
});
|
|
57014
|
+
members = varsOnly_1;
|
|
57015
|
+
}
|
|
56968
57016
|
}
|
|
56969
|
-
|
|
56970
|
-
|
|
57017
|
+
var baseConstructorIndexInfo = void 0;
|
|
57018
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57019
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57020
|
+
var classType = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57021
|
+
var baseConstructorType = getBaseConstructorTypeOfClass(classType);
|
|
57022
|
+
if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
|
|
57023
|
+
members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
|
|
57024
|
+
addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
|
|
57025
|
+
}
|
|
57026
|
+
else if (baseConstructorType === anyType) {
|
|
57027
|
+
baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
|
|
57028
|
+
}
|
|
56971
57029
|
}
|
|
56972
|
-
|
|
56973
|
-
|
|
56974
|
-
|
|
56975
|
-
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
56976
|
-
}
|
|
56977
|
-
else {
|
|
56978
|
-
if (baseConstructorIndexInfo) {
|
|
56979
|
-
indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
|
|
57030
|
+
var indexSymbol = getIndexSymbolFromSymbolTable(members);
|
|
57031
|
+
if (indexSymbol) {
|
|
57032
|
+
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
56980
57033
|
}
|
|
56981
|
-
|
|
56982
|
-
|
|
56983
|
-
|
|
57034
|
+
else {
|
|
57035
|
+
if (baseConstructorIndexInfo) {
|
|
57036
|
+
indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
|
|
57037
|
+
}
|
|
57038
|
+
if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
|
|
57039
|
+
ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
|
|
57040
|
+
indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
|
|
57041
|
+
}
|
|
56984
57042
|
}
|
|
56985
|
-
|
|
56986
|
-
|
|
56987
|
-
|
|
56988
|
-
|
|
56989
|
-
|
|
56990
|
-
|
|
56991
|
-
|
|
56992
|
-
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
56993
|
-
}
|
|
56994
|
-
// And likewise for construct signatures for classes
|
|
56995
|
-
if (symbol.flags & 32 /* Class */) {
|
|
56996
|
-
var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
|
|
56997
|
-
var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
|
|
56998
|
-
if (symbol.flags & 16 /* Function */) {
|
|
56999
|
-
constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
|
|
57000
|
-
createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
|
|
57001
|
-
undefined; }));
|
|
57043
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
|
|
57044
|
+
// We resolve the members before computing the signatures because a signature may use
|
|
57045
|
+
// typeof with a qualified name expression that circularly references the type we are
|
|
57046
|
+
// in the process of resolving (see issue #6072). The temporarily empty signature list
|
|
57047
|
+
// will never be observed because a qualified name can't reference signatures.
|
|
57048
|
+
if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
|
|
57049
|
+
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57002
57050
|
}
|
|
57003
|
-
|
|
57004
|
-
|
|
57051
|
+
// And likewise for construct signatures for classes
|
|
57052
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57053
|
+
var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57054
|
+
var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
|
|
57055
|
+
if (symbol.flags & 16 /* Function */) {
|
|
57056
|
+
constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
|
|
57057
|
+
createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
|
|
57058
|
+
undefined; }));
|
|
57059
|
+
}
|
|
57060
|
+
if (!constructSignatures.length) {
|
|
57061
|
+
constructSignatures = getDefaultConstructSignatures(classType_1);
|
|
57062
|
+
}
|
|
57063
|
+
type.constructSignatures = constructSignatures;
|
|
57005
57064
|
}
|
|
57006
|
-
type.constructSignatures = constructSignatures;
|
|
57007
57065
|
}
|
|
57008
57066
|
}
|
|
57009
57067
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
@@ -57995,8 +58053,8 @@ var ts;
|
|
|
57995
58053
|
var stringIndexInfo;
|
|
57996
58054
|
var applicableInfo;
|
|
57997
58055
|
var applicableInfos;
|
|
57998
|
-
for (var _i = 0,
|
|
57999
|
-
var info =
|
|
58056
|
+
for (var _i = 0, indexInfos_1 = indexInfos; _i < indexInfos_1.length; _i++) {
|
|
58057
|
+
var info = indexInfos_1[_i];
|
|
58000
58058
|
if (info.keyType === stringType) {
|
|
58001
58059
|
stringIndexInfo = info;
|
|
58002
58060
|
}
|
|
@@ -58560,14 +58618,14 @@ var ts;
|
|
|
58560
58618
|
}
|
|
58561
58619
|
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
58562
58620
|
if (indexSymbol.declarations) {
|
|
58563
|
-
var
|
|
58621
|
+
var indexInfos_2 = [];
|
|
58564
58622
|
var _loop_14 = function (declaration) {
|
|
58565
58623
|
if (declaration.parameters.length === 1) {
|
|
58566
58624
|
var parameter = declaration.parameters[0];
|
|
58567
58625
|
if (parameter.type) {
|
|
58568
58626
|
forEachType(getTypeFromTypeNode(parameter.type), function (keyType) {
|
|
58569
|
-
if (isValidIndexKeyType(keyType) && !findIndexInfo(
|
|
58570
|
-
|
|
58627
|
+
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_2, keyType)) {
|
|
58628
|
+
indexInfos_2.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
|
|
58571
58629
|
}
|
|
58572
58630
|
});
|
|
58573
58631
|
}
|
|
@@ -58577,7 +58635,7 @@ var ts;
|
|
|
58577
58635
|
var declaration = _a[_i];
|
|
58578
58636
|
_loop_14(declaration);
|
|
58579
58637
|
}
|
|
58580
|
-
return
|
|
58638
|
+
return indexInfos_2;
|
|
58581
58639
|
}
|
|
58582
58640
|
return ts.emptyArray;
|
|
58583
58641
|
}
|
|
@@ -59125,7 +59183,7 @@ var ts;
|
|
|
59125
59183
|
// The expression is processed as an identifier expression (section 4.3)
|
|
59126
59184
|
// or property access expression(section 4.10),
|
|
59127
59185
|
// the widened type(section 3.9) of which becomes the result.
|
|
59128
|
-
var type =
|
|
59186
|
+
var type = ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
59129
59187
|
links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type));
|
|
59130
59188
|
}
|
|
59131
59189
|
return links.resolvedType;
|
|
@@ -61829,9 +61887,7 @@ var ts;
|
|
|
61829
61887
|
return result;
|
|
61830
61888
|
}
|
|
61831
61889
|
function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
61832
|
-
var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
|
|
61833
|
-
type.objectFlags & 16777216 /* InstantiationExpressionType */ ? type.node :
|
|
61834
|
-
type.symbol.declarations[0];
|
|
61890
|
+
var declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.symbol.declarations[0];
|
|
61835
61891
|
var links = getNodeLinks(declaration);
|
|
61836
61892
|
var target = type.objectFlags & 4 /* Reference */ ? links.resolvedType :
|
|
61837
61893
|
type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
@@ -61847,8 +61903,8 @@ var ts;
|
|
|
61847
61903
|
outerTypeParameters = ts.addRange(outerTypeParameters, templateTagParameters);
|
|
61848
61904
|
}
|
|
61849
61905
|
typeParameters = outerTypeParameters || ts.emptyArray;
|
|
61850
|
-
var allDeclarations_1 = type.objectFlags &
|
|
61851
|
-
typeParameters = (target.objectFlags &
|
|
61906
|
+
var allDeclarations_1 = type.objectFlags & 4 /* Reference */ ? [declaration] : type.symbol.declarations;
|
|
61907
|
+
typeParameters = (target.objectFlags & 4 /* Reference */ || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
|
|
61852
61908
|
ts.filter(typeParameters, function (tp) { return ts.some(allDeclarations_1, function (d) { return isTypeParameterPossiblyReferenced(tp, d); }); }) :
|
|
61853
61909
|
typeParameters;
|
|
61854
61910
|
links.outerTypeParameters = typeParameters;
|
|
@@ -62020,9 +62076,6 @@ var ts;
|
|
|
62020
62076
|
mapper = combineTypeMappers(makeUnaryTypeMapper(origTypeParameter, freshTypeParameter), mapper);
|
|
62021
62077
|
freshTypeParameter.mapper = mapper;
|
|
62022
62078
|
}
|
|
62023
|
-
if (type.objectFlags & 16777216 /* InstantiationExpressionType */) {
|
|
62024
|
-
result.node = type.node;
|
|
62025
|
-
}
|
|
62026
62079
|
result.target = type;
|
|
62027
62080
|
result.mapper = mapper;
|
|
62028
62081
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -65197,8 +65250,8 @@ var ts;
|
|
|
65197
65250
|
var indexInfos = getIndexInfosOfType(target);
|
|
65198
65251
|
var targetHasStringIndex = ts.some(indexInfos, function (info) { return info.keyType === stringType; });
|
|
65199
65252
|
var result = -1 /* True */;
|
|
65200
|
-
for (var _i = 0,
|
|
65201
|
-
var targetInfo =
|
|
65253
|
+
for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
|
|
65254
|
+
var targetInfo = indexInfos_3[_i];
|
|
65202
65255
|
var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ :
|
|
65203
65256
|
isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, 3 /* Both */, reportErrors) :
|
|
65204
65257
|
typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState);
|
|
@@ -65805,10 +65858,10 @@ var ts;
|
|
|
65805
65858
|
if (!(ts.getObjectFlags(type) & 4 /* Reference */) || !(ts.getObjectFlags(type.target) & 3 /* ClassOrInterface */)) {
|
|
65806
65859
|
return undefined;
|
|
65807
65860
|
}
|
|
65808
|
-
if (ts.getObjectFlags(type) &
|
|
65809
|
-
return ts.getObjectFlags(type) &
|
|
65861
|
+
if (ts.getObjectFlags(type) & 33554432 /* IdenticalBaseTypeCalculated */) {
|
|
65862
|
+
return ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
|
|
65810
65863
|
}
|
|
65811
|
-
type.objectFlags |=
|
|
65864
|
+
type.objectFlags |= 33554432 /* IdenticalBaseTypeCalculated */;
|
|
65812
65865
|
var target = type.target;
|
|
65813
65866
|
if (ts.getObjectFlags(target) & 1 /* Class */) {
|
|
65814
65867
|
var baseTypeNode = getBaseTypeNodeOfClass(target);
|
|
@@ -65829,7 +65882,7 @@ var ts;
|
|
|
65829
65882
|
if (ts.length(getTypeArguments(type)) > ts.length(target.typeParameters)) {
|
|
65830
65883
|
instantiatedBase = getTypeWithThisArgument(instantiatedBase, ts.last(getTypeArguments(type)));
|
|
65831
65884
|
}
|
|
65832
|
-
type.objectFlags |=
|
|
65885
|
+
type.objectFlags |= 67108864 /* IdenticalBaseTypeExists */;
|
|
65833
65886
|
return type.cachedEquivalentBaseType = instantiatedBase;
|
|
65834
65887
|
}
|
|
65835
65888
|
function isEmptyLiteralType(type) {
|
|
@@ -66493,7 +66546,7 @@ var ts;
|
|
|
66493
66546
|
var result = !!(type.flags & 465829888 /* Instantiable */ ||
|
|
66494
66547
|
type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || ts.forEach(getTypeArguments(type), couldContainTypeVariables)) ||
|
|
66495
66548
|
objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
|
|
66496
|
-
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */
|
|
66549
|
+
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */)) ||
|
|
66497
66550
|
type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && ts.some(type.types, couldContainTypeVariables));
|
|
66498
66551
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
66499
66552
|
type.objectFlags |= 1048576 /* CouldContainTypeVariablesComputed */ | (result ? 2097152 /* CouldContainTypeVariables */ : 0);
|
|
@@ -67410,8 +67463,8 @@ var ts;
|
|
|
67410
67463
|
var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* Mapped */) ? 8 /* HomomorphicMappedType */ : 0;
|
|
67411
67464
|
var indexInfos = getIndexInfosOfType(target);
|
|
67412
67465
|
if (isObjectTypeWithInferableIndex(source)) {
|
|
67413
|
-
for (var _i = 0,
|
|
67414
|
-
var targetInfo =
|
|
67466
|
+
for (var _i = 0, indexInfos_4 = indexInfos; _i < indexInfos_4.length; _i++) {
|
|
67467
|
+
var targetInfo = indexInfos_4[_i];
|
|
67415
67468
|
var propTypes = [];
|
|
67416
67469
|
for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
|
|
67417
67470
|
var prop = _b[_a];
|
|
@@ -67431,8 +67484,8 @@ var ts;
|
|
|
67431
67484
|
}
|
|
67432
67485
|
}
|
|
67433
67486
|
}
|
|
67434
|
-
for (var _e = 0,
|
|
67435
|
-
var targetInfo =
|
|
67487
|
+
for (var _e = 0, indexInfos_5 = indexInfos; _e < indexInfos_5.length; _e++) {
|
|
67488
|
+
var targetInfo = indexInfos_5[_e];
|
|
67436
67489
|
var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType);
|
|
67437
67490
|
if (sourceInfo) {
|
|
67438
67491
|
inferWithPriority(sourceInfo.type, targetInfo.type, priority);
|
|
@@ -75602,66 +75655,6 @@ var ts;
|
|
|
75602
75655
|
return node.flags & 32 /* OptionalChain */ ? checkNonNullChain(node) :
|
|
75603
75656
|
getNonNullableType(checkExpression(node.expression));
|
|
75604
75657
|
}
|
|
75605
|
-
function checkExpressionWithTypeArguments(node) {
|
|
75606
|
-
checkGrammarExpressionWithTypeArguments(node);
|
|
75607
|
-
var exprType = node.kind === 227 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) :
|
|
75608
|
-
ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) :
|
|
75609
|
-
checkExpression(node.exprName);
|
|
75610
|
-
var typeArguments = node.typeArguments;
|
|
75611
|
-
if (!ts.some(typeArguments)) {
|
|
75612
|
-
return exprType;
|
|
75613
|
-
}
|
|
75614
|
-
var funcType = getApparentType(exprType);
|
|
75615
|
-
if (funcType === silentNeverType || isErrorType(funcType)) {
|
|
75616
|
-
return funcType;
|
|
75617
|
-
}
|
|
75618
|
-
var hasSomeApplicableSignature = false;
|
|
75619
|
-
var nonApplicableType;
|
|
75620
|
-
var hasSignatures;
|
|
75621
|
-
var hasApplicableSignature;
|
|
75622
|
-
var result = mapType(funcType, getInstantiatedType);
|
|
75623
|
-
var errorType = hasSomeApplicableSignature ? nonApplicableType : funcType;
|
|
75624
|
-
if (errorType) {
|
|
75625
|
-
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)));
|
|
75626
|
-
}
|
|
75627
|
-
return result;
|
|
75628
|
-
function getInstantiatedType(type) {
|
|
75629
|
-
hasSignatures = false;
|
|
75630
|
-
hasApplicableSignature = false;
|
|
75631
|
-
var result = getInstantiatedTypeWorker(type);
|
|
75632
|
-
hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
|
|
75633
|
-
if (hasSignatures && !hasApplicableSignature) {
|
|
75634
|
-
nonApplicableType !== null && nonApplicableType !== void 0 ? nonApplicableType : (nonApplicableType = type);
|
|
75635
|
-
}
|
|
75636
|
-
return result;
|
|
75637
|
-
}
|
|
75638
|
-
function getInstantiatedTypeWorker(type) {
|
|
75639
|
-
if (type.flags & 524288 /* Object */) {
|
|
75640
|
-
var resolved = resolveStructuredTypeMembers(type);
|
|
75641
|
-
var callSignatures = getInstantiatedSignatures(resolved.callSignatures);
|
|
75642
|
-
var constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
|
|
75643
|
-
hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
|
|
75644
|
-
hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
|
|
75645
|
-
if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
|
|
75646
|
-
var result_11 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
|
|
75647
|
-
result_11.objectFlags |= 16777216 /* InstantiationExpressionType */;
|
|
75648
|
-
result_11.node = node;
|
|
75649
|
-
return result_11;
|
|
75650
|
-
}
|
|
75651
|
-
}
|
|
75652
|
-
else if (type.flags & 2097152 /* Intersection */) {
|
|
75653
|
-
return getIntersectionType(ts.sameMap(type.types, getInstantiatedTypeWorker));
|
|
75654
|
-
}
|
|
75655
|
-
return type;
|
|
75656
|
-
}
|
|
75657
|
-
function getInstantiatedSignatures(signatures) {
|
|
75658
|
-
var applicableSignatures = ts.filter(signatures, function (sig) { return !!sig.typeParameters && hasCorrectTypeArgumentArity(sig, typeArguments); });
|
|
75659
|
-
return ts.sameMap(applicableSignatures, function (sig) {
|
|
75660
|
-
var typeArgumentTypes = checkTypeArguments(sig, typeArguments, /*reportErrors*/ true);
|
|
75661
|
-
return typeArgumentTypes ? getSignatureInstantiation(sig, typeArgumentTypes, ts.isInJSFile(sig.declaration)) : sig;
|
|
75662
|
-
});
|
|
75663
|
-
}
|
|
75664
|
-
}
|
|
75665
75658
|
function checkMetaProperty(node) {
|
|
75666
75659
|
checkGrammarMetaProperty(node);
|
|
75667
75660
|
if (node.keywordToken === 103 /* NewKeyword */) {
|
|
@@ -78171,8 +78164,6 @@ var ts;
|
|
|
78171
78164
|
return checkAssertion(node);
|
|
78172
78165
|
case 229 /* NonNullExpression */:
|
|
78173
78166
|
return checkNonNullAssertion(node);
|
|
78174
|
-
case 227 /* ExpressionWithTypeArguments */:
|
|
78175
|
-
return checkExpressionWithTypeArguments(node);
|
|
78176
78167
|
case 230 /* MetaProperty */:
|
|
78177
78168
|
return checkMetaProperty(node);
|
|
78178
78169
|
case 214 /* DeleteExpression */:
|
|
@@ -79378,12 +79369,12 @@ var ts;
|
|
|
79378
79369
|
case 264 /* ImportEqualsDeclaration */:
|
|
79379
79370
|
case 267 /* NamespaceImport */:
|
|
79380
79371
|
case 266 /* ImportClause */:
|
|
79381
|
-
var
|
|
79372
|
+
var result_11 = 0 /* None */;
|
|
79382
79373
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
79383
79374
|
ts.forEach(target.declarations, function (d) {
|
|
79384
|
-
|
|
79375
|
+
result_11 |= getDeclarationSpaces(d);
|
|
79385
79376
|
});
|
|
79386
|
-
return
|
|
79377
|
+
return result_11;
|
|
79387
79378
|
case 253 /* VariableDeclaration */:
|
|
79388
79379
|
case 202 /* BindingElement */:
|
|
79389
79380
|
case 255 /* FunctionDeclaration */:
|
|
@@ -81970,8 +81961,8 @@ var ts;
|
|
|
81970
81961
|
}
|
|
81971
81962
|
}
|
|
81972
81963
|
if (indexInfos.length > 1) {
|
|
81973
|
-
for (var _d = 0,
|
|
81974
|
-
var info =
|
|
81964
|
+
for (var _d = 0, indexInfos_6 = indexInfos; _d < indexInfos_6.length; _d++) {
|
|
81965
|
+
var info = indexInfos_6[_d];
|
|
81975
81966
|
checkIndexConstraintForIndexSignature(type, info);
|
|
81976
81967
|
}
|
|
81977
81968
|
}
|
|
@@ -81997,8 +81988,8 @@ var ts;
|
|
|
81997
81988
|
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));
|
|
81998
81989
|
}
|
|
81999
81990
|
};
|
|
82000
|
-
for (var _i = 0,
|
|
82001
|
-
var info =
|
|
81991
|
+
for (var _i = 0, indexInfos_7 = indexInfos; _i < indexInfos_7.length; _i++) {
|
|
81992
|
+
var info = indexInfos_7[_i];
|
|
82002
81993
|
_loop_27(info);
|
|
82003
81994
|
}
|
|
82004
81995
|
}
|
|
@@ -82020,8 +82011,8 @@ var ts;
|
|
|
82020
82011
|
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));
|
|
82021
82012
|
}
|
|
82022
82013
|
};
|
|
82023
|
-
for (var _i = 0,
|
|
82024
|
-
var info =
|
|
82014
|
+
for (var _i = 0, indexInfos_8 = indexInfos; _i < indexInfos_8.length; _i++) {
|
|
82015
|
+
var info = indexInfos_8[_i];
|
|
82025
82016
|
_loop_28(info);
|
|
82026
82017
|
}
|
|
82027
82018
|
}
|
|
@@ -87617,7 +87608,7 @@ var ts;
|
|
|
87617
87608
|
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));
|
|
87618
87609
|
case 180 /* TypeQuery */:
|
|
87619
87610
|
ts.Debug.type(node);
|
|
87620
|
-
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName)
|
|
87611
|
+
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName));
|
|
87621
87612
|
case 181 /* TypeLiteral */:
|
|
87622
87613
|
ts.Debug.type(node);
|
|
87623
87614
|
return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
|
|
@@ -90509,8 +90500,8 @@ var ts;
|
|
|
90509
90500
|
function generateClassElementDecorationExpressions(node, isStatic) {
|
|
90510
90501
|
var members = getDecoratedClassElements(node, isStatic);
|
|
90511
90502
|
var expressions;
|
|
90512
|
-
for (var _i = 0,
|
|
90513
|
-
var member =
|
|
90503
|
+
for (var _i = 0, members_6 = members; _i < members_6.length; _i++) {
|
|
90504
|
+
var member = members_6[_i];
|
|
90514
90505
|
var expression = generateClassElementDecorationExpression(node, member);
|
|
90515
90506
|
if (expression) {
|
|
90516
90507
|
if (!expressions) {
|
|
@@ -95711,8 +95702,8 @@ var ts;
|
|
|
95711
95702
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
95712
95703
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95713
95704
|
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
95714
|
-
var
|
|
95715
|
-
return
|
|
95705
|
+
var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
95706
|
+
return result_12 && factory.createPropertyAssignment("children", result_12);
|
|
95716
95707
|
}
|
|
95717
95708
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
95718
95709
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -109341,8 +109332,6 @@ var ts;
|
|
|
109341
109332
|
return emitAsExpression(node);
|
|
109342
109333
|
case 229 /* NonNullExpression */:
|
|
109343
109334
|
return emitNonNullExpression(node);
|
|
109344
|
-
case 227 /* ExpressionWithTypeArguments */:
|
|
109345
|
-
return emitExpressionWithTypeArguments(node);
|
|
109346
109335
|
case 230 /* MetaProperty */:
|
|
109347
109336
|
return emitMetaProperty(node);
|
|
109348
109337
|
case 231 /* SyntheticExpression */:
|
|
@@ -109787,7 +109776,6 @@ var ts;
|
|
|
109787
109776
|
writeKeyword("typeof");
|
|
109788
109777
|
writeSpace();
|
|
109789
109778
|
emit(node.exprName);
|
|
109790
|
-
emitTypeArguments(node, node.typeArguments);
|
|
109791
109779
|
}
|
|
109792
109780
|
function emitTypeLiteral(node) {
|
|
109793
109781
|
writePunctuation("{");
|
|
@@ -114747,15 +114735,15 @@ var ts;
|
|
|
114747
114735
|
// which per above occurred during the current program creation.
|
|
114748
114736
|
// Since we assume the filesystem does not change during program creation,
|
|
114749
114737
|
// it is safe to reuse resolutions from the earlier call.
|
|
114750
|
-
var
|
|
114738
|
+
var result_13 = [];
|
|
114751
114739
|
var i = 0;
|
|
114752
114740
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
114753
114741
|
var moduleName = moduleNames_1[_i];
|
|
114754
114742
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
114755
114743
|
i++;
|
|
114756
|
-
|
|
114744
|
+
result_13.push(resolvedModule);
|
|
114757
114745
|
}
|
|
114758
|
-
return
|
|
114746
|
+
return result_13;
|
|
114759
114747
|
}
|
|
114760
114748
|
// At this point, we know at least one of the following hold:
|
|
114761
114749
|
// - file has local declarations for ambient modules
|
|
@@ -119863,9 +119851,9 @@ var ts;
|
|
|
119863
119851
|
if (!preferSymlinks) {
|
|
119864
119852
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
119865
119853
|
// so we only need to remove them from the realpath filenames.
|
|
119866
|
-
var
|
|
119867
|
-
if (
|
|
119868
|
-
return
|
|
119854
|
+
var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
119855
|
+
if (result_14)
|
|
119856
|
+
return result_14;
|
|
119869
119857
|
}
|
|
119870
119858
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
119871
119859
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -119885,10 +119873,10 @@ var ts;
|
|
|
119885
119873
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
119886
119874
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
119887
119875
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
119888
|
-
var
|
|
119876
|
+
var result_15 = cb(option, target === referenceRedirect);
|
|
119889
119877
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
119890
|
-
if (
|
|
119891
|
-
return
|
|
119878
|
+
if (result_15)
|
|
119879
|
+
return result_15;
|
|
119892
119880
|
}
|
|
119893
119881
|
});
|
|
119894
119882
|
});
|
|
@@ -120123,7 +120111,7 @@ var ts;
|
|
|
120123
120111
|
if (!host.fileExists || !host.readFile) {
|
|
120124
120112
|
return undefined;
|
|
120125
120113
|
}
|
|
120126
|
-
var parts = getNodeModulePathParts(path);
|
|
120114
|
+
var parts = ts.getNodeModulePathParts(path);
|
|
120127
120115
|
if (!parts) {
|
|
120128
120116
|
return undefined;
|
|
120129
120117
|
}
|
|
@@ -120246,58 +120234,6 @@ var ts;
|
|
|
120246
120234
|
}
|
|
120247
120235
|
}
|
|
120248
120236
|
}
|
|
120249
|
-
function getNodeModulePathParts(fullPath) {
|
|
120250
|
-
// If fullPath can't be valid module file within node_modules, returns undefined.
|
|
120251
|
-
// Example of expected pattern: /base/path/node_modules/[@scope/otherpackage/@otherscope/node_modules/]package/[subdirectory/]file.js
|
|
120252
|
-
// Returns indices: ^ ^ ^ ^
|
|
120253
|
-
var topLevelNodeModulesIndex = 0;
|
|
120254
|
-
var topLevelPackageNameIndex = 0;
|
|
120255
|
-
var packageRootIndex = 0;
|
|
120256
|
-
var fileNameIndex = 0;
|
|
120257
|
-
var States;
|
|
120258
|
-
(function (States) {
|
|
120259
|
-
States[States["BeforeNodeModules"] = 0] = "BeforeNodeModules";
|
|
120260
|
-
States[States["NodeModules"] = 1] = "NodeModules";
|
|
120261
|
-
States[States["Scope"] = 2] = "Scope";
|
|
120262
|
-
States[States["PackageContent"] = 3] = "PackageContent";
|
|
120263
|
-
})(States || (States = {}));
|
|
120264
|
-
var partStart = 0;
|
|
120265
|
-
var partEnd = 0;
|
|
120266
|
-
var state = 0 /* BeforeNodeModules */;
|
|
120267
|
-
while (partEnd >= 0) {
|
|
120268
|
-
partStart = partEnd;
|
|
120269
|
-
partEnd = fullPath.indexOf("/", partStart + 1);
|
|
120270
|
-
switch (state) {
|
|
120271
|
-
case 0 /* BeforeNodeModules */:
|
|
120272
|
-
if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
|
|
120273
|
-
topLevelNodeModulesIndex = partStart;
|
|
120274
|
-
topLevelPackageNameIndex = partEnd;
|
|
120275
|
-
state = 1 /* NodeModules */;
|
|
120276
|
-
}
|
|
120277
|
-
break;
|
|
120278
|
-
case 1 /* NodeModules */:
|
|
120279
|
-
case 2 /* Scope */:
|
|
120280
|
-
if (state === 1 /* NodeModules */ && fullPath.charAt(partStart + 1) === "@") {
|
|
120281
|
-
state = 2 /* Scope */;
|
|
120282
|
-
}
|
|
120283
|
-
else {
|
|
120284
|
-
packageRootIndex = partEnd;
|
|
120285
|
-
state = 3 /* PackageContent */;
|
|
120286
|
-
}
|
|
120287
|
-
break;
|
|
120288
|
-
case 3 /* PackageContent */:
|
|
120289
|
-
if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
|
|
120290
|
-
state = 1 /* NodeModules */;
|
|
120291
|
-
}
|
|
120292
|
-
else {
|
|
120293
|
-
state = 3 /* PackageContent */;
|
|
120294
|
-
}
|
|
120295
|
-
break;
|
|
120296
|
-
}
|
|
120297
|
-
}
|
|
120298
|
-
fileNameIndex = partStart;
|
|
120299
|
-
return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
|
|
120300
|
-
}
|
|
120301
120237
|
function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
|
|
120302
120238
|
return ts.firstDefined(rootDirs, function (rootDir) {
|
|
120303
120239
|
var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
|
|
@@ -123781,7 +123717,7 @@ var ts;
|
|
|
123781
123717
|
case 199 /* ImportType */:
|
|
123782
123718
|
return !node.parent.isTypeOf;
|
|
123783
123719
|
case 227 /* ExpressionWithTypeArguments */:
|
|
123784
|
-
return ts.
|
|
123720
|
+
return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent);
|
|
123785
123721
|
}
|
|
123786
123722
|
return false;
|
|
123787
123723
|
}
|
|
@@ -126767,6 +126703,17 @@ var ts;
|
|
|
126767
126703
|
var exportInfoId = 1;
|
|
126768
126704
|
var exportInfo = ts.createMultiMap();
|
|
126769
126705
|
var symbols = new ts.Map();
|
|
126706
|
+
/**
|
|
126707
|
+
* Key: node_modules package name (no @types).
|
|
126708
|
+
* Value: path to deepest node_modules folder seen that is
|
|
126709
|
+
* both visible to `usableByFileName` and contains the package.
|
|
126710
|
+
*
|
|
126711
|
+
* Later, we can see if a given SymbolExportInfo is shadowed by
|
|
126712
|
+
* a another installation of the same package in a deeper
|
|
126713
|
+
* node_modules folder by seeing if its path starts with the
|
|
126714
|
+
* value stored here.
|
|
126715
|
+
*/
|
|
126716
|
+
var packages = new ts.Map();
|
|
126770
126717
|
var usableByFileName;
|
|
126771
126718
|
var cache = {
|
|
126772
126719
|
isUsableByFile: function (importingFile) { return importingFile === usableByFileName; },
|
|
@@ -126781,6 +126728,27 @@ var ts;
|
|
|
126781
126728
|
cache.clear();
|
|
126782
126729
|
usableByFileName = importingFile;
|
|
126783
126730
|
}
|
|
126731
|
+
var packageName;
|
|
126732
|
+
if (moduleFile) {
|
|
126733
|
+
var nodeModulesPathParts = ts.getNodeModulePathParts(moduleFile.fileName);
|
|
126734
|
+
if (nodeModulesPathParts) {
|
|
126735
|
+
var topLevelNodeModulesIndex = nodeModulesPathParts.topLevelNodeModulesIndex, topLevelPackageNameIndex = nodeModulesPathParts.topLevelPackageNameIndex, packageRootIndex = nodeModulesPathParts.packageRootIndex;
|
|
126736
|
+
packageName = ts.unmangleScopedPackageName(ts.getPackageNameFromTypesPackageName(moduleFile.fileName.substring(topLevelPackageNameIndex + 1, packageRootIndex)));
|
|
126737
|
+
if (ts.startsWith(importingFile, moduleFile.path.substring(0, topLevelNodeModulesIndex))) {
|
|
126738
|
+
var prevDeepestNodeModulesPath = packages.get(packageName);
|
|
126739
|
+
var nodeModulesPath = moduleFile.fileName.substring(0, topLevelPackageNameIndex);
|
|
126740
|
+
if (prevDeepestNodeModulesPath) {
|
|
126741
|
+
var prevDeepestNodeModulesIndex = prevDeepestNodeModulesPath.indexOf(ts.nodeModulesPathPart);
|
|
126742
|
+
if (topLevelNodeModulesIndex > prevDeepestNodeModulesIndex) {
|
|
126743
|
+
packages.set(packageName, nodeModulesPath);
|
|
126744
|
+
}
|
|
126745
|
+
}
|
|
126746
|
+
else {
|
|
126747
|
+
packages.set(packageName, nodeModulesPath);
|
|
126748
|
+
}
|
|
126749
|
+
}
|
|
126750
|
+
}
|
|
126751
|
+
}
|
|
126784
126752
|
var isDefault = exportKind === 1 /* Default */;
|
|
126785
126753
|
var namedSymbol = isDefault && ts.getLocalSymbolForExportDefault(symbol) || symbol;
|
|
126786
126754
|
// 1. A named export must be imported by its key in `moduleSymbol.exports` or `moduleSymbol.members`.
|
|
@@ -126807,6 +126775,7 @@ var ts;
|
|
|
126807
126775
|
moduleName: moduleName,
|
|
126808
126776
|
moduleFile: moduleFile,
|
|
126809
126777
|
moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName,
|
|
126778
|
+
packageName: packageName,
|
|
126810
126779
|
exportKind: exportKind,
|
|
126811
126780
|
targetFlags: target.flags,
|
|
126812
126781
|
isFromPackageJson: isFromPackageJson,
|
|
@@ -126826,13 +126795,16 @@ var ts;
|
|
|
126826
126795
|
exportInfo.forEach(function (info, key) {
|
|
126827
126796
|
var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName;
|
|
126828
126797
|
var rehydrated = info.map(rehydrateCachedInfo);
|
|
126829
|
-
|
|
126830
|
-
|
|
126831
|
-
|
|
126832
|
-
|
|
126833
|
-
|
|
126834
|
-
|
|
126835
|
-
|
|
126798
|
+
var filtered = rehydrated.filter(function (r, i) { return isNotShadowedByDeeperNodeModulesPackage(r, info[i].packageName); });
|
|
126799
|
+
if (filtered.length) {
|
|
126800
|
+
action(filtered, function (preferCapitalized) {
|
|
126801
|
+
var _a = rehydrated[0], symbol = _a.symbol, exportKind = _a.exportKind;
|
|
126802
|
+
var namedSymbol = exportKind === 1 /* Default */ && ts.getLocalSymbolForExportDefault(symbol) || symbol;
|
|
126803
|
+
return preferCapitalized
|
|
126804
|
+
? ts.getNameForExportedSymbol(namedSymbol, /*scriptTarget*/ undefined, /*preferCapitalized*/ true)
|
|
126805
|
+
: symbolName;
|
|
126806
|
+
}, !!ambientModuleName, key);
|
|
126807
|
+
}
|
|
126836
126808
|
});
|
|
126837
126809
|
},
|
|
126838
126810
|
releaseSymbols: function () {
|
|
@@ -126932,6 +126904,12 @@ var ts;
|
|
|
126932
126904
|
}
|
|
126933
126905
|
return true;
|
|
126934
126906
|
}
|
|
126907
|
+
function isNotShadowedByDeeperNodeModulesPackage(info, packageName) {
|
|
126908
|
+
if (!packageName || !info.moduleFileName)
|
|
126909
|
+
return true;
|
|
126910
|
+
var packageDeepestNodeModulesPath = packages.get(packageName);
|
|
126911
|
+
return !packageDeepestNodeModulesPath || ts.startsWith(info.moduleFileName, packageDeepestNodeModulesPath);
|
|
126912
|
+
}
|
|
126935
126913
|
}
|
|
126936
126914
|
ts.createCacheableExportInfoMap = createCacheableExportInfoMap;
|
|
126937
126915
|
function isImportableFile(program, from, to, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) {
|
|
@@ -129242,7 +129220,7 @@ var ts;
|
|
|
129242
129220
|
}
|
|
129243
129221
|
switch (completionData.kind) {
|
|
129244
129222
|
case 0 /* Data */:
|
|
129245
|
-
var response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext);
|
|
129223
|
+
var response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position);
|
|
129246
129224
|
if (response === null || response === void 0 ? void 0 : response.isIncomplete) {
|
|
129247
129225
|
incompleteCompletionsCache === null || incompleteCompletionsCache === void 0 ? void 0 : incompleteCompletionsCache.set(response);
|
|
129248
129226
|
}
|
|
@@ -129362,7 +129340,7 @@ var ts;
|
|
|
129362
129340
|
// StringLiteralLike locations are handled separately in stringCompletions.ts
|
|
129363
129341
|
return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
|
|
129364
129342
|
}
|
|
129365
|
-
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext) {
|
|
129343
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
129366
129344
|
var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextIdMap = completionData.symbolToSortTextIdMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports;
|
|
129367
129345
|
// Verify if the file is JSX language variant
|
|
129368
129346
|
if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* JSX */) {
|
|
@@ -129375,7 +129353,7 @@ var ts;
|
|
|
129375
129353
|
if (isUncheckedFile(sourceFile, compilerOptions)) {
|
|
129376
129354
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
129377
129355
|
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
129378
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
129356
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
129379
129357
|
}
|
|
129380
129358
|
else {
|
|
129381
129359
|
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
@@ -129385,16 +129363,23 @@ var ts;
|
|
|
129385
129363
|
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
129386
129364
|
}
|
|
129387
129365
|
if (keywordFilters !== 0 /* None */) {
|
|
129388
|
-
var
|
|
129366
|
+
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
129389
129367
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
129390
129368
|
var keywordEntry = _a[_i];
|
|
129391
|
-
if (!
|
|
129369
|
+
if (!entryNames_1.has(keywordEntry.name)) {
|
|
129392
129370
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
129393
129371
|
}
|
|
129394
129372
|
}
|
|
129395
129373
|
}
|
|
129396
|
-
|
|
129397
|
-
|
|
129374
|
+
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
129375
|
+
for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) {
|
|
129376
|
+
var keywordEntry = _c[_b];
|
|
129377
|
+
if (!entryNames.has(keywordEntry.name)) {
|
|
129378
|
+
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
129379
|
+
}
|
|
129380
|
+
}
|
|
129381
|
+
for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) {
|
|
129382
|
+
var literal = literals_1[_d];
|
|
129398
129383
|
ts.insertSorted(entries, createCompletionEntryForLiteral(sourceFile, preferences, literal), compareCompletionEntries, /*allowDuplicates*/ true);
|
|
129399
129384
|
}
|
|
129400
129385
|
return {
|
|
@@ -131944,6 +131929,34 @@ var ts;
|
|
|
131944
131929
|
function keywordForNode(node) {
|
|
131945
131930
|
return ts.isIdentifier(node) ? node.originalKeywordKind || 0 /* Unknown */ : node.kind;
|
|
131946
131931
|
}
|
|
131932
|
+
function getContextualKeywords(contextToken, position) {
|
|
131933
|
+
var entries = [];
|
|
131934
|
+
/**
|
|
131935
|
+
* An `AssertClause` can come after an import declaration:
|
|
131936
|
+
* import * from "foo" |
|
|
131937
|
+
* import "foo" |
|
|
131938
|
+
* or after a re-export declaration that has a module specifier:
|
|
131939
|
+
* export { foo } from "foo" |
|
|
131940
|
+
* Source: https://tc39.es/proposal-import-assertions/
|
|
131941
|
+
*/
|
|
131942
|
+
if (contextToken) {
|
|
131943
|
+
var file = contextToken.getSourceFile();
|
|
131944
|
+
var parent = contextToken.parent;
|
|
131945
|
+
var tokenLine = file.getLineAndCharacterOfPosition(contextToken.end).line;
|
|
131946
|
+
var currentLine = file.getLineAndCharacterOfPosition(position).line;
|
|
131947
|
+
if ((ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent) && parent.moduleSpecifier)
|
|
131948
|
+
&& contextToken === parent.moduleSpecifier
|
|
131949
|
+
&& tokenLine === currentLine) {
|
|
131950
|
+
entries.push({
|
|
131951
|
+
name: ts.tokenToString(129 /* AssertKeyword */),
|
|
131952
|
+
kind: "keyword" /* keyword */,
|
|
131953
|
+
kindModifiers: "" /* none */,
|
|
131954
|
+
sortText: SortText.GlobalsOrKeywords,
|
|
131955
|
+
});
|
|
131956
|
+
}
|
|
131957
|
+
}
|
|
131958
|
+
return entries;
|
|
131959
|
+
}
|
|
131947
131960
|
/** Get the corresponding JSDocTag node if the position is in a jsDoc comment */
|
|
131948
131961
|
function getJsDocTagAtPosition(node, position) {
|
|
131949
131962
|
return ts.findAncestor(node, function (n) {
|
|
@@ -149296,9 +149309,10 @@ var ts;
|
|
|
149296
149309
|
var info = getFixesInfo(context, errorCode, span.start, /*useAutoImportProvider*/ true);
|
|
149297
149310
|
if (!info)
|
|
149298
149311
|
return undefined;
|
|
149299
|
-
var fixes = info.fixes, symbolName = info.symbolName;
|
|
149312
|
+
var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText;
|
|
149300
149313
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
149301
|
-
return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix,
|
|
149314
|
+
return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix,
|
|
149315
|
+
/*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); });
|
|
149302
149316
|
},
|
|
149303
149317
|
fixIds: [importFixId],
|
|
149304
149318
|
getAllCodeActions: function (context) {
|
|
@@ -149337,7 +149351,7 @@ var ts;
|
|
|
149337
149351
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
149338
149352
|
var fix = getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, /*position*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
|
|
149339
149353
|
if (fix) {
|
|
149340
|
-
addImport({ fixes: [fix], symbolName: symbolName });
|
|
149354
|
+
addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined });
|
|
149341
149355
|
}
|
|
149342
149356
|
}
|
|
149343
149357
|
function addImport(info) {
|
|
@@ -149508,7 +149522,8 @@ var ts;
|
|
|
149508
149522
|
var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
|
|
149509
149523
|
return {
|
|
149510
149524
|
moduleSpecifier: fix.moduleSpecifier,
|
|
149511
|
-
codeAction: codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix,
|
|
149525
|
+
codeAction: codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix,
|
|
149526
|
+
/*includeSymbolNameInDescription*/ false, ts.getQuotePreference(sourceFile, preferences), compilerOptions))
|
|
149512
149527
|
};
|
|
149513
149528
|
}
|
|
149514
149529
|
codefix.getImportCompletionAction = getImportCompletionAction;
|
|
@@ -149516,7 +149531,8 @@ var ts;
|
|
|
149516
149531
|
var compilerOptions = program.getCompilerOptions();
|
|
149517
149532
|
var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions);
|
|
149518
149533
|
var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program);
|
|
149519
|
-
|
|
149534
|
+
var includeSymbolNameInDescription = symbolName !== symbolToken.text;
|
|
149535
|
+
return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* Double */, compilerOptions));
|
|
149520
149536
|
}
|
|
149521
149537
|
codefix.getPromoteTypeOnlyCompletionAction = getPromoteTypeOnlyCompletionAction;
|
|
149522
149538
|
function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
@@ -149809,7 +149825,7 @@ var ts;
|
|
|
149809
149825
|
else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) {
|
|
149810
149826
|
var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions());
|
|
149811
149827
|
var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program);
|
|
149812
|
-
return fix && { fixes: [fix], symbolName: symbolName_1 };
|
|
149828
|
+
return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text };
|
|
149813
149829
|
}
|
|
149814
149830
|
else {
|
|
149815
149831
|
info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
|
|
@@ -149854,6 +149870,7 @@ var ts;
|
|
|
149854
149870
|
return 0 /* EqualTo */;
|
|
149855
149871
|
}
|
|
149856
149872
|
function getFixesInfoForUMDImport(_a, token) {
|
|
149873
|
+
var _b;
|
|
149857
149874
|
var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences;
|
|
149858
149875
|
var checker = program.getTypeChecker();
|
|
149859
149876
|
var umdSymbol = getUmdSymbol(token, checker);
|
|
@@ -149864,7 +149881,7 @@ var ts;
|
|
|
149864
149881
|
var exportInfos = [{ symbol: umdSymbol, moduleSymbol: symbol, moduleFileName: undefined, exportKind: 3 /* UMD */, targetFlags: symbol.flags, isFromPackageJson: false }];
|
|
149865
149882
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
149866
149883
|
var fixes = getImportFixes(exportInfos, symbolName, ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences);
|
|
149867
|
-
return { fixes: fixes, symbolName: symbolName };
|
|
149884
|
+
return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text };
|
|
149868
149885
|
}
|
|
149869
149886
|
function getUmdSymbol(token, checker) {
|
|
149870
149887
|
// try the identifier to see if it is the umd symbol
|
|
@@ -149935,7 +149952,7 @@ var ts;
|
|
|
149935
149952
|
var _ = _a[0], exportInfos = _a[1];
|
|
149936
149953
|
return getImportFixes(exportInfos, symbolName, symbolToken.getStart(sourceFile), isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences);
|
|
149937
149954
|
}));
|
|
149938
|
-
return { fixes: fixes, symbolName: symbolName };
|
|
149955
|
+
return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text };
|
|
149939
149956
|
}
|
|
149940
149957
|
function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) {
|
|
149941
149958
|
var checker = program.getTypeChecker();
|
|
@@ -150030,14 +150047,14 @@ var ts;
|
|
|
150030
150047
|
// allowSyntheticDefaultImports/esModuleInterop is enabled.
|
|
150031
150048
|
return allowSyntheticDefaults ? 1 /* Default */ : 3 /* CommonJS */;
|
|
150032
150049
|
}
|
|
150033
|
-
function codeActionForFix(context, sourceFile, symbolName, fix, quotePreference, compilerOptions) {
|
|
150050
|
+
function codeActionForFix(context, sourceFile, symbolName, fix, includeSymbolNameInDescription, quotePreference, compilerOptions) {
|
|
150034
150051
|
var diag;
|
|
150035
150052
|
var changes = ts.textChanges.ChangeTracker.with(context, function (tracker) {
|
|
150036
|
-
diag = codeActionForFixWorker(tracker, sourceFile, symbolName, fix, quotePreference, compilerOptions);
|
|
150053
|
+
diag = codeActionForFixWorker(tracker, sourceFile, symbolName, fix, includeSymbolNameInDescription, quotePreference, compilerOptions);
|
|
150037
150054
|
});
|
|
150038
150055
|
return codefix.createCodeFixAction(codefix.importFixName, changes, diag, importFixId, ts.Diagnostics.Add_all_missing_imports);
|
|
150039
150056
|
}
|
|
150040
|
-
function codeActionForFixWorker(changes, sourceFile, symbolName, fix, quotePreference, compilerOptions) {
|
|
150057
|
+
function codeActionForFixWorker(changes, sourceFile, symbolName, fix, includeSymbolNameInDescription, quotePreference, compilerOptions) {
|
|
150041
150058
|
switch (fix.kind) {
|
|
150042
150059
|
case 0 /* UseNamespace */:
|
|
150043
150060
|
addNamespaceQualifier(changes, sourceFile, fix);
|
|
@@ -150049,11 +150066,9 @@ var ts;
|
|
|
150049
150066
|
var importClauseOrBindingPattern = fix.importClauseOrBindingPattern, importKind = fix.importKind, addAsTypeOnly = fix.addAsTypeOnly, moduleSpecifier = fix.moduleSpecifier;
|
|
150050
150067
|
doAddExistingFix(changes, sourceFile, importClauseOrBindingPattern, importKind === 1 /* Default */ ? { name: symbolName, addAsTypeOnly: addAsTypeOnly } : undefined, importKind === 0 /* Named */ ? [{ name: symbolName, addAsTypeOnly: addAsTypeOnly }] : ts.emptyArray, compilerOptions);
|
|
150051
150068
|
var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier);
|
|
150052
|
-
return
|
|
150053
|
-
|
|
150054
|
-
|
|
150055
|
-
moduleSpecifierWithoutQuotes
|
|
150056
|
-
]; // you too!
|
|
150069
|
+
return includeSymbolNameInDescription
|
|
150070
|
+
? [ts.Diagnostics.Import_0_from_1, symbolName, moduleSpecifierWithoutQuotes]
|
|
150071
|
+
: [ts.Diagnostics.Update_import_from_0, moduleSpecifierWithoutQuotes];
|
|
150057
150072
|
}
|
|
150058
150073
|
case 3 /* AddNew */: {
|
|
150059
150074
|
var importKind = fix.importKind, moduleSpecifier = fix.moduleSpecifier, addAsTypeOnly = fix.addAsTypeOnly, useRequire = fix.useRequire;
|
|
@@ -150062,7 +150077,9 @@ var ts;
|
|
|
150062
150077
|
var namedImports = importKind === 0 /* Named */ ? [{ name: symbolName, addAsTypeOnly: addAsTypeOnly }] : undefined;
|
|
150063
150078
|
var namespaceLikeImport = importKind === 2 /* Namespace */ || importKind === 3 /* CommonJS */ ? { importKind: importKind, name: symbolName, addAsTypeOnly: addAsTypeOnly } : undefined;
|
|
150064
150079
|
ts.insertImports(changes, sourceFile, getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport), /*blankLineBetween*/ true);
|
|
150065
|
-
return
|
|
150080
|
+
return includeSymbolNameInDescription
|
|
150081
|
+
? [ts.Diagnostics.Import_0_from_1, symbolName, moduleSpecifier]
|
|
150082
|
+
: [ts.Diagnostics.Add_import_from_0, moduleSpecifier];
|
|
150066
150083
|
}
|
|
150067
150084
|
case 4 /* PromoteTypeOnly */: {
|
|
150068
150085
|
var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration;
|