@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/typescript.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220128";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -5112,14 +5112,13 @@ var ts;
|
|
|
5112
5112
|
// Flags that require TypeFlags.Object
|
|
5113
5113
|
ObjectFlags[ObjectFlags["ContainsSpread"] = 4194304] = "ContainsSpread";
|
|
5114
5114
|
ObjectFlags[ObjectFlags["ObjectRestType"] = 8388608] = "ObjectRestType";
|
|
5115
|
-
ObjectFlags[ObjectFlags["InstantiationExpressionType"] = 16777216] = "InstantiationExpressionType";
|
|
5116
5115
|
/* @internal */
|
|
5117
|
-
ObjectFlags[ObjectFlags["IsClassInstanceClone"] =
|
|
5116
|
+
ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
5118
5117
|
// Flags that require TypeFlags.Object and ObjectFlags.Reference
|
|
5119
5118
|
/* @internal */
|
|
5120
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] =
|
|
5119
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
5121
5120
|
/* @internal */
|
|
5122
|
-
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] =
|
|
5121
|
+
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
|
5123
5122
|
// Flags that require TypeFlags.UnionOrIntersection or TypeFlags.Substitution
|
|
5124
5123
|
/* @internal */
|
|
5125
5124
|
ObjectFlags[ObjectFlags["IsGenericTypeComputed"] = 4194304] = "IsGenericTypeComputed";
|
|
@@ -8725,7 +8724,6 @@ var ts;
|
|
|
8725
8724
|
Cannot_assign_to_0_because_it_is_an_import: diag(2632, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_an_import_2632", "Cannot assign to '{0}' because it is an import."),
|
|
8726
8725
|
JSX_property_access_expressions_cannot_include_JSX_namespace_names: diag(2633, ts.DiagnosticCategory.Error, "JSX_property_access_expressions_cannot_include_JSX_namespace_names_2633", "JSX property access expressions cannot include JSX namespace names"),
|
|
8727
8726
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8728
|
-
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."),
|
|
8729
8727
|
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."),
|
|
8730
8728
|
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."),
|
|
8731
8729
|
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."),
|
|
@@ -9639,9 +9637,8 @@ var ts;
|
|
|
9639
9637
|
Remove_variable_statement: diag(90010, ts.DiagnosticCategory.Message, "Remove_variable_statement_90010", "Remove variable statement"),
|
|
9640
9638
|
Remove_template_tag: diag(90011, ts.DiagnosticCategory.Message, "Remove_template_tag_90011", "Remove template tag"),
|
|
9641
9639
|
Remove_type_parameters: diag(90012, ts.DiagnosticCategory.Message, "Remove_type_parameters_90012", "Remove type parameters"),
|
|
9642
|
-
|
|
9640
|
+
Import_0_from_1: diag(90013, ts.DiagnosticCategory.Message, "Import_0_from_1_90013", "Import '{0}' from \"{1}\""),
|
|
9643
9641
|
Change_0_to_1: diag(90014, ts.DiagnosticCategory.Message, "Change_0_to_1_90014", "Change '{0}' to '{1}'"),
|
|
9644
|
-
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}\""),
|
|
9645
9642
|
Declare_property_0: diag(90016, ts.DiagnosticCategory.Message, "Declare_property_0_90016", "Declare property '{0}'"),
|
|
9646
9643
|
Add_index_signature_for_property_0: diag(90017, ts.DiagnosticCategory.Message, "Add_index_signature_for_property_0_90017", "Add index signature for property '{0}'"),
|
|
9647
9644
|
Disable_checking_for_this_file: diag(90018, ts.DiagnosticCategory.Message, "Disable_checking_for_this_file_90018", "Disable checking for this file"),
|
|
@@ -9658,8 +9655,6 @@ var ts;
|
|
|
9658
9655
|
Add_async_modifier_to_containing_function: diag(90029, ts.DiagnosticCategory.Message, "Add_async_modifier_to_containing_function_90029", "Add async modifier to containing function"),
|
|
9659
9656
|
Replace_infer_0_with_unknown: diag(90030, ts.DiagnosticCategory.Message, "Replace_infer_0_with_unknown_90030", "Replace 'infer {0}' with 'unknown'"),
|
|
9660
9657
|
Replace_all_unused_infer_with_unknown: diag(90031, ts.DiagnosticCategory.Message, "Replace_all_unused_infer_with_unknown_90031", "Replace all unused 'infer' with 'unknown'"),
|
|
9661
|
-
Import_default_0_from_module_1: diag(90032, ts.DiagnosticCategory.Message, "Import_default_0_from_module_1_90032", "Import default '{0}' from module \"{1}\""),
|
|
9662
|
-
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}\""),
|
|
9663
9658
|
Add_parameter_name: diag(90034, ts.DiagnosticCategory.Message, "Add_parameter_name_90034", "Add parameter name"),
|
|
9664
9659
|
Declare_private_property_0: diag(90035, ts.DiagnosticCategory.Message, "Declare_private_property_0_90035", "Declare private property '{0}'"),
|
|
9665
9660
|
Replace_0_with_Promise_1: diag(90036, ts.DiagnosticCategory.Message, "Replace_0_with_Promise_1_90036", "Replace '{0}' with 'Promise<{1}>'"),
|
|
@@ -9671,6 +9666,8 @@ var ts;
|
|
|
9671
9666
|
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}'"),
|
|
9672
9667
|
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}\""),
|
|
9673
9668
|
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}\""),
|
|
9669
|
+
Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""),
|
|
9670
|
+
Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""),
|
|
9674
9671
|
Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
9675
9672
|
Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
9676
9673
|
Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -13611,7 +13608,6 @@ var ts;
|
|
|
13611
13608
|
case 110 /* TrueKeyword */:
|
|
13612
13609
|
case 106 /* SuperKeyword */:
|
|
13613
13610
|
case 229 /* NonNullExpression */:
|
|
13614
|
-
case 227 /* ExpressionWithTypeArguments */:
|
|
13615
13611
|
case 230 /* MetaProperty */:
|
|
13616
13612
|
case 100 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
|
|
13617
13613
|
return true;
|
|
@@ -15313,7 +15309,7 @@ var ts;
|
|
|
15313
15309
|
case 114 /* VoidKeyword */:
|
|
15314
15310
|
return node.parent.kind !== 216 /* VoidExpression */;
|
|
15315
15311
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15316
|
-
return
|
|
15312
|
+
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
|
15317
15313
|
case 162 /* TypeParameter */:
|
|
15318
15314
|
return node.parent.kind === 194 /* MappedType */ || node.parent.kind === 189 /* InferType */;
|
|
15319
15315
|
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
|
@@ -15350,7 +15346,7 @@ var ts;
|
|
|
15350
15346
|
}
|
|
15351
15347
|
switch (parent.kind) {
|
|
15352
15348
|
case 227 /* ExpressionWithTypeArguments */:
|
|
15353
|
-
return
|
|
15349
|
+
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
15354
15350
|
case 162 /* TypeParameter */:
|
|
15355
15351
|
return node === parent.constraint;
|
|
15356
15352
|
case 342 /* JSDocTemplateTag */:
|
|
@@ -16053,7 +16049,7 @@ var ts;
|
|
|
16053
16049
|
case 296 /* SpreadAssignment */:
|
|
16054
16050
|
return true;
|
|
16055
16051
|
case 227 /* ExpressionWithTypeArguments */:
|
|
16056
|
-
return parent.expression === node &&
|
|
16052
|
+
return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
|
16057
16053
|
case 295 /* ShorthandPropertyAssignment */:
|
|
16058
16054
|
return parent.objectAssignmentInitializer === node;
|
|
16059
16055
|
default:
|
|
@@ -21070,6 +21066,59 @@ var ts;
|
|
|
21070
21066
|
return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType);
|
|
21071
21067
|
}
|
|
21072
21068
|
ts.isThisTypeParameter = isThisTypeParameter;
|
|
21069
|
+
function getNodeModulePathParts(fullPath) {
|
|
21070
|
+
// If fullPath can't be valid module file within node_modules, returns undefined.
|
|
21071
|
+
// Example of expected pattern: /base/path/node_modules/[@scope/otherpackage/@otherscope/node_modules/]package/[subdirectory/]file.js
|
|
21072
|
+
// Returns indices: ^ ^ ^ ^
|
|
21073
|
+
var topLevelNodeModulesIndex = 0;
|
|
21074
|
+
var topLevelPackageNameIndex = 0;
|
|
21075
|
+
var packageRootIndex = 0;
|
|
21076
|
+
var fileNameIndex = 0;
|
|
21077
|
+
var States;
|
|
21078
|
+
(function (States) {
|
|
21079
|
+
States[States["BeforeNodeModules"] = 0] = "BeforeNodeModules";
|
|
21080
|
+
States[States["NodeModules"] = 1] = "NodeModules";
|
|
21081
|
+
States[States["Scope"] = 2] = "Scope";
|
|
21082
|
+
States[States["PackageContent"] = 3] = "PackageContent";
|
|
21083
|
+
})(States || (States = {}));
|
|
21084
|
+
var partStart = 0;
|
|
21085
|
+
var partEnd = 0;
|
|
21086
|
+
var state = 0 /* BeforeNodeModules */;
|
|
21087
|
+
while (partEnd >= 0) {
|
|
21088
|
+
partStart = partEnd;
|
|
21089
|
+
partEnd = fullPath.indexOf("/", partStart + 1);
|
|
21090
|
+
switch (state) {
|
|
21091
|
+
case 0 /* BeforeNodeModules */:
|
|
21092
|
+
if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
|
|
21093
|
+
topLevelNodeModulesIndex = partStart;
|
|
21094
|
+
topLevelPackageNameIndex = partEnd;
|
|
21095
|
+
state = 1 /* NodeModules */;
|
|
21096
|
+
}
|
|
21097
|
+
break;
|
|
21098
|
+
case 1 /* NodeModules */:
|
|
21099
|
+
case 2 /* Scope */:
|
|
21100
|
+
if (state === 1 /* NodeModules */ && fullPath.charAt(partStart + 1) === "@") {
|
|
21101
|
+
state = 2 /* Scope */;
|
|
21102
|
+
}
|
|
21103
|
+
else {
|
|
21104
|
+
packageRootIndex = partEnd;
|
|
21105
|
+
state = 3 /* PackageContent */;
|
|
21106
|
+
}
|
|
21107
|
+
break;
|
|
21108
|
+
case 3 /* PackageContent */:
|
|
21109
|
+
if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
|
|
21110
|
+
state = 1 /* NodeModules */;
|
|
21111
|
+
}
|
|
21112
|
+
else {
|
|
21113
|
+
state = 3 /* PackageContent */;
|
|
21114
|
+
}
|
|
21115
|
+
break;
|
|
21116
|
+
}
|
|
21117
|
+
}
|
|
21118
|
+
fileNameIndex = partStart;
|
|
21119
|
+
return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
|
|
21120
|
+
}
|
|
21121
|
+
ts.getNodeModulePathParts = getNodeModulePathParts;
|
|
21073
21122
|
})(ts || (ts = {}));
|
|
21074
21123
|
/* @internal */
|
|
21075
21124
|
var ts;
|
|
@@ -22987,18 +23036,16 @@ var ts;
|
|
|
22987
23036
|
return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type);
|
|
22988
23037
|
}
|
|
22989
23038
|
// @api
|
|
22990
|
-
function createTypeQueryNode(exprName
|
|
23039
|
+
function createTypeQueryNode(exprName) {
|
|
22991
23040
|
var node = createBaseNode(180 /* TypeQuery */);
|
|
22992
23041
|
node.exprName = exprName;
|
|
22993
|
-
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
22994
23042
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
22995
23043
|
return node;
|
|
22996
23044
|
}
|
|
22997
23045
|
// @api
|
|
22998
|
-
function updateTypeQueryNode(node, exprName
|
|
23046
|
+
function updateTypeQueryNode(node, exprName) {
|
|
22999
23047
|
return node.exprName !== exprName
|
|
23000
|
-
|
|
23001
|
-
? update(createTypeQueryNode(exprName, typeArguments), node)
|
|
23048
|
+
? update(createTypeQueryNode(exprName), node)
|
|
23002
23049
|
: node;
|
|
23003
23050
|
}
|
|
23004
23051
|
// @api
|
|
@@ -30114,8 +30161,7 @@ var ts;
|
|
|
30114
30161
|
visitNode(cbNode, node.parameterName) ||
|
|
30115
30162
|
visitNode(cbNode, node.type);
|
|
30116
30163
|
case 180 /* TypeQuery */:
|
|
30117
|
-
return visitNode(cbNode, node.exprName)
|
|
30118
|
-
visitNodes(cbNode, cbNodes, node.typeArguments);
|
|
30164
|
+
return visitNode(cbNode, node.exprName);
|
|
30119
30165
|
case 181 /* TypeLiteral */:
|
|
30120
30166
|
return visitNodes(cbNode, cbNodes, node.members);
|
|
30121
30167
|
case 182 /* ArrayType */:
|
|
@@ -32648,9 +32694,7 @@ var ts;
|
|
|
32648
32694
|
function parseTypeQuery() {
|
|
32649
32695
|
var pos = getNodePos();
|
|
32650
32696
|
parseExpected(112 /* TypeOfKeyword */);
|
|
32651
|
-
|
|
32652
|
-
var typeArguments = tryParseTypeArguments();
|
|
32653
|
-
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
32697
|
+
return finishNode(factory.createTypeQueryNode(parseEntityName(/*allowReservedWords*/ true)), pos);
|
|
32654
32698
|
}
|
|
32655
32699
|
function parseTypeParameter() {
|
|
32656
32700
|
var pos = getNodePos();
|
|
@@ -33589,7 +33633,7 @@ var ts;
|
|
|
33589
33633
|
function parseInitializer() {
|
|
33590
33634
|
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
33591
33635
|
}
|
|
33592
|
-
function parseAssignmentExpressionOrHigher() {
|
|
33636
|
+
function parseAssignmentExpressionOrHigher(parsingConditionalExpression) {
|
|
33593
33637
|
// AssignmentExpression[in,yield]:
|
|
33594
33638
|
// 1) ConditionalExpression[?in,?yield]
|
|
33595
33639
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -33615,7 +33659,7 @@ var ts;
|
|
|
33615
33659
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
33616
33660
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
33617
33661
|
// with AssignmentExpression if we see one.
|
|
33618
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
33662
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(parsingConditionalExpression) || tryParseAsyncSimpleArrowFunctionExpression(parsingConditionalExpression);
|
|
33619
33663
|
if (arrowExpression) {
|
|
33620
33664
|
return arrowExpression;
|
|
33621
33665
|
}
|
|
@@ -33634,7 +33678,7 @@ var ts;
|
|
|
33634
33678
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
33635
33679
|
// identifier and the current token is an arrow.
|
|
33636
33680
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
33637
|
-
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
33681
|
+
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined, parsingConditionalExpression);
|
|
33638
33682
|
}
|
|
33639
33683
|
// Now see if we might be in cases '2' or '3'.
|
|
33640
33684
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -33643,7 +33687,7 @@ var ts;
|
|
|
33643
33687
|
// Note: we call reScanGreaterToken so that we get an appropriately merged token
|
|
33644
33688
|
// for cases like `> > =` becoming `>>=`
|
|
33645
33689
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
33646
|
-
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
33690
|
+
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(parsingConditionalExpression), pos);
|
|
33647
33691
|
}
|
|
33648
33692
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
33649
33693
|
return parseConditionalExpressionRest(expr, pos);
|
|
@@ -33694,7 +33738,7 @@ var ts;
|
|
|
33694
33738
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
33695
33739
|
}
|
|
33696
33740
|
}
|
|
33697
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
33741
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier, parsingConditionalExpression) {
|
|
33698
33742
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
33699
33743
|
var parameter = factory.createParameterDeclaration(
|
|
33700
33744
|
/*decorators*/ undefined,
|
|
@@ -33706,11 +33750,11 @@ var ts;
|
|
|
33706
33750
|
finishNode(parameter, identifier.pos);
|
|
33707
33751
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
33708
33752
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
33709
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
33753
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, parsingConditionalExpression);
|
|
33710
33754
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
33711
33755
|
return addJSDocComment(finishNode(node, pos));
|
|
33712
33756
|
}
|
|
33713
|
-
function tryParseParenthesizedArrowFunctionExpression() {
|
|
33757
|
+
function tryParseParenthesizedArrowFunctionExpression(parsingConditionalExpression) {
|
|
33714
33758
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
33715
33759
|
if (triState === 0 /* False */) {
|
|
33716
33760
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -33721,8 +33765,8 @@ var ts;
|
|
|
33721
33765
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
33722
33766
|
// expression instead.
|
|
33723
33767
|
return triState === 1 /* True */ ?
|
|
33724
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
33725
|
-
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
33768
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, parsingConditionalExpression) :
|
|
33769
|
+
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalExpression); });
|
|
33726
33770
|
}
|
|
33727
33771
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
33728
33772
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -33852,25 +33896,25 @@ var ts;
|
|
|
33852
33896
|
return 2 /* Unknown */;
|
|
33853
33897
|
}
|
|
33854
33898
|
}
|
|
33855
|
-
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
33899
|
+
function parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalExpression) {
|
|
33856
33900
|
var tokenPos = scanner.getTokenPos();
|
|
33857
33901
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
33858
33902
|
return undefined;
|
|
33859
33903
|
}
|
|
33860
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
33904
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, parsingConditionalExpression);
|
|
33861
33905
|
if (!result) {
|
|
33862
33906
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
33863
33907
|
}
|
|
33864
33908
|
return result;
|
|
33865
33909
|
}
|
|
33866
|
-
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
33910
|
+
function tryParseAsyncSimpleArrowFunctionExpression(parsingConditionalExpression) {
|
|
33867
33911
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
33868
33912
|
if (token() === 131 /* AsyncKeyword */) {
|
|
33869
33913
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
33870
33914
|
var pos = getNodePos();
|
|
33871
33915
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
33872
33916
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
33873
|
-
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
33917
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier, parsingConditionalExpression);
|
|
33874
33918
|
}
|
|
33875
33919
|
}
|
|
33876
33920
|
return undefined;
|
|
@@ -33894,7 +33938,7 @@ var ts;
|
|
|
33894
33938
|
}
|
|
33895
33939
|
return 0 /* False */;
|
|
33896
33940
|
}
|
|
33897
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
33941
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, parsingConditionalExpression) {
|
|
33898
33942
|
var pos = getNodePos();
|
|
33899
33943
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
33900
33944
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -33920,6 +33964,20 @@ var ts;
|
|
|
33920
33964
|
return undefined;
|
|
33921
33965
|
}
|
|
33922
33966
|
}
|
|
33967
|
+
// Given:
|
|
33968
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
33969
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
33970
|
+
// ({ y }) : z => ({ z })
|
|
33971
|
+
// This is a valid arrow function with "z" as the return type.
|
|
33972
|
+
//
|
|
33973
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
33974
|
+
// terminates the true side, so cannot be the return type. If we are in the
|
|
33975
|
+
// false side, we may still be within the true side of a parent conditional
|
|
33976
|
+
// expression, so don't allow it to be a return type either.
|
|
33977
|
+
if (parsingConditionalExpression && token() === 58 /* ColonToken */) {
|
|
33978
|
+
ts.Debug.assert(!allowAmbiguity);
|
|
33979
|
+
return undefined;
|
|
33980
|
+
}
|
|
33923
33981
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
33924
33982
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
33925
33983
|
return undefined;
|
|
@@ -33948,12 +34006,12 @@ var ts;
|
|
|
33948
34006
|
var lastToken = token();
|
|
33949
34007
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
33950
34008
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
33951
|
-
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
|
|
34009
|
+
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), parsingConditionalExpression)
|
|
33952
34010
|
: parseIdentifier();
|
|
33953
34011
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
33954
34012
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
33955
34013
|
}
|
|
33956
|
-
function parseArrowFunctionExpressionBody(isAsync) {
|
|
34014
|
+
function parseArrowFunctionExpressionBody(isAsync, parsingConditionalExpression) {
|
|
33957
34015
|
if (token() === 18 /* OpenBraceToken */) {
|
|
33958
34016
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
33959
34017
|
}
|
|
@@ -33981,8 +34039,8 @@ var ts;
|
|
|
33981
34039
|
var savedTopLevel = topLevel;
|
|
33982
34040
|
topLevel = false;
|
|
33983
34041
|
var node = isAsync
|
|
33984
|
-
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
33985
|
-
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
34042
|
+
? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalExpression); })
|
|
34043
|
+
: doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalExpression); });
|
|
33986
34044
|
topLevel = savedTopLevel;
|
|
33987
34045
|
return node;
|
|
33988
34046
|
}
|
|
@@ -33995,8 +34053,8 @@ var ts;
|
|
|
33995
34053
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
33996
34054
|
// we do not that for the 'whenFalse' part.
|
|
33997
34055
|
var colonToken;
|
|
33998
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
33999
|
-
? parseAssignmentExpressionOrHigher()
|
|
34056
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*parsingConditionalExpression*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34057
|
+
? parseAssignmentExpressionOrHigher(/*parsingConditionalExpression*/ true)
|
|
34000
34058
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34001
34059
|
}
|
|
34002
34060
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -34767,16 +34825,12 @@ var ts;
|
|
|
34767
34825
|
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
|
|
34768
34826
|
continue;
|
|
34769
34827
|
}
|
|
34770
|
-
|
|
34771
|
-
|
|
34772
|
-
|
|
34773
|
-
|
|
34774
|
-
|
|
34775
|
-
|
|
34776
|
-
continue;
|
|
34777
|
-
}
|
|
34778
|
-
expression = finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
34779
|
-
break;
|
|
34828
|
+
var argumentList = parseArgumentList();
|
|
34829
|
+
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34830
|
+
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
|
|
34831
|
+
factory.createCallExpression(expression, typeArguments, argumentList);
|
|
34832
|
+
expression = finishNode(callExpr, pos);
|
|
34833
|
+
continue;
|
|
34780
34834
|
}
|
|
34781
34835
|
}
|
|
34782
34836
|
else if (token() === 20 /* OpenParenToken */) {
|
|
@@ -34816,23 +34870,20 @@ var ts;
|
|
|
34816
34870
|
// If it doesn't have the closing `>` then it's definitely not an type argument list.
|
|
34817
34871
|
return undefined;
|
|
34818
34872
|
}
|
|
34819
|
-
//
|
|
34820
|
-
//
|
|
34821
|
-
|
|
34822
|
-
|
|
34823
|
-
|
|
34873
|
+
// If we have a '<', then only parse this as a argument list if the type arguments
|
|
34874
|
+
// are complete and we have an open paren. if we don't, rewind and return nothing.
|
|
34875
|
+
return typeArguments && canFollowTypeArgumentsInExpression()
|
|
34876
|
+
? typeArguments
|
|
34877
|
+
: undefined;
|
|
34824
34878
|
}
|
|
34825
34879
|
function canFollowTypeArgumentsInExpression() {
|
|
34826
34880
|
switch (token()) {
|
|
34827
|
-
// These tokens can follow a type argument list in a call expression.
|
|
34828
34881
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
34829
34882
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
34830
34883
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
34831
|
-
//
|
|
34832
|
-
//
|
|
34833
|
-
// expression.
|
|
34884
|
+
// these are the only tokens can legally follow a type argument
|
|
34885
|
+
// list. So we definitely want to treat them as type arg lists.
|
|
34834
34886
|
// falls through
|
|
34835
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
34836
34887
|
case 24 /* DotToken */: // foo<x>.
|
|
34837
34888
|
case 21 /* CloseParenToken */: // foo<x>)
|
|
34838
34889
|
case 23 /* CloseBracketToken */: // foo<x>]
|
|
@@ -34851,10 +34902,20 @@ var ts;
|
|
|
34851
34902
|
case 51 /* BarToken */: // foo<x> |
|
|
34852
34903
|
case 19 /* CloseBraceToken */: // foo<x> }
|
|
34853
34904
|
case 1 /* EndOfFileToken */: // foo<x>
|
|
34905
|
+
// these cases can't legally follow a type arg list. However, they're not legal
|
|
34906
|
+
// expressions either. The user is probably in the middle of a generic type. So
|
|
34907
|
+
// treat it as such.
|
|
34854
34908
|
return true;
|
|
34909
|
+
case 27 /* CommaToken */: // foo<x>,
|
|
34910
|
+
case 18 /* OpenBraceToken */: // foo<x> {
|
|
34911
|
+
// We don't want to treat these as type arguments. Otherwise we'll parse this
|
|
34912
|
+
// as an invocation expression. Instead, we want to parse out the expression
|
|
34913
|
+
// in isolation from the type arguments.
|
|
34914
|
+
// falls through
|
|
34915
|
+
default:
|
|
34916
|
+
// Anything else treat as an expression.
|
|
34917
|
+
return false;
|
|
34855
34918
|
}
|
|
34856
|
-
// Treat anything else as an expression.
|
|
34857
|
-
return false;
|
|
34858
34919
|
}
|
|
34859
34920
|
function parsePrimaryExpression() {
|
|
34860
34921
|
switch (token()) {
|
|
@@ -35035,12 +35096,17 @@ var ts;
|
|
|
35035
35096
|
return finishNode(factory.createMetaProperty(103 /* NewKeyword */, name), pos);
|
|
35036
35097
|
}
|
|
35037
35098
|
var expressionPos = getNodePos();
|
|
35038
|
-
var expression =
|
|
35039
|
-
var typeArguments
|
|
35040
|
-
|
|
35041
|
-
|
|
35042
|
-
|
|
35043
|
-
|
|
35099
|
+
var expression = parsePrimaryExpression();
|
|
35100
|
+
var typeArguments;
|
|
35101
|
+
while (true) {
|
|
35102
|
+
expression = parseMemberExpressionRest(expressionPos, expression, /*allowOptionalChain*/ false);
|
|
35103
|
+
typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
35104
|
+
if (isTemplateStartOfTaggedTemplate()) {
|
|
35105
|
+
ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
|
|
35106
|
+
expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
|
|
35107
|
+
typeArguments = undefined;
|
|
35108
|
+
}
|
|
35109
|
+
break;
|
|
35044
35110
|
}
|
|
35045
35111
|
var argumentsArray;
|
|
35046
35112
|
if (token() === 20 /* OpenParenToken */) {
|
|
@@ -36137,9 +36203,6 @@ var ts;
|
|
|
36137
36203
|
function parseExpressionWithTypeArguments() {
|
|
36138
36204
|
var pos = getNodePos();
|
|
36139
36205
|
var expression = parseLeftHandSideExpressionOrHigher();
|
|
36140
|
-
if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
|
|
36141
|
-
return expression;
|
|
36142
|
-
}
|
|
36143
36206
|
var typeArguments = tryParseTypeArguments();
|
|
36144
36207
|
return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
|
|
36145
36208
|
}
|
|
@@ -48964,24 +49027,19 @@ var ts;
|
|
|
48964
49027
|
error(errorLocation, ts.Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), ts.declarationNameToString(errorLocation));
|
|
48965
49028
|
}
|
|
48966
49029
|
}
|
|
48967
|
-
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */) {
|
|
48968
|
-
|
|
49030
|
+
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
49031
|
+
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result);
|
|
49032
|
+
if (typeOnlyDeclaration) {
|
|
49033
|
+
var message = typeOnlyDeclaration.kind === 274 /* ExportSpecifier */
|
|
49034
|
+
? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
|
|
49035
|
+
: ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
49036
|
+
var unescapedName = ts.unescapeLeadingUnderscores(name);
|
|
49037
|
+
addTypeOnlyDeclarationRelatedInfo(error(errorLocation, message, unescapedName), typeOnlyDeclaration, unescapedName);
|
|
49038
|
+
}
|
|
48969
49039
|
}
|
|
48970
49040
|
}
|
|
48971
49041
|
return result;
|
|
48972
49042
|
}
|
|
48973
|
-
function checkSymbolUsageInExpressionContext(symbol, name, useSite) {
|
|
48974
|
-
if (!ts.isValidTypeOnlyAliasUseSite(useSite)) {
|
|
48975
|
-
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(symbol);
|
|
48976
|
-
if (typeOnlyDeclaration) {
|
|
48977
|
-
var message = typeOnlyDeclaration.kind === 274 /* ExportSpecifier */
|
|
48978
|
-
? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
|
|
48979
|
-
: ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
48980
|
-
var unescapedName = ts.unescapeLeadingUnderscores(name);
|
|
48981
|
-
addTypeOnlyDeclarationRelatedInfo(error(useSite, message, unescapedName), typeOnlyDeclaration, unescapedName);
|
|
48982
|
-
}
|
|
48983
|
-
}
|
|
48984
|
-
}
|
|
48985
49043
|
function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) {
|
|
48986
49044
|
if (!typeOnlyDeclaration)
|
|
48987
49045
|
return diagnostic;
|
|
@@ -51068,7 +51126,7 @@ var ts;
|
|
|
51068
51126
|
// get symbol of the first identifier of the entityName
|
|
51069
51127
|
var meaning;
|
|
51070
51128
|
if (entityName.parent.kind === 180 /* TypeQuery */ ||
|
|
51071
|
-
|
|
51129
|
+
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
|
|
51072
51130
|
entityName.parent.kind === 161 /* ComputedPropertyName */) {
|
|
51073
51131
|
// Typeof value
|
|
51074
51132
|
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
@@ -51179,7 +51237,7 @@ var ts;
|
|
|
51179
51237
|
return flags & 814775659 /* NodeBuilderFlagsMask */;
|
|
51180
51238
|
}
|
|
51181
51239
|
function isClassInstanceSide(type) {
|
|
51182
|
-
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) &
|
|
51240
|
+
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 16777216 /* IsClassInstanceClone */)));
|
|
51183
51241
|
}
|
|
51184
51242
|
function createNodeBuilder() {
|
|
51185
51243
|
return {
|
|
@@ -55107,7 +55165,7 @@ var ts;
|
|
|
55107
55165
|
members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
|
|
55108
55166
|
result.objectFlags |= (ts.getObjectFlags(type) & 8192 /* JSLiteral */); // Propagate JSLiteral flag
|
|
55109
55167
|
if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
|
|
55110
|
-
result.objectFlags |=
|
|
55168
|
+
result.objectFlags |= 16777216 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
|
|
55111
55169
|
}
|
|
55112
55170
|
return result;
|
|
55113
55171
|
}
|
|
@@ -57117,87 +57175,87 @@ var ts;
|
|
|
57117
57175
|
* Converts an AnonymousType to a ResolvedType.
|
|
57118
57176
|
*/
|
|
57119
57177
|
function resolveAnonymousTypeMembers(type) {
|
|
57178
|
+
var symbol = getMergedSymbol(type.symbol);
|
|
57120
57179
|
if (type.target) {
|
|
57121
57180
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57122
|
-
var
|
|
57181
|
+
var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
|
|
57123
57182
|
var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper);
|
|
57124
57183
|
var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper);
|
|
57125
|
-
var
|
|
57126
|
-
setStructuredTypeMembers(type,
|
|
57127
|
-
return;
|
|
57184
|
+
var indexInfos = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
|
|
57185
|
+
setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
|
|
57128
57186
|
}
|
|
57129
|
-
|
|
57130
|
-
if (symbol.flags & 2048 /* TypeLiteral */) {
|
|
57187
|
+
else if (symbol.flags & 2048 /* TypeLiteral */) {
|
|
57131
57188
|
setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57132
|
-
var
|
|
57133
|
-
var callSignatures = getSignaturesOfSymbol(
|
|
57134
|
-
var constructSignatures = getSignaturesOfSymbol(
|
|
57135
|
-
var
|
|
57136
|
-
setStructuredTypeMembers(type,
|
|
57137
|
-
return;
|
|
57138
|
-
}
|
|
57139
|
-
// Combinations of function, class, enum and module
|
|
57140
|
-
var members = emptySymbols;
|
|
57141
|
-
var indexInfos;
|
|
57142
|
-
if (symbol.exports) {
|
|
57143
|
-
members = getExportsOfSymbol(symbol);
|
|
57144
|
-
if (symbol === globalThisSymbol) {
|
|
57145
|
-
var varsOnly_1 = new ts.Map();
|
|
57146
|
-
members.forEach(function (p) {
|
|
57147
|
-
if (!(p.flags & 418 /* BlockScoped */)) {
|
|
57148
|
-
varsOnly_1.set(p.escapedName, p);
|
|
57149
|
-
}
|
|
57150
|
-
});
|
|
57151
|
-
members = varsOnly_1;
|
|
57152
|
-
}
|
|
57189
|
+
var members = getMembersOfSymbol(symbol);
|
|
57190
|
+
var callSignatures = getSignaturesOfSymbol(members.get("__call" /* Call */));
|
|
57191
|
+
var constructSignatures = getSignaturesOfSymbol(members.get("__new" /* New */));
|
|
57192
|
+
var indexInfos = getIndexInfosOfSymbol(symbol);
|
|
57193
|
+
setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
|
|
57153
57194
|
}
|
|
57154
|
-
|
|
57155
|
-
|
|
57156
|
-
|
|
57157
|
-
var
|
|
57158
|
-
|
|
57159
|
-
|
|
57160
|
-
|
|
57161
|
-
|
|
57195
|
+
else {
|
|
57196
|
+
// Combinations of function, class, enum and module
|
|
57197
|
+
var members = emptySymbols;
|
|
57198
|
+
var indexInfos = void 0;
|
|
57199
|
+
if (symbol.exports) {
|
|
57200
|
+
members = getExportsOfSymbol(symbol);
|
|
57201
|
+
if (symbol === globalThisSymbol) {
|
|
57202
|
+
var varsOnly_1 = new ts.Map();
|
|
57203
|
+
members.forEach(function (p) {
|
|
57204
|
+
if (!(p.flags & 418 /* BlockScoped */)) {
|
|
57205
|
+
varsOnly_1.set(p.escapedName, p);
|
|
57206
|
+
}
|
|
57207
|
+
});
|
|
57208
|
+
members = varsOnly_1;
|
|
57209
|
+
}
|
|
57162
57210
|
}
|
|
57163
|
-
|
|
57164
|
-
|
|
57211
|
+
var baseConstructorIndexInfo = void 0;
|
|
57212
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
57213
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57214
|
+
var classType = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57215
|
+
var baseConstructorType = getBaseConstructorTypeOfClass(classType);
|
|
57216
|
+
if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
|
|
57217
|
+
members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
|
|
57218
|
+
addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
|
|
57219
|
+
}
|
|
57220
|
+
else if (baseConstructorType === anyType) {
|
|
57221
|
+
baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
|
|
57222
|
+
}
|
|
57165
57223
|
}
|
|
57166
|
-
|
|
57167
|
-
|
|
57168
|
-
|
|
57169
|
-
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57170
|
-
}
|
|
57171
|
-
else {
|
|
57172
|
-
if (baseConstructorIndexInfo) {
|
|
57173
|
-
indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
|
|
57224
|
+
var indexSymbol = getIndexSymbolFromSymbolTable(members);
|
|
57225
|
+
if (indexSymbol) {
|
|
57226
|
+
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57174
57227
|
}
|
|
57175
|
-
|
|
57176
|
-
|
|
57177
|
-
|
|
57228
|
+
else {
|
|
57229
|
+
if (baseConstructorIndexInfo) {
|
|
57230
|
+
indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
|
|
57231
|
+
}
|
|
57232
|
+
if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
|
|
57233
|
+
ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
|
|
57234
|
+
indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
|
|
57235
|
+
}
|
|
57178
57236
|
}
|
|
57179
|
-
|
|
57180
|
-
|
|
57181
|
-
|
|
57182
|
-
|
|
57183
|
-
|
|
57184
|
-
|
|
57185
|
-
|
|
57186
|
-
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57187
|
-
}
|
|
57188
|
-
// And likewise for construct signatures for classes
|
|
57189
|
-
if (symbol.flags & 32 /* Class */) {
|
|
57190
|
-
var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57191
|
-
var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
|
|
57192
|
-
if (symbol.flags & 16 /* Function */) {
|
|
57193
|
-
constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
|
|
57194
|
-
createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
|
|
57195
|
-
undefined; }));
|
|
57237
|
+
setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
|
|
57238
|
+
// We resolve the members before computing the signatures because a signature may use
|
|
57239
|
+
// typeof with a qualified name expression that circularly references the type we are
|
|
57240
|
+
// in the process of resolving (see issue #6072). The temporarily empty signature list
|
|
57241
|
+
// will never be observed because a qualified name can't reference signatures.
|
|
57242
|
+
if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
|
|
57243
|
+
type.callSignatures = getSignaturesOfSymbol(symbol);
|
|
57196
57244
|
}
|
|
57197
|
-
|
|
57198
|
-
|
|
57245
|
+
// And likewise for construct signatures for classes
|
|
57246
|
+
if (symbol.flags & 32 /* Class */) {
|
|
57247
|
+
var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
|
|
57248
|
+
var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
|
|
57249
|
+
if (symbol.flags & 16 /* Function */) {
|
|
57250
|
+
constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
|
|
57251
|
+
createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
|
|
57252
|
+
undefined; }));
|
|
57253
|
+
}
|
|
57254
|
+
if (!constructSignatures.length) {
|
|
57255
|
+
constructSignatures = getDefaultConstructSignatures(classType_1);
|
|
57256
|
+
}
|
|
57257
|
+
type.constructSignatures = constructSignatures;
|
|
57199
57258
|
}
|
|
57200
|
-
type.constructSignatures = constructSignatures;
|
|
57201
57259
|
}
|
|
57202
57260
|
}
|
|
57203
57261
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
@@ -58189,8 +58247,8 @@ var ts;
|
|
|
58189
58247
|
var stringIndexInfo;
|
|
58190
58248
|
var applicableInfo;
|
|
58191
58249
|
var applicableInfos;
|
|
58192
|
-
for (var _i = 0,
|
|
58193
|
-
var info =
|
|
58250
|
+
for (var _i = 0, indexInfos_1 = indexInfos; _i < indexInfos_1.length; _i++) {
|
|
58251
|
+
var info = indexInfos_1[_i];
|
|
58194
58252
|
if (info.keyType === stringType) {
|
|
58195
58253
|
stringIndexInfo = info;
|
|
58196
58254
|
}
|
|
@@ -58754,14 +58812,14 @@ var ts;
|
|
|
58754
58812
|
}
|
|
58755
58813
|
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
58756
58814
|
if (indexSymbol.declarations) {
|
|
58757
|
-
var
|
|
58815
|
+
var indexInfos_2 = [];
|
|
58758
58816
|
var _loop_14 = function (declaration) {
|
|
58759
58817
|
if (declaration.parameters.length === 1) {
|
|
58760
58818
|
var parameter = declaration.parameters[0];
|
|
58761
58819
|
if (parameter.type) {
|
|
58762
58820
|
forEachType(getTypeFromTypeNode(parameter.type), function (keyType) {
|
|
58763
|
-
if (isValidIndexKeyType(keyType) && !findIndexInfo(
|
|
58764
|
-
|
|
58821
|
+
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_2, keyType)) {
|
|
58822
|
+
indexInfos_2.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
|
|
58765
58823
|
}
|
|
58766
58824
|
});
|
|
58767
58825
|
}
|
|
@@ -58771,7 +58829,7 @@ var ts;
|
|
|
58771
58829
|
var declaration = _a[_i];
|
|
58772
58830
|
_loop_14(declaration);
|
|
58773
58831
|
}
|
|
58774
|
-
return
|
|
58832
|
+
return indexInfos_2;
|
|
58775
58833
|
}
|
|
58776
58834
|
return ts.emptyArray;
|
|
58777
58835
|
}
|
|
@@ -59319,7 +59377,7 @@ var ts;
|
|
|
59319
59377
|
// The expression is processed as an identifier expression (section 4.3)
|
|
59320
59378
|
// or property access expression(section 4.10),
|
|
59321
59379
|
// the widened type(section 3.9) of which becomes the result.
|
|
59322
|
-
var type =
|
|
59380
|
+
var type = ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
59323
59381
|
links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type));
|
|
59324
59382
|
}
|
|
59325
59383
|
return links.resolvedType;
|
|
@@ -62023,9 +62081,7 @@ var ts;
|
|
|
62023
62081
|
return result;
|
|
62024
62082
|
}
|
|
62025
62083
|
function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
62026
|
-
var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
|
|
62027
|
-
type.objectFlags & 16777216 /* InstantiationExpressionType */ ? type.node :
|
|
62028
|
-
type.symbol.declarations[0];
|
|
62084
|
+
var declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.symbol.declarations[0];
|
|
62029
62085
|
var links = getNodeLinks(declaration);
|
|
62030
62086
|
var target = type.objectFlags & 4 /* Reference */ ? links.resolvedType :
|
|
62031
62087
|
type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
@@ -62041,8 +62097,8 @@ var ts;
|
|
|
62041
62097
|
outerTypeParameters = ts.addRange(outerTypeParameters, templateTagParameters);
|
|
62042
62098
|
}
|
|
62043
62099
|
typeParameters = outerTypeParameters || ts.emptyArray;
|
|
62044
|
-
var allDeclarations_1 = type.objectFlags &
|
|
62045
|
-
typeParameters = (target.objectFlags &
|
|
62100
|
+
var allDeclarations_1 = type.objectFlags & 4 /* Reference */ ? [declaration] : type.symbol.declarations;
|
|
62101
|
+
typeParameters = (target.objectFlags & 4 /* Reference */ || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
|
|
62046
62102
|
ts.filter(typeParameters, function (tp) { return ts.some(allDeclarations_1, function (d) { return isTypeParameterPossiblyReferenced(tp, d); }); }) :
|
|
62047
62103
|
typeParameters;
|
|
62048
62104
|
links.outerTypeParameters = typeParameters;
|
|
@@ -62214,9 +62270,6 @@ var ts;
|
|
|
62214
62270
|
mapper = combineTypeMappers(makeUnaryTypeMapper(origTypeParameter, freshTypeParameter), mapper);
|
|
62215
62271
|
freshTypeParameter.mapper = mapper;
|
|
62216
62272
|
}
|
|
62217
|
-
if (type.objectFlags & 16777216 /* InstantiationExpressionType */) {
|
|
62218
|
-
result.node = type.node;
|
|
62219
|
-
}
|
|
62220
62273
|
result.target = type;
|
|
62221
62274
|
result.mapper = mapper;
|
|
62222
62275
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -65391,8 +65444,8 @@ var ts;
|
|
|
65391
65444
|
var indexInfos = getIndexInfosOfType(target);
|
|
65392
65445
|
var targetHasStringIndex = ts.some(indexInfos, function (info) { return info.keyType === stringType; });
|
|
65393
65446
|
var result = -1 /* True */;
|
|
65394
|
-
for (var _i = 0,
|
|
65395
|
-
var targetInfo =
|
|
65447
|
+
for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
|
|
65448
|
+
var targetInfo = indexInfos_3[_i];
|
|
65396
65449
|
var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ :
|
|
65397
65450
|
isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, 3 /* Both */, reportErrors) :
|
|
65398
65451
|
typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState);
|
|
@@ -65999,10 +66052,10 @@ var ts;
|
|
|
65999
66052
|
if (!(ts.getObjectFlags(type) & 4 /* Reference */) || !(ts.getObjectFlags(type.target) & 3 /* ClassOrInterface */)) {
|
|
66000
66053
|
return undefined;
|
|
66001
66054
|
}
|
|
66002
|
-
if (ts.getObjectFlags(type) &
|
|
66003
|
-
return ts.getObjectFlags(type) &
|
|
66055
|
+
if (ts.getObjectFlags(type) & 33554432 /* IdenticalBaseTypeCalculated */) {
|
|
66056
|
+
return ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
|
|
66004
66057
|
}
|
|
66005
|
-
type.objectFlags |=
|
|
66058
|
+
type.objectFlags |= 33554432 /* IdenticalBaseTypeCalculated */;
|
|
66006
66059
|
var target = type.target;
|
|
66007
66060
|
if (ts.getObjectFlags(target) & 1 /* Class */) {
|
|
66008
66061
|
var baseTypeNode = getBaseTypeNodeOfClass(target);
|
|
@@ -66023,7 +66076,7 @@ var ts;
|
|
|
66023
66076
|
if (ts.length(getTypeArguments(type)) > ts.length(target.typeParameters)) {
|
|
66024
66077
|
instantiatedBase = getTypeWithThisArgument(instantiatedBase, ts.last(getTypeArguments(type)));
|
|
66025
66078
|
}
|
|
66026
|
-
type.objectFlags |=
|
|
66079
|
+
type.objectFlags |= 67108864 /* IdenticalBaseTypeExists */;
|
|
66027
66080
|
return type.cachedEquivalentBaseType = instantiatedBase;
|
|
66028
66081
|
}
|
|
66029
66082
|
function isEmptyLiteralType(type) {
|
|
@@ -66687,7 +66740,7 @@ var ts;
|
|
|
66687
66740
|
var result = !!(type.flags & 465829888 /* Instantiable */ ||
|
|
66688
66741
|
type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || ts.forEach(getTypeArguments(type), couldContainTypeVariables)) ||
|
|
66689
66742
|
objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
|
|
66690
|
-
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */
|
|
66743
|
+
objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */)) ||
|
|
66691
66744
|
type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && ts.some(type.types, couldContainTypeVariables));
|
|
66692
66745
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
66693
66746
|
type.objectFlags |= 1048576 /* CouldContainTypeVariablesComputed */ | (result ? 2097152 /* CouldContainTypeVariables */ : 0);
|
|
@@ -67604,8 +67657,8 @@ var ts;
|
|
|
67604
67657
|
var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* Mapped */) ? 8 /* HomomorphicMappedType */ : 0;
|
|
67605
67658
|
var indexInfos = getIndexInfosOfType(target);
|
|
67606
67659
|
if (isObjectTypeWithInferableIndex(source)) {
|
|
67607
|
-
for (var _i = 0,
|
|
67608
|
-
var targetInfo =
|
|
67660
|
+
for (var _i = 0, indexInfos_4 = indexInfos; _i < indexInfos_4.length; _i++) {
|
|
67661
|
+
var targetInfo = indexInfos_4[_i];
|
|
67609
67662
|
var propTypes = [];
|
|
67610
67663
|
for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
|
|
67611
67664
|
var prop = _b[_a];
|
|
@@ -67625,8 +67678,8 @@ var ts;
|
|
|
67625
67678
|
}
|
|
67626
67679
|
}
|
|
67627
67680
|
}
|
|
67628
|
-
for (var _e = 0,
|
|
67629
|
-
var targetInfo =
|
|
67681
|
+
for (var _e = 0, indexInfos_5 = indexInfos; _e < indexInfos_5.length; _e++) {
|
|
67682
|
+
var targetInfo = indexInfos_5[_e];
|
|
67630
67683
|
var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType);
|
|
67631
67684
|
if (sourceInfo) {
|
|
67632
67685
|
inferWithPriority(sourceInfo.type, targetInfo.type, priority);
|
|
@@ -75796,66 +75849,6 @@ var ts;
|
|
|
75796
75849
|
return node.flags & 32 /* OptionalChain */ ? checkNonNullChain(node) :
|
|
75797
75850
|
getNonNullableType(checkExpression(node.expression));
|
|
75798
75851
|
}
|
|
75799
|
-
function checkExpressionWithTypeArguments(node) {
|
|
75800
|
-
checkGrammarExpressionWithTypeArguments(node);
|
|
75801
|
-
var exprType = node.kind === 227 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) :
|
|
75802
|
-
ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) :
|
|
75803
|
-
checkExpression(node.exprName);
|
|
75804
|
-
var typeArguments = node.typeArguments;
|
|
75805
|
-
if (!ts.some(typeArguments)) {
|
|
75806
|
-
return exprType;
|
|
75807
|
-
}
|
|
75808
|
-
var funcType = getApparentType(exprType);
|
|
75809
|
-
if (funcType === silentNeverType || isErrorType(funcType)) {
|
|
75810
|
-
return funcType;
|
|
75811
|
-
}
|
|
75812
|
-
var hasSomeApplicableSignature = false;
|
|
75813
|
-
var nonApplicableType;
|
|
75814
|
-
var hasSignatures;
|
|
75815
|
-
var hasApplicableSignature;
|
|
75816
|
-
var result = mapType(funcType, getInstantiatedType);
|
|
75817
|
-
var errorType = hasSomeApplicableSignature ? nonApplicableType : funcType;
|
|
75818
|
-
if (errorType) {
|
|
75819
|
-
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)));
|
|
75820
|
-
}
|
|
75821
|
-
return result;
|
|
75822
|
-
function getInstantiatedType(type) {
|
|
75823
|
-
hasSignatures = false;
|
|
75824
|
-
hasApplicableSignature = false;
|
|
75825
|
-
var result = getInstantiatedTypeWorker(type);
|
|
75826
|
-
hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
|
|
75827
|
-
if (hasSignatures && !hasApplicableSignature) {
|
|
75828
|
-
nonApplicableType !== null && nonApplicableType !== void 0 ? nonApplicableType : (nonApplicableType = type);
|
|
75829
|
-
}
|
|
75830
|
-
return result;
|
|
75831
|
-
}
|
|
75832
|
-
function getInstantiatedTypeWorker(type) {
|
|
75833
|
-
if (type.flags & 524288 /* Object */) {
|
|
75834
|
-
var resolved = resolveStructuredTypeMembers(type);
|
|
75835
|
-
var callSignatures = getInstantiatedSignatures(resolved.callSignatures);
|
|
75836
|
-
var constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
|
|
75837
|
-
hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
|
|
75838
|
-
hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
|
|
75839
|
-
if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
|
|
75840
|
-
var result_11 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
|
|
75841
|
-
result_11.objectFlags |= 16777216 /* InstantiationExpressionType */;
|
|
75842
|
-
result_11.node = node;
|
|
75843
|
-
return result_11;
|
|
75844
|
-
}
|
|
75845
|
-
}
|
|
75846
|
-
else if (type.flags & 2097152 /* Intersection */) {
|
|
75847
|
-
return getIntersectionType(ts.sameMap(type.types, getInstantiatedTypeWorker));
|
|
75848
|
-
}
|
|
75849
|
-
return type;
|
|
75850
|
-
}
|
|
75851
|
-
function getInstantiatedSignatures(signatures) {
|
|
75852
|
-
var applicableSignatures = ts.filter(signatures, function (sig) { return !!sig.typeParameters && hasCorrectTypeArgumentArity(sig, typeArguments); });
|
|
75853
|
-
return ts.sameMap(applicableSignatures, function (sig) {
|
|
75854
|
-
var typeArgumentTypes = checkTypeArguments(sig, typeArguments, /*reportErrors*/ true);
|
|
75855
|
-
return typeArgumentTypes ? getSignatureInstantiation(sig, typeArgumentTypes, ts.isInJSFile(sig.declaration)) : sig;
|
|
75856
|
-
});
|
|
75857
|
-
}
|
|
75858
|
-
}
|
|
75859
75852
|
function checkMetaProperty(node) {
|
|
75860
75853
|
checkGrammarMetaProperty(node);
|
|
75861
75854
|
if (node.keywordToken === 103 /* NewKeyword */) {
|
|
@@ -78365,8 +78358,6 @@ var ts;
|
|
|
78365
78358
|
return checkAssertion(node);
|
|
78366
78359
|
case 229 /* NonNullExpression */:
|
|
78367
78360
|
return checkNonNullAssertion(node);
|
|
78368
|
-
case 227 /* ExpressionWithTypeArguments */:
|
|
78369
|
-
return checkExpressionWithTypeArguments(node);
|
|
78370
78361
|
case 230 /* MetaProperty */:
|
|
78371
78362
|
return checkMetaProperty(node);
|
|
78372
78363
|
case 214 /* DeleteExpression */:
|
|
@@ -79572,12 +79563,12 @@ var ts;
|
|
|
79572
79563
|
case 264 /* ImportEqualsDeclaration */:
|
|
79573
79564
|
case 267 /* NamespaceImport */:
|
|
79574
79565
|
case 266 /* ImportClause */:
|
|
79575
|
-
var
|
|
79566
|
+
var result_11 = 0 /* None */;
|
|
79576
79567
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
79577
79568
|
ts.forEach(target.declarations, function (d) {
|
|
79578
|
-
|
|
79569
|
+
result_11 |= getDeclarationSpaces(d);
|
|
79579
79570
|
});
|
|
79580
|
-
return
|
|
79571
|
+
return result_11;
|
|
79581
79572
|
case 253 /* VariableDeclaration */:
|
|
79582
79573
|
case 202 /* BindingElement */:
|
|
79583
79574
|
case 255 /* FunctionDeclaration */:
|
|
@@ -82164,8 +82155,8 @@ var ts;
|
|
|
82164
82155
|
}
|
|
82165
82156
|
}
|
|
82166
82157
|
if (indexInfos.length > 1) {
|
|
82167
|
-
for (var _d = 0,
|
|
82168
|
-
var info =
|
|
82158
|
+
for (var _d = 0, indexInfos_6 = indexInfos; _d < indexInfos_6.length; _d++) {
|
|
82159
|
+
var info = indexInfos_6[_d];
|
|
82169
82160
|
checkIndexConstraintForIndexSignature(type, info);
|
|
82170
82161
|
}
|
|
82171
82162
|
}
|
|
@@ -82191,8 +82182,8 @@ var ts;
|
|
|
82191
82182
|
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));
|
|
82192
82183
|
}
|
|
82193
82184
|
};
|
|
82194
|
-
for (var _i = 0,
|
|
82195
|
-
var info =
|
|
82185
|
+
for (var _i = 0, indexInfos_7 = indexInfos; _i < indexInfos_7.length; _i++) {
|
|
82186
|
+
var info = indexInfos_7[_i];
|
|
82196
82187
|
_loop_27(info);
|
|
82197
82188
|
}
|
|
82198
82189
|
}
|
|
@@ -82214,8 +82205,8 @@ var ts;
|
|
|
82214
82205
|
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));
|
|
82215
82206
|
}
|
|
82216
82207
|
};
|
|
82217
|
-
for (var _i = 0,
|
|
82218
|
-
var info =
|
|
82208
|
+
for (var _i = 0, indexInfos_8 = indexInfos; _i < indexInfos_8.length; _i++) {
|
|
82209
|
+
var info = indexInfos_8[_i];
|
|
82219
82210
|
_loop_28(info);
|
|
82220
82211
|
}
|
|
82221
82212
|
}
|
|
@@ -87811,7 +87802,7 @@ var ts;
|
|
|
87811
87802
|
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));
|
|
87812
87803
|
case 180 /* TypeQuery */:
|
|
87813
87804
|
ts.Debug.type(node);
|
|
87814
|
-
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName)
|
|
87805
|
+
return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName));
|
|
87815
87806
|
case 181 /* TypeLiteral */:
|
|
87816
87807
|
ts.Debug.type(node);
|
|
87817
87808
|
return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
|
|
@@ -90703,8 +90694,8 @@ var ts;
|
|
|
90703
90694
|
function generateClassElementDecorationExpressions(node, isStatic) {
|
|
90704
90695
|
var members = getDecoratedClassElements(node, isStatic);
|
|
90705
90696
|
var expressions;
|
|
90706
|
-
for (var _i = 0,
|
|
90707
|
-
var member =
|
|
90697
|
+
for (var _i = 0, members_6 = members; _i < members_6.length; _i++) {
|
|
90698
|
+
var member = members_6[_i];
|
|
90708
90699
|
var expression = generateClassElementDecorationExpression(node, member);
|
|
90709
90700
|
if (expression) {
|
|
90710
90701
|
if (!expressions) {
|
|
@@ -95905,8 +95896,8 @@ var ts;
|
|
|
95905
95896
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
95906
95897
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95907
95898
|
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
95908
|
-
var
|
|
95909
|
-
return
|
|
95899
|
+
var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
95900
|
+
return result_12 && factory.createPropertyAssignment("children", result_12);
|
|
95910
95901
|
}
|
|
95911
95902
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
95912
95903
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -109535,8 +109526,6 @@ var ts;
|
|
|
109535
109526
|
return emitAsExpression(node);
|
|
109536
109527
|
case 229 /* NonNullExpression */:
|
|
109537
109528
|
return emitNonNullExpression(node);
|
|
109538
|
-
case 227 /* ExpressionWithTypeArguments */:
|
|
109539
|
-
return emitExpressionWithTypeArguments(node);
|
|
109540
109529
|
case 230 /* MetaProperty */:
|
|
109541
109530
|
return emitMetaProperty(node);
|
|
109542
109531
|
case 231 /* SyntheticExpression */:
|
|
@@ -109981,7 +109970,6 @@ var ts;
|
|
|
109981
109970
|
writeKeyword("typeof");
|
|
109982
109971
|
writeSpace();
|
|
109983
109972
|
emit(node.exprName);
|
|
109984
|
-
emitTypeArguments(node, node.typeArguments);
|
|
109985
109973
|
}
|
|
109986
109974
|
function emitTypeLiteral(node) {
|
|
109987
109975
|
writePunctuation("{");
|
|
@@ -114941,15 +114929,15 @@ var ts;
|
|
|
114941
114929
|
// which per above occurred during the current program creation.
|
|
114942
114930
|
// Since we assume the filesystem does not change during program creation,
|
|
114943
114931
|
// it is safe to reuse resolutions from the earlier call.
|
|
114944
|
-
var
|
|
114932
|
+
var result_13 = [];
|
|
114945
114933
|
var i = 0;
|
|
114946
114934
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
114947
114935
|
var moduleName = moduleNames_1[_i];
|
|
114948
114936
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
114949
114937
|
i++;
|
|
114950
|
-
|
|
114938
|
+
result_13.push(resolvedModule);
|
|
114951
114939
|
}
|
|
114952
|
-
return
|
|
114940
|
+
return result_13;
|
|
114953
114941
|
}
|
|
114954
114942
|
// At this point, we know at least one of the following hold:
|
|
114955
114943
|
// - file has local declarations for ambient modules
|
|
@@ -120057,9 +120045,9 @@ var ts;
|
|
|
120057
120045
|
if (!preferSymlinks) {
|
|
120058
120046
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
120059
120047
|
// so we only need to remove them from the realpath filenames.
|
|
120060
|
-
var
|
|
120061
|
-
if (
|
|
120062
|
-
return
|
|
120048
|
+
var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
120049
|
+
if (result_14)
|
|
120050
|
+
return result_14;
|
|
120063
120051
|
}
|
|
120064
120052
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
120065
120053
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -120079,10 +120067,10 @@ var ts;
|
|
|
120079
120067
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
120080
120068
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
120081
120069
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
120082
|
-
var
|
|
120070
|
+
var result_15 = cb(option, target === referenceRedirect);
|
|
120083
120071
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
120084
|
-
if (
|
|
120085
|
-
return
|
|
120072
|
+
if (result_15)
|
|
120073
|
+
return result_15;
|
|
120086
120074
|
}
|
|
120087
120075
|
});
|
|
120088
120076
|
});
|
|
@@ -120317,7 +120305,7 @@ var ts;
|
|
|
120317
120305
|
if (!host.fileExists || !host.readFile) {
|
|
120318
120306
|
return undefined;
|
|
120319
120307
|
}
|
|
120320
|
-
var parts = getNodeModulePathParts(path);
|
|
120308
|
+
var parts = ts.getNodeModulePathParts(path);
|
|
120321
120309
|
if (!parts) {
|
|
120322
120310
|
return undefined;
|
|
120323
120311
|
}
|
|
@@ -120440,58 +120428,6 @@ var ts;
|
|
|
120440
120428
|
}
|
|
120441
120429
|
}
|
|
120442
120430
|
}
|
|
120443
|
-
function getNodeModulePathParts(fullPath) {
|
|
120444
|
-
// If fullPath can't be valid module file within node_modules, returns undefined.
|
|
120445
|
-
// Example of expected pattern: /base/path/node_modules/[@scope/otherpackage/@otherscope/node_modules/]package/[subdirectory/]file.js
|
|
120446
|
-
// Returns indices: ^ ^ ^ ^
|
|
120447
|
-
var topLevelNodeModulesIndex = 0;
|
|
120448
|
-
var topLevelPackageNameIndex = 0;
|
|
120449
|
-
var packageRootIndex = 0;
|
|
120450
|
-
var fileNameIndex = 0;
|
|
120451
|
-
var States;
|
|
120452
|
-
(function (States) {
|
|
120453
|
-
States[States["BeforeNodeModules"] = 0] = "BeforeNodeModules";
|
|
120454
|
-
States[States["NodeModules"] = 1] = "NodeModules";
|
|
120455
|
-
States[States["Scope"] = 2] = "Scope";
|
|
120456
|
-
States[States["PackageContent"] = 3] = "PackageContent";
|
|
120457
|
-
})(States || (States = {}));
|
|
120458
|
-
var partStart = 0;
|
|
120459
|
-
var partEnd = 0;
|
|
120460
|
-
var state = 0 /* BeforeNodeModules */;
|
|
120461
|
-
while (partEnd >= 0) {
|
|
120462
|
-
partStart = partEnd;
|
|
120463
|
-
partEnd = fullPath.indexOf("/", partStart + 1);
|
|
120464
|
-
switch (state) {
|
|
120465
|
-
case 0 /* BeforeNodeModules */:
|
|
120466
|
-
if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
|
|
120467
|
-
topLevelNodeModulesIndex = partStart;
|
|
120468
|
-
topLevelPackageNameIndex = partEnd;
|
|
120469
|
-
state = 1 /* NodeModules */;
|
|
120470
|
-
}
|
|
120471
|
-
break;
|
|
120472
|
-
case 1 /* NodeModules */:
|
|
120473
|
-
case 2 /* Scope */:
|
|
120474
|
-
if (state === 1 /* NodeModules */ && fullPath.charAt(partStart + 1) === "@") {
|
|
120475
|
-
state = 2 /* Scope */;
|
|
120476
|
-
}
|
|
120477
|
-
else {
|
|
120478
|
-
packageRootIndex = partEnd;
|
|
120479
|
-
state = 3 /* PackageContent */;
|
|
120480
|
-
}
|
|
120481
|
-
break;
|
|
120482
|
-
case 3 /* PackageContent */:
|
|
120483
|
-
if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
|
|
120484
|
-
state = 1 /* NodeModules */;
|
|
120485
|
-
}
|
|
120486
|
-
else {
|
|
120487
|
-
state = 3 /* PackageContent */;
|
|
120488
|
-
}
|
|
120489
|
-
break;
|
|
120490
|
-
}
|
|
120491
|
-
}
|
|
120492
|
-
fileNameIndex = partStart;
|
|
120493
|
-
return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
|
|
120494
|
-
}
|
|
120495
120431
|
function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
|
|
120496
120432
|
return ts.firstDefined(rootDirs, function (rootDir) {
|
|
120497
120433
|
var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
|
|
@@ -124392,7 +124328,7 @@ var ts;
|
|
|
124392
124328
|
case 199 /* ImportType */:
|
|
124393
124329
|
return !node.parent.isTypeOf;
|
|
124394
124330
|
case 227 /* ExpressionWithTypeArguments */:
|
|
124395
|
-
return ts.
|
|
124331
|
+
return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent);
|
|
124396
124332
|
}
|
|
124397
124333
|
return false;
|
|
124398
124334
|
}
|
|
@@ -127378,6 +127314,17 @@ var ts;
|
|
|
127378
127314
|
var exportInfoId = 1;
|
|
127379
127315
|
var exportInfo = ts.createMultiMap();
|
|
127380
127316
|
var symbols = new ts.Map();
|
|
127317
|
+
/**
|
|
127318
|
+
* Key: node_modules package name (no @types).
|
|
127319
|
+
* Value: path to deepest node_modules folder seen that is
|
|
127320
|
+
* both visible to `usableByFileName` and contains the package.
|
|
127321
|
+
*
|
|
127322
|
+
* Later, we can see if a given SymbolExportInfo is shadowed by
|
|
127323
|
+
* a another installation of the same package in a deeper
|
|
127324
|
+
* node_modules folder by seeing if its path starts with the
|
|
127325
|
+
* value stored here.
|
|
127326
|
+
*/
|
|
127327
|
+
var packages = new ts.Map();
|
|
127381
127328
|
var usableByFileName;
|
|
127382
127329
|
var cache = {
|
|
127383
127330
|
isUsableByFile: function (importingFile) { return importingFile === usableByFileName; },
|
|
@@ -127392,6 +127339,27 @@ var ts;
|
|
|
127392
127339
|
cache.clear();
|
|
127393
127340
|
usableByFileName = importingFile;
|
|
127394
127341
|
}
|
|
127342
|
+
var packageName;
|
|
127343
|
+
if (moduleFile) {
|
|
127344
|
+
var nodeModulesPathParts = ts.getNodeModulePathParts(moduleFile.fileName);
|
|
127345
|
+
if (nodeModulesPathParts) {
|
|
127346
|
+
var topLevelNodeModulesIndex = nodeModulesPathParts.topLevelNodeModulesIndex, topLevelPackageNameIndex = nodeModulesPathParts.topLevelPackageNameIndex, packageRootIndex = nodeModulesPathParts.packageRootIndex;
|
|
127347
|
+
packageName = ts.unmangleScopedPackageName(ts.getPackageNameFromTypesPackageName(moduleFile.fileName.substring(topLevelPackageNameIndex + 1, packageRootIndex)));
|
|
127348
|
+
if (ts.startsWith(importingFile, moduleFile.path.substring(0, topLevelNodeModulesIndex))) {
|
|
127349
|
+
var prevDeepestNodeModulesPath = packages.get(packageName);
|
|
127350
|
+
var nodeModulesPath = moduleFile.fileName.substring(0, topLevelPackageNameIndex);
|
|
127351
|
+
if (prevDeepestNodeModulesPath) {
|
|
127352
|
+
var prevDeepestNodeModulesIndex = prevDeepestNodeModulesPath.indexOf(ts.nodeModulesPathPart);
|
|
127353
|
+
if (topLevelNodeModulesIndex > prevDeepestNodeModulesIndex) {
|
|
127354
|
+
packages.set(packageName, nodeModulesPath);
|
|
127355
|
+
}
|
|
127356
|
+
}
|
|
127357
|
+
else {
|
|
127358
|
+
packages.set(packageName, nodeModulesPath);
|
|
127359
|
+
}
|
|
127360
|
+
}
|
|
127361
|
+
}
|
|
127362
|
+
}
|
|
127395
127363
|
var isDefault = exportKind === 1 /* Default */;
|
|
127396
127364
|
var namedSymbol = isDefault && ts.getLocalSymbolForExportDefault(symbol) || symbol;
|
|
127397
127365
|
// 1. A named export must be imported by its key in `moduleSymbol.exports` or `moduleSymbol.members`.
|
|
@@ -127418,6 +127386,7 @@ var ts;
|
|
|
127418
127386
|
moduleName: moduleName,
|
|
127419
127387
|
moduleFile: moduleFile,
|
|
127420
127388
|
moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName,
|
|
127389
|
+
packageName: packageName,
|
|
127421
127390
|
exportKind: exportKind,
|
|
127422
127391
|
targetFlags: target.flags,
|
|
127423
127392
|
isFromPackageJson: isFromPackageJson,
|
|
@@ -127437,13 +127406,16 @@ var ts;
|
|
|
127437
127406
|
exportInfo.forEach(function (info, key) {
|
|
127438
127407
|
var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName;
|
|
127439
127408
|
var rehydrated = info.map(rehydrateCachedInfo);
|
|
127440
|
-
|
|
127441
|
-
|
|
127442
|
-
|
|
127443
|
-
|
|
127444
|
-
|
|
127445
|
-
|
|
127446
|
-
|
|
127409
|
+
var filtered = rehydrated.filter(function (r, i) { return isNotShadowedByDeeperNodeModulesPackage(r, info[i].packageName); });
|
|
127410
|
+
if (filtered.length) {
|
|
127411
|
+
action(filtered, function (preferCapitalized) {
|
|
127412
|
+
var _a = rehydrated[0], symbol = _a.symbol, exportKind = _a.exportKind;
|
|
127413
|
+
var namedSymbol = exportKind === 1 /* Default */ && ts.getLocalSymbolForExportDefault(symbol) || symbol;
|
|
127414
|
+
return preferCapitalized
|
|
127415
|
+
? ts.getNameForExportedSymbol(namedSymbol, /*scriptTarget*/ undefined, /*preferCapitalized*/ true)
|
|
127416
|
+
: symbolName;
|
|
127417
|
+
}, !!ambientModuleName, key);
|
|
127418
|
+
}
|
|
127447
127419
|
});
|
|
127448
127420
|
},
|
|
127449
127421
|
releaseSymbols: function () {
|
|
@@ -127543,6 +127515,12 @@ var ts;
|
|
|
127543
127515
|
}
|
|
127544
127516
|
return true;
|
|
127545
127517
|
}
|
|
127518
|
+
function isNotShadowedByDeeperNodeModulesPackage(info, packageName) {
|
|
127519
|
+
if (!packageName || !info.moduleFileName)
|
|
127520
|
+
return true;
|
|
127521
|
+
var packageDeepestNodeModulesPath = packages.get(packageName);
|
|
127522
|
+
return !packageDeepestNodeModulesPath || ts.startsWith(info.moduleFileName, packageDeepestNodeModulesPath);
|
|
127523
|
+
}
|
|
127546
127524
|
}
|
|
127547
127525
|
ts.createCacheableExportInfoMap = createCacheableExportInfoMap;
|
|
127548
127526
|
function isImportableFile(program, from, to, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) {
|
|
@@ -129853,7 +129831,7 @@ var ts;
|
|
|
129853
129831
|
}
|
|
129854
129832
|
switch (completionData.kind) {
|
|
129855
129833
|
case 0 /* Data */:
|
|
129856
|
-
var response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext);
|
|
129834
|
+
var response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position);
|
|
129857
129835
|
if (response === null || response === void 0 ? void 0 : response.isIncomplete) {
|
|
129858
129836
|
incompleteCompletionsCache === null || incompleteCompletionsCache === void 0 ? void 0 : incompleteCompletionsCache.set(response);
|
|
129859
129837
|
}
|
|
@@ -129973,7 +129951,7 @@ var ts;
|
|
|
129973
129951
|
// StringLiteralLike locations are handled separately in stringCompletions.ts
|
|
129974
129952
|
return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
|
|
129975
129953
|
}
|
|
129976
|
-
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext) {
|
|
129954
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
129977
129955
|
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;
|
|
129978
129956
|
// Verify if the file is JSX language variant
|
|
129979
129957
|
if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* JSX */) {
|
|
@@ -129986,7 +129964,7 @@ var ts;
|
|
|
129986
129964
|
if (isUncheckedFile(sourceFile, compilerOptions)) {
|
|
129987
129965
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
129988
129966
|
/*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);
|
|
129989
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
129967
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
129990
129968
|
}
|
|
129991
129969
|
else {
|
|
129992
129970
|
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
@@ -129996,16 +129974,23 @@ var ts;
|
|
|
129996
129974
|
/*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);
|
|
129997
129975
|
}
|
|
129998
129976
|
if (keywordFilters !== 0 /* None */) {
|
|
129999
|
-
var
|
|
129977
|
+
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
130000
129978
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
130001
129979
|
var keywordEntry = _a[_i];
|
|
130002
|
-
if (!
|
|
129980
|
+
if (!entryNames_1.has(keywordEntry.name)) {
|
|
130003
129981
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
130004
129982
|
}
|
|
130005
129983
|
}
|
|
130006
129984
|
}
|
|
130007
|
-
|
|
130008
|
-
|
|
129985
|
+
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
129986
|
+
for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) {
|
|
129987
|
+
var keywordEntry = _c[_b];
|
|
129988
|
+
if (!entryNames.has(keywordEntry.name)) {
|
|
129989
|
+
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
129990
|
+
}
|
|
129991
|
+
}
|
|
129992
|
+
for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) {
|
|
129993
|
+
var literal = literals_1[_d];
|
|
130009
129994
|
ts.insertSorted(entries, createCompletionEntryForLiteral(sourceFile, preferences, literal), compareCompletionEntries, /*allowDuplicates*/ true);
|
|
130010
129995
|
}
|
|
130011
129996
|
return {
|
|
@@ -132555,6 +132540,34 @@ var ts;
|
|
|
132555
132540
|
function keywordForNode(node) {
|
|
132556
132541
|
return ts.isIdentifier(node) ? node.originalKeywordKind || 0 /* Unknown */ : node.kind;
|
|
132557
132542
|
}
|
|
132543
|
+
function getContextualKeywords(contextToken, position) {
|
|
132544
|
+
var entries = [];
|
|
132545
|
+
/**
|
|
132546
|
+
* An `AssertClause` can come after an import declaration:
|
|
132547
|
+
* import * from "foo" |
|
|
132548
|
+
* import "foo" |
|
|
132549
|
+
* or after a re-export declaration that has a module specifier:
|
|
132550
|
+
* export { foo } from "foo" |
|
|
132551
|
+
* Source: https://tc39.es/proposal-import-assertions/
|
|
132552
|
+
*/
|
|
132553
|
+
if (contextToken) {
|
|
132554
|
+
var file = contextToken.getSourceFile();
|
|
132555
|
+
var parent = contextToken.parent;
|
|
132556
|
+
var tokenLine = file.getLineAndCharacterOfPosition(contextToken.end).line;
|
|
132557
|
+
var currentLine = file.getLineAndCharacterOfPosition(position).line;
|
|
132558
|
+
if ((ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent) && parent.moduleSpecifier)
|
|
132559
|
+
&& contextToken === parent.moduleSpecifier
|
|
132560
|
+
&& tokenLine === currentLine) {
|
|
132561
|
+
entries.push({
|
|
132562
|
+
name: ts.tokenToString(129 /* AssertKeyword */),
|
|
132563
|
+
kind: "keyword" /* keyword */,
|
|
132564
|
+
kindModifiers: "" /* none */,
|
|
132565
|
+
sortText: SortText.GlobalsOrKeywords,
|
|
132566
|
+
});
|
|
132567
|
+
}
|
|
132568
|
+
}
|
|
132569
|
+
return entries;
|
|
132570
|
+
}
|
|
132558
132571
|
/** Get the corresponding JSDocTag node if the position is in a jsDoc comment */
|
|
132559
132572
|
function getJsDocTagAtPosition(node, position) {
|
|
132560
132573
|
return ts.findAncestor(node, function (n) {
|
|
@@ -149907,9 +149920,10 @@ var ts;
|
|
|
149907
149920
|
var info = getFixesInfo(context, errorCode, span.start, /*useAutoImportProvider*/ true);
|
|
149908
149921
|
if (!info)
|
|
149909
149922
|
return undefined;
|
|
149910
|
-
var fixes = info.fixes, symbolName = info.symbolName;
|
|
149923
|
+
var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText;
|
|
149911
149924
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
149912
|
-
return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix,
|
|
149925
|
+
return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix,
|
|
149926
|
+
/*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); });
|
|
149913
149927
|
},
|
|
149914
149928
|
fixIds: [importFixId],
|
|
149915
149929
|
getAllCodeActions: function (context) {
|
|
@@ -149948,7 +149962,7 @@ var ts;
|
|
|
149948
149962
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
149949
149963
|
var fix = getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, /*position*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
|
|
149950
149964
|
if (fix) {
|
|
149951
|
-
addImport({ fixes: [fix], symbolName: symbolName });
|
|
149965
|
+
addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined });
|
|
149952
149966
|
}
|
|
149953
149967
|
}
|
|
149954
149968
|
function addImport(info) {
|
|
@@ -150119,7 +150133,8 @@ var ts;
|
|
|
150119
150133
|
var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
|
|
150120
150134
|
return {
|
|
150121
150135
|
moduleSpecifier: fix.moduleSpecifier,
|
|
150122
|
-
codeAction: codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix,
|
|
150136
|
+
codeAction: codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix,
|
|
150137
|
+
/*includeSymbolNameInDescription*/ false, ts.getQuotePreference(sourceFile, preferences), compilerOptions))
|
|
150123
150138
|
};
|
|
150124
150139
|
}
|
|
150125
150140
|
codefix.getImportCompletionAction = getImportCompletionAction;
|
|
@@ -150127,7 +150142,8 @@ var ts;
|
|
|
150127
150142
|
var compilerOptions = program.getCompilerOptions();
|
|
150128
150143
|
var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions);
|
|
150129
150144
|
var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program);
|
|
150130
|
-
|
|
150145
|
+
var includeSymbolNameInDescription = symbolName !== symbolToken.text;
|
|
150146
|
+
return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* Double */, compilerOptions));
|
|
150131
150147
|
}
|
|
150132
150148
|
codefix.getPromoteTypeOnlyCompletionAction = getPromoteTypeOnlyCompletionAction;
|
|
150133
150149
|
function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
@@ -150420,7 +150436,7 @@ var ts;
|
|
|
150420
150436
|
else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) {
|
|
150421
150437
|
var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions());
|
|
150422
150438
|
var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program);
|
|
150423
|
-
return fix && { fixes: [fix], symbolName: symbolName_1 };
|
|
150439
|
+
return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text };
|
|
150424
150440
|
}
|
|
150425
150441
|
else {
|
|
150426
150442
|
info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
|
|
@@ -150465,6 +150481,7 @@ var ts;
|
|
|
150465
150481
|
return 0 /* EqualTo */;
|
|
150466
150482
|
}
|
|
150467
150483
|
function getFixesInfoForUMDImport(_a, token) {
|
|
150484
|
+
var _b;
|
|
150468
150485
|
var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences;
|
|
150469
150486
|
var checker = program.getTypeChecker();
|
|
150470
150487
|
var umdSymbol = getUmdSymbol(token, checker);
|
|
@@ -150475,7 +150492,7 @@ var ts;
|
|
|
150475
150492
|
var exportInfos = [{ symbol: umdSymbol, moduleSymbol: symbol, moduleFileName: undefined, exportKind: 3 /* UMD */, targetFlags: symbol.flags, isFromPackageJson: false }];
|
|
150476
150493
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
150477
150494
|
var fixes = getImportFixes(exportInfos, symbolName, ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences);
|
|
150478
|
-
return { fixes: fixes, symbolName: symbolName };
|
|
150495
|
+
return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text };
|
|
150479
150496
|
}
|
|
150480
150497
|
function getUmdSymbol(token, checker) {
|
|
150481
150498
|
// try the identifier to see if it is the umd symbol
|
|
@@ -150546,7 +150563,7 @@ var ts;
|
|
|
150546
150563
|
var _ = _a[0], exportInfos = _a[1];
|
|
150547
150564
|
return getImportFixes(exportInfos, symbolName, symbolToken.getStart(sourceFile), isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences);
|
|
150548
150565
|
}));
|
|
150549
|
-
return { fixes: fixes, symbolName: symbolName };
|
|
150566
|
+
return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text };
|
|
150550
150567
|
}
|
|
150551
150568
|
function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) {
|
|
150552
150569
|
var checker = program.getTypeChecker();
|
|
@@ -150641,14 +150658,14 @@ var ts;
|
|
|
150641
150658
|
// allowSyntheticDefaultImports/esModuleInterop is enabled.
|
|
150642
150659
|
return allowSyntheticDefaults ? 1 /* Default */ : 3 /* CommonJS */;
|
|
150643
150660
|
}
|
|
150644
|
-
function codeActionForFix(context, sourceFile, symbolName, fix, quotePreference, compilerOptions) {
|
|
150661
|
+
function codeActionForFix(context, sourceFile, symbolName, fix, includeSymbolNameInDescription, quotePreference, compilerOptions) {
|
|
150645
150662
|
var diag;
|
|
150646
150663
|
var changes = ts.textChanges.ChangeTracker.with(context, function (tracker) {
|
|
150647
|
-
diag = codeActionForFixWorker(tracker, sourceFile, symbolName, fix, quotePreference, compilerOptions);
|
|
150664
|
+
diag = codeActionForFixWorker(tracker, sourceFile, symbolName, fix, includeSymbolNameInDescription, quotePreference, compilerOptions);
|
|
150648
150665
|
});
|
|
150649
150666
|
return codefix.createCodeFixAction(codefix.importFixName, changes, diag, importFixId, ts.Diagnostics.Add_all_missing_imports);
|
|
150650
150667
|
}
|
|
150651
|
-
function codeActionForFixWorker(changes, sourceFile, symbolName, fix, quotePreference, compilerOptions) {
|
|
150668
|
+
function codeActionForFixWorker(changes, sourceFile, symbolName, fix, includeSymbolNameInDescription, quotePreference, compilerOptions) {
|
|
150652
150669
|
switch (fix.kind) {
|
|
150653
150670
|
case 0 /* UseNamespace */:
|
|
150654
150671
|
addNamespaceQualifier(changes, sourceFile, fix);
|
|
@@ -150660,11 +150677,9 @@ var ts;
|
|
|
150660
150677
|
var importClauseOrBindingPattern = fix.importClauseOrBindingPattern, importKind = fix.importKind, addAsTypeOnly = fix.addAsTypeOnly, moduleSpecifier = fix.moduleSpecifier;
|
|
150661
150678
|
doAddExistingFix(changes, sourceFile, importClauseOrBindingPattern, importKind === 1 /* Default */ ? { name: symbolName, addAsTypeOnly: addAsTypeOnly } : undefined, importKind === 0 /* Named */ ? [{ name: symbolName, addAsTypeOnly: addAsTypeOnly }] : ts.emptyArray, compilerOptions);
|
|
150662
150679
|
var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier);
|
|
150663
|
-
return
|
|
150664
|
-
|
|
150665
|
-
|
|
150666
|
-
moduleSpecifierWithoutQuotes
|
|
150667
|
-
]; // you too!
|
|
150680
|
+
return includeSymbolNameInDescription
|
|
150681
|
+
? [ts.Diagnostics.Import_0_from_1, symbolName, moduleSpecifierWithoutQuotes]
|
|
150682
|
+
: [ts.Diagnostics.Update_import_from_0, moduleSpecifierWithoutQuotes];
|
|
150668
150683
|
}
|
|
150669
150684
|
case 3 /* AddNew */: {
|
|
150670
150685
|
var importKind = fix.importKind, moduleSpecifier = fix.moduleSpecifier, addAsTypeOnly = fix.addAsTypeOnly, useRequire = fix.useRequire;
|
|
@@ -150673,7 +150688,9 @@ var ts;
|
|
|
150673
150688
|
var namedImports = importKind === 0 /* Named */ ? [{ name: symbolName, addAsTypeOnly: addAsTypeOnly }] : undefined;
|
|
150674
150689
|
var namespaceLikeImport = importKind === 2 /* Namespace */ || importKind === 3 /* CommonJS */ ? { importKind: importKind, name: symbolName, addAsTypeOnly: addAsTypeOnly } : undefined;
|
|
150675
150690
|
ts.insertImports(changes, sourceFile, getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport), /*blankLineBetween*/ true);
|
|
150676
|
-
return
|
|
150691
|
+
return includeSymbolNameInDescription
|
|
150692
|
+
? [ts.Diagnostics.Import_0_from_1, symbolName, moduleSpecifier]
|
|
150693
|
+
: [ts.Diagnostics.Add_import_from_0, moduleSpecifier];
|
|
150677
150694
|
}
|
|
150678
150695
|
case 4 /* PromoteTypeOnly */: {
|
|
150679
150696
|
var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration;
|