typescript 4.8.0-dev.20220615 → 4.8.0-dev.20220618
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 +5 -1
- package/lib/de/diagnosticMessages.generated.json +2 -0
- package/lib/es/diagnosticMessages.generated.json +5 -1
- package/lib/fr/diagnosticMessages.generated.json +5 -1
- package/lib/it/diagnosticMessages.generated.json +2 -0
- package/lib/ja/diagnosticMessages.generated.json +2 -0
- package/lib/ko/diagnosticMessages.generated.json +5 -1
- package/lib/lib.dom.d.ts +128 -183
- package/lib/lib.dom.iterable.d.ts +1 -11
- package/lib/lib.webworker.d.ts +54 -27
- package/lib/lib.webworker.iterable.d.ts +1 -1
- package/lib/pl/diagnosticMessages.generated.json +5 -1
- package/lib/protocol.d.ts +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +5 -1
- package/lib/ru/diagnosticMessages.generated.json +5 -1
- package/lib/tr/diagnosticMessages.generated.json +2 -0
- package/lib/tsc.js +136 -49
- package/lib/tsserver.js +368 -104
- package/lib/tsserverlibrary.d.ts +10 -0
- package/lib/tsserverlibrary.js +368 -104
- package/lib/typescript.d.ts +9 -0
- package/lib/typescript.js +336 -82
- package/lib/typescriptServices.d.ts +9 -0
- package/lib/typescriptServices.js +336 -82
- package/lib/typingsInstaller.js +165 -49
- package/lib/zh-cn/diagnosticMessages.generated.json +5 -1
- package/lib/zh-tw/diagnosticMessages.generated.json +5 -1
- package/package.json +20 -20
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220618";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -5642,9 +5642,11 @@ var ts;
|
|
|
5642
5642
|
Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", undefined, true),
|
|
5643
5643
|
The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
|
|
5644
5644
|
The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
|
|
5645
|
-
|
|
5645
|
+
This_type_parameter_might_need_an_extends_0_constraint: diag(2208, ts.DiagnosticCategory.Error, "This_type_parameter_might_need_an_extends_0_constraint_2208", "This type parameter might need an `extends {0}` constraint."),
|
|
5646
5646
|
The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
|
|
5647
5647
|
The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
|
|
5648
|
+
Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
|
|
5649
|
+
Add_extends_constraint_to_all_type_parameters: diag(2212, ts.DiagnosticCategory.Message, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
|
|
5648
5650
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
5649
5651
|
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
5650
5652
|
Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
|
|
@@ -6829,6 +6831,8 @@ var ts;
|
|
|
6829
6831
|
Qualified_name_0_is_not_allowed_without_a_leading_param_object_1: diag(8032, ts.DiagnosticCategory.Error, "Qualified_name_0_is_not_allowed_without_a_leading_param_object_1_8032", "Qualified name '{0}' is not allowed without a leading '@param {object} {1}'."),
|
|
6830
6832
|
A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags: diag(8033, ts.DiagnosticCategory.Error, "A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags_8033", "A JSDoc '@typedef' comment may not contain multiple '@type' tags."),
|
|
6831
6833
|
The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."),
|
|
6834
|
+
You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."),
|
|
6835
|
+
You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."),
|
|
6832
6836
|
Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
|
|
6833
6837
|
Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
|
|
6834
6838
|
JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
|
|
@@ -7099,6 +7103,9 @@ var ts;
|
|
|
7099
7103
|
For_await_loops_cannot_be_used_inside_a_class_static_block: diag(18038, ts.DiagnosticCategory.Error, "For_await_loops_cannot_be_used_inside_a_class_static_block_18038", "'For await' loops cannot be used inside a class static block."),
|
|
7100
7104
|
Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block: diag(18039, ts.DiagnosticCategory.Error, "Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block_18039", "Invalid use of '{0}'. It cannot be used inside a class static block."),
|
|
7101
7105
|
A_return_statement_cannot_be_used_inside_a_class_static_block: diag(18041, ts.DiagnosticCategory.Error, "A_return_statement_cannot_be_used_inside_a_class_static_block_18041", "A 'return' statement cannot be used inside a class static block."),
|
|
7106
|
+
_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."),
|
|
7107
|
+
Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."),
|
|
7108
|
+
_0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."),
|
|
7102
7109
|
};
|
|
7103
7110
|
})(ts || (ts = {}));
|
|
7104
7111
|
var ts;
|
|
@@ -27904,10 +27911,10 @@ var ts;
|
|
|
27904
27911
|
setDecoratorContext(false);
|
|
27905
27912
|
}
|
|
27906
27913
|
var pos = getNodePos();
|
|
27907
|
-
var expr = parseAssignmentExpressionOrHigher();
|
|
27914
|
+
var expr = parseAssignmentExpressionOrHigher(true);
|
|
27908
27915
|
var operatorToken;
|
|
27909
27916
|
while ((operatorToken = parseOptionalToken(27))) {
|
|
27910
|
-
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
|
|
27917
|
+
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(true), pos);
|
|
27911
27918
|
}
|
|
27912
27919
|
if (saveDecoratorContext) {
|
|
27913
27920
|
setDecoratorContext(true);
|
|
@@ -27915,25 +27922,25 @@ var ts;
|
|
|
27915
27922
|
return expr;
|
|
27916
27923
|
}
|
|
27917
27924
|
function parseInitializer() {
|
|
27918
|
-
return parseOptional(63) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
27925
|
+
return parseOptional(63) ? parseAssignmentExpressionOrHigher(true) : undefined;
|
|
27919
27926
|
}
|
|
27920
|
-
function parseAssignmentExpressionOrHigher() {
|
|
27927
|
+
function parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction) {
|
|
27921
27928
|
if (isYieldExpression()) {
|
|
27922
27929
|
return parseYieldExpression();
|
|
27923
27930
|
}
|
|
27924
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
27931
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) || tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction);
|
|
27925
27932
|
if (arrowExpression) {
|
|
27926
27933
|
return arrowExpression;
|
|
27927
27934
|
}
|
|
27928
27935
|
var pos = getNodePos();
|
|
27929
27936
|
var expr = parseBinaryExpressionOrHigher(0);
|
|
27930
27937
|
if (expr.kind === 79 && token() === 38) {
|
|
27931
|
-
return parseSimpleArrowFunctionExpression(pos, expr, undefined);
|
|
27938
|
+
return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, undefined);
|
|
27932
27939
|
}
|
|
27933
27940
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
27934
|
-
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
27941
|
+
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction), pos);
|
|
27935
27942
|
}
|
|
27936
|
-
return parseConditionalExpressionRest(expr, pos);
|
|
27943
|
+
return parseConditionalExpressionRest(expr, pos, allowReturnTypeInArrowFunction);
|
|
27937
27944
|
}
|
|
27938
27945
|
function isYieldExpression() {
|
|
27939
27946
|
if (token() === 125) {
|
|
@@ -27953,30 +27960,30 @@ var ts;
|
|
|
27953
27960
|
nextToken();
|
|
27954
27961
|
if (!scanner.hasPrecedingLineBreak() &&
|
|
27955
27962
|
(token() === 41 || isStartOfExpression())) {
|
|
27956
|
-
return finishNode(factory.createYieldExpression(parseOptionalToken(41), parseAssignmentExpressionOrHigher()), pos);
|
|
27963
|
+
return finishNode(factory.createYieldExpression(parseOptionalToken(41), parseAssignmentExpressionOrHigher(true)), pos);
|
|
27957
27964
|
}
|
|
27958
27965
|
else {
|
|
27959
27966
|
return finishNode(factory.createYieldExpression(undefined, undefined), pos);
|
|
27960
27967
|
}
|
|
27961
27968
|
}
|
|
27962
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
27969
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, asyncModifier) {
|
|
27963
27970
|
ts.Debug.assert(token() === 38, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
27964
27971
|
var parameter = factory.createParameterDeclaration(undefined, undefined, identifier, undefined, undefined, undefined);
|
|
27965
27972
|
finishNode(parameter, identifier.pos);
|
|
27966
27973
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
27967
27974
|
var equalsGreaterThanToken = parseExpectedToken(38);
|
|
27968
|
-
var body = parseArrowFunctionExpressionBody(!!asyncModifier);
|
|
27975
|
+
var body = parseArrowFunctionExpressionBody(!!asyncModifier, allowReturnTypeInArrowFunction);
|
|
27969
27976
|
var node = factory.createArrowFunction(asyncModifier, undefined, parameters, undefined, equalsGreaterThanToken, body);
|
|
27970
27977
|
return addJSDocComment(finishNode(node, pos));
|
|
27971
27978
|
}
|
|
27972
|
-
function tryParseParenthesizedArrowFunctionExpression() {
|
|
27979
|
+
function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
|
|
27973
27980
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
27974
27981
|
if (triState === 0) {
|
|
27975
27982
|
return undefined;
|
|
27976
27983
|
}
|
|
27977
27984
|
return triState === 1 ?
|
|
27978
|
-
parseParenthesizedArrowFunctionExpression(true) :
|
|
27979
|
-
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
27985
|
+
parseParenthesizedArrowFunctionExpression(true, true) :
|
|
27986
|
+
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction); });
|
|
27980
27987
|
}
|
|
27981
27988
|
function isParenthesizedArrowFunctionExpression() {
|
|
27982
27989
|
if (token() === 20 || token() === 29 || token() === 131) {
|
|
@@ -28073,24 +28080,24 @@ var ts;
|
|
|
28073
28080
|
return 2;
|
|
28074
28081
|
}
|
|
28075
28082
|
}
|
|
28076
|
-
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
28083
|
+
function parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
|
|
28077
28084
|
var tokenPos = scanner.getTokenPos();
|
|
28078
28085
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
28079
28086
|
return undefined;
|
|
28080
28087
|
}
|
|
28081
|
-
var result = parseParenthesizedArrowFunctionExpression(false);
|
|
28088
|
+
var result = parseParenthesizedArrowFunctionExpression(false, allowReturnTypeInArrowFunction);
|
|
28082
28089
|
if (!result) {
|
|
28083
28090
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
28084
28091
|
}
|
|
28085
28092
|
return result;
|
|
28086
28093
|
}
|
|
28087
|
-
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
28094
|
+
function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) {
|
|
28088
28095
|
if (token() === 131) {
|
|
28089
28096
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1) {
|
|
28090
28097
|
var pos = getNodePos();
|
|
28091
28098
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
28092
28099
|
var expr = parseBinaryExpressionOrHigher(0);
|
|
28093
|
-
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
28100
|
+
return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, asyncModifier);
|
|
28094
28101
|
}
|
|
28095
28102
|
}
|
|
28096
28103
|
return undefined;
|
|
@@ -28108,7 +28115,7 @@ var ts;
|
|
|
28108
28115
|
}
|
|
28109
28116
|
return 0;
|
|
28110
28117
|
}
|
|
28111
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
28118
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, allowReturnTypeInArrowFunction) {
|
|
28112
28119
|
var pos = getNodePos();
|
|
28113
28120
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
28114
28121
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -28136,6 +28143,7 @@ var ts;
|
|
|
28136
28143
|
return undefined;
|
|
28137
28144
|
}
|
|
28138
28145
|
}
|
|
28146
|
+
var hasReturnColon = token() === 58;
|
|
28139
28147
|
var type = parseReturnType(58, false);
|
|
28140
28148
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
28141
28149
|
return undefined;
|
|
@@ -28151,12 +28159,17 @@ var ts;
|
|
|
28151
28159
|
var lastToken = token();
|
|
28152
28160
|
var equalsGreaterThanToken = parseExpectedToken(38);
|
|
28153
28161
|
var body = (lastToken === 38 || lastToken === 18)
|
|
28154
|
-
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
|
|
28162
|
+
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), allowReturnTypeInArrowFunction)
|
|
28155
28163
|
: parseIdentifier();
|
|
28164
|
+
if (!allowReturnTypeInArrowFunction && hasReturnColon) {
|
|
28165
|
+
if (token() !== 58) {
|
|
28166
|
+
return undefined;
|
|
28167
|
+
}
|
|
28168
|
+
}
|
|
28156
28169
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
28157
28170
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
28158
28171
|
}
|
|
28159
|
-
function parseArrowFunctionExpressionBody(isAsync) {
|
|
28172
|
+
function parseArrowFunctionExpressionBody(isAsync, allowReturnTypeInArrowFunction) {
|
|
28160
28173
|
if (token() === 18) {
|
|
28161
28174
|
return parseFunctionBlock(isAsync ? 2 : 0);
|
|
28162
28175
|
}
|
|
@@ -28170,19 +28183,19 @@ var ts;
|
|
|
28170
28183
|
var savedTopLevel = topLevel;
|
|
28171
28184
|
topLevel = false;
|
|
28172
28185
|
var node = isAsync
|
|
28173
|
-
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
28174
|
-
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
28186
|
+
? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction); })
|
|
28187
|
+
: doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction); });
|
|
28175
28188
|
topLevel = savedTopLevel;
|
|
28176
28189
|
return node;
|
|
28177
28190
|
}
|
|
28178
|
-
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
28191
|
+
function parseConditionalExpressionRest(leftOperand, pos, allowReturnTypeInArrowFunction) {
|
|
28179
28192
|
var questionToken = parseOptionalToken(57);
|
|
28180
28193
|
if (!questionToken) {
|
|
28181
28194
|
return leftOperand;
|
|
28182
28195
|
}
|
|
28183
28196
|
var colonToken;
|
|
28184
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58), ts.nodeIsPresent(colonToken)
|
|
28185
|
-
? parseAssignmentExpressionOrHigher()
|
|
28197
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(false); }), colonToken = parseExpectedToken(58), ts.nodeIsPresent(colonToken)
|
|
28198
|
+
? parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction)
|
|
28186
28199
|
: createMissingNode(79, false, ts.Diagnostics._0_expected, ts.tokenToString(58))), pos);
|
|
28187
28200
|
}
|
|
28188
28201
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -28778,9 +28791,10 @@ var ts;
|
|
|
28778
28791
|
}
|
|
28779
28792
|
nextToken();
|
|
28780
28793
|
var typeArguments = parseDelimitedList(20, parseType);
|
|
28781
|
-
if (
|
|
28794
|
+
if (reScanGreaterToken() !== 31) {
|
|
28782
28795
|
return undefined;
|
|
28783
28796
|
}
|
|
28797
|
+
nextToken();
|
|
28784
28798
|
return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined;
|
|
28785
28799
|
}
|
|
28786
28800
|
function canFollowTypeArgumentsInExpression() {
|
|
@@ -28851,13 +28865,13 @@ var ts;
|
|
|
28851
28865
|
function parseSpreadElement() {
|
|
28852
28866
|
var pos = getNodePos();
|
|
28853
28867
|
parseExpected(25);
|
|
28854
|
-
var expression = parseAssignmentExpressionOrHigher();
|
|
28868
|
+
var expression = parseAssignmentExpressionOrHigher(true);
|
|
28855
28869
|
return finishNode(factory.createSpreadElement(expression), pos);
|
|
28856
28870
|
}
|
|
28857
28871
|
function parseArgumentOrArrayLiteralElement() {
|
|
28858
28872
|
return token() === 25 ? parseSpreadElement() :
|
|
28859
28873
|
token() === 27 ? finishNode(factory.createOmittedExpression(), getNodePos()) :
|
|
28860
|
-
parseAssignmentExpressionOrHigher();
|
|
28874
|
+
parseAssignmentExpressionOrHigher(true);
|
|
28861
28875
|
}
|
|
28862
28876
|
function parseArgumentExpression() {
|
|
28863
28877
|
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
|
|
@@ -28875,7 +28889,7 @@ var ts;
|
|
|
28875
28889
|
var pos = getNodePos();
|
|
28876
28890
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
28877
28891
|
if (parseOptionalToken(25)) {
|
|
28878
|
-
var expression = parseAssignmentExpressionOrHigher();
|
|
28892
|
+
var expression = parseAssignmentExpressionOrHigher(true);
|
|
28879
28893
|
return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
|
|
28880
28894
|
}
|
|
28881
28895
|
var decorators = parseDecorators();
|
|
@@ -28898,13 +28912,13 @@ var ts;
|
|
|
28898
28912
|
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58);
|
|
28899
28913
|
if (isShorthandPropertyAssignment) {
|
|
28900
28914
|
var equalsToken = parseOptionalToken(63);
|
|
28901
|
-
var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
|
|
28915
|
+
var objectAssignmentInitializer = equalsToken ? allowInAnd(function () { return parseAssignmentExpressionOrHigher(true); }) : undefined;
|
|
28902
28916
|
node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
|
|
28903
28917
|
node.equalsToken = equalsToken;
|
|
28904
28918
|
}
|
|
28905
28919
|
else {
|
|
28906
28920
|
parseExpected(58);
|
|
28907
|
-
var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
28921
|
+
var initializer = allowInAnd(function () { return parseAssignmentExpressionOrHigher(true); });
|
|
28908
28922
|
node = factory.createPropertyAssignment(name, initializer);
|
|
28909
28923
|
}
|
|
28910
28924
|
node.decorators = decorators;
|
|
@@ -29067,7 +29081,7 @@ var ts;
|
|
|
29067
29081
|
}
|
|
29068
29082
|
var node;
|
|
29069
29083
|
if (awaitToken ? parseExpected(160) : parseOptional(160)) {
|
|
29070
|
-
var expression = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
29084
|
+
var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(true); });
|
|
29071
29085
|
parseExpected(21);
|
|
29072
29086
|
node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
|
|
29073
29087
|
}
|
|
@@ -30125,7 +30139,7 @@ var ts;
|
|
|
30125
30139
|
var pos = getNodePos();
|
|
30126
30140
|
var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10);
|
|
30127
30141
|
parseExpected(58);
|
|
30128
|
-
var value = parseAssignmentExpressionOrHigher();
|
|
30142
|
+
var value = parseAssignmentExpressionOrHigher(true);
|
|
30129
30143
|
return finishNode(factory.createAssertEntry(name, value), pos);
|
|
30130
30144
|
}
|
|
30131
30145
|
function parseAssertClause(skipAssertKeyword) {
|
|
@@ -30321,7 +30335,7 @@ var ts;
|
|
|
30321
30335
|
else {
|
|
30322
30336
|
parseExpected(88);
|
|
30323
30337
|
}
|
|
30324
|
-
var expression = parseAssignmentExpressionOrHigher();
|
|
30338
|
+
var expression = parseAssignmentExpressionOrHigher(true);
|
|
30325
30339
|
parseSemicolon();
|
|
30326
30340
|
setAwaitContext(savedAwaitContext);
|
|
30327
30341
|
var node = factory.createExportAssignment(modifiers, isExportEquals, expression);
|
|
@@ -40062,9 +40076,9 @@ var ts;
|
|
|
40062
40076
|
return moduleSpecifier && resolveExternalModuleName(moduleSpecifier, moduleSpecifier, true);
|
|
40063
40077
|
},
|
|
40064
40078
|
resolveExternalModuleSymbol: resolveExternalModuleSymbol,
|
|
40065
|
-
tryGetThisTypeAt: function (nodeIn, includeGlobalThis) {
|
|
40079
|
+
tryGetThisTypeAt: function (nodeIn, includeGlobalThis, container) {
|
|
40066
40080
|
var node = ts.getParseTreeNode(nodeIn);
|
|
40067
|
-
return node && tryGetThisTypeAt(node, includeGlobalThis);
|
|
40081
|
+
return node && tryGetThisTypeAt(node, includeGlobalThis, container);
|
|
40068
40082
|
},
|
|
40069
40083
|
getTypeArgumentConstraint: function (nodeIn) {
|
|
40070
40084
|
var node = ts.getParseTreeNode(nodeIn, ts.isTypeNode);
|
|
@@ -43220,6 +43234,9 @@ var ts;
|
|
|
43220
43234
|
if (symbol && symbol.flags & 262144 && meaning & 788968) {
|
|
43221
43235
|
return { accessibility: 0 };
|
|
43222
43236
|
}
|
|
43237
|
+
if (!symbol && ts.isThisIdentifier(firstIdentifier) && isSymbolAccessible(getSymbolOfNode(ts.getThisContainer(firstIdentifier, false)), firstIdentifier, meaning, false).accessibility === 0) {
|
|
43238
|
+
return { accessibility: 0 };
|
|
43239
|
+
}
|
|
43223
43240
|
return (symbol && hasVisibleDeclarations(symbol, true)) || {
|
|
43224
43241
|
accessibility: 1,
|
|
43225
43242
|
errorSymbolName: ts.getTextOfNode(firstIdentifier),
|
|
@@ -49161,7 +49178,7 @@ var ts;
|
|
|
49161
49178
|
}
|
|
49162
49179
|
if (t.flags & 268435456) {
|
|
49163
49180
|
var constraint = getBaseConstraint(t.type);
|
|
49164
|
-
return constraint ? getStringMappingType(t.symbol, constraint) : stringType;
|
|
49181
|
+
return constraint && constraint !== t.type ? getStringMappingType(t.symbol, constraint) : stringType;
|
|
49165
49182
|
}
|
|
49166
49183
|
if (t.flags & 8388608) {
|
|
49167
49184
|
if (isMappedTypeGenericIndexedAccess(t)) {
|
|
@@ -51792,9 +51809,11 @@ var ts;
|
|
|
51792
51809
|
}
|
|
51793
51810
|
function getStringMappingType(symbol, type) {
|
|
51794
51811
|
return type.flags & (1048576 | 131072) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
|
|
51795
|
-
|
|
51796
|
-
type.flags &
|
|
51797
|
-
type
|
|
51812
|
+
type.flags & 268435456 && symbol === type.symbol ? type :
|
|
51813
|
+
isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456) ? getTemplateLiteralType(["", ""], [type]) : type) :
|
|
51814
|
+
type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
|
|
51815
|
+
type.flags & 134217728 ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
|
|
51816
|
+
type;
|
|
51798
51817
|
}
|
|
51799
51818
|
function applyStringMapping(symbol, str) {
|
|
51800
51819
|
switch (intrinsicTypeKinds.get(symbol.escapedName)) {
|
|
@@ -51805,6 +51824,15 @@ var ts;
|
|
|
51805
51824
|
}
|
|
51806
51825
|
return str;
|
|
51807
51826
|
}
|
|
51827
|
+
function applyTemplateStringMapping(symbol, texts, types) {
|
|
51828
|
+
switch (intrinsicTypeKinds.get(symbol.escapedName)) {
|
|
51829
|
+
case 0: return [texts.map(function (t) { return t.toUpperCase(); }), types.map(function (t) { return getStringMappingType(symbol, t); })];
|
|
51830
|
+
case 1: return [texts.map(function (t) { return t.toLowerCase(); }), types.map(function (t) { return getStringMappingType(symbol, t); })];
|
|
51831
|
+
case 2: return [texts[0] === "" ? texts : __spreadArray([texts[0].charAt(0).toUpperCase() + texts[0].slice(1)], texts.slice(1), true), texts[0] === "" ? __spreadArray([getStringMappingType(symbol, types[0])], types.slice(1), true) : types];
|
|
51832
|
+
case 3: return [texts[0] === "" ? texts : __spreadArray([texts[0].charAt(0).toLowerCase() + texts[0].slice(1)], texts.slice(1), true), texts[0] === "" ? __spreadArray([getStringMappingType(symbol, types[0])], types.slice(1), true) : types];
|
|
51833
|
+
}
|
|
51834
|
+
return [texts, types];
|
|
51835
|
+
}
|
|
51808
51836
|
function getStringMappingTypeForGenericType(symbol, type) {
|
|
51809
51837
|
var id = getSymbolId(symbol) + "," + getTypeId(type);
|
|
51810
51838
|
var result = stringMappingTypes.get(id);
|
|
@@ -52034,7 +52062,7 @@ var ts;
|
|
|
52034
52062
|
accessNode;
|
|
52035
52063
|
}
|
|
52036
52064
|
function isPatternLiteralPlaceholderType(type) {
|
|
52037
|
-
return !!(type.flags & (1 | 4 | 8 | 64));
|
|
52065
|
+
return !!(type.flags & (1 | 4 | 8 | 64)) || !!(type.flags & 268435456 && isPatternLiteralPlaceholderType(type.type));
|
|
52038
52066
|
}
|
|
52039
52067
|
function isPatternLiteralType(type) {
|
|
52040
52068
|
return !!(type.flags & 134217728) && ts.every(type.types, isPatternLiteralPlaceholderType);
|
|
@@ -54610,8 +54638,13 @@ var ts;
|
|
|
54610
54638
|
return;
|
|
54611
54639
|
}
|
|
54612
54640
|
reportRelationError(headMessage, source, target);
|
|
54613
|
-
if (
|
|
54614
|
-
|
|
54641
|
+
if (source.flags & 262144 && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source)) {
|
|
54642
|
+
var syntheticParam = cloneTypeParameter(source);
|
|
54643
|
+
syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
|
|
54644
|
+
if (hasNonCircularBaseConstraint(syntheticParam)) {
|
|
54645
|
+
var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
|
|
54646
|
+
associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
|
|
54647
|
+
}
|
|
54615
54648
|
}
|
|
54616
54649
|
}
|
|
54617
54650
|
function traceUnionsOrIntersectionsTooLarge(source, target) {
|
|
@@ -55251,6 +55284,13 @@ var ts;
|
|
|
55251
55284
|
return -1;
|
|
55252
55285
|
}
|
|
55253
55286
|
}
|
|
55287
|
+
else if (target.flags & 268435456) {
|
|
55288
|
+
if (!(source.flags & 268435456)) {
|
|
55289
|
+
if (isMemberOfStringMapping(source, target)) {
|
|
55290
|
+
return -1;
|
|
55291
|
+
}
|
|
55292
|
+
}
|
|
55293
|
+
}
|
|
55254
55294
|
if (sourceFlags & 8650752) {
|
|
55255
55295
|
if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
|
|
55256
55296
|
var constraint = getConstraintOfType(source) || unknownType;
|
|
@@ -55289,7 +55329,10 @@ var ts;
|
|
|
55289
55329
|
}
|
|
55290
55330
|
}
|
|
55291
55331
|
else if (sourceFlags & 268435456) {
|
|
55292
|
-
if (targetFlags & 268435456
|
|
55332
|
+
if (targetFlags & 268435456) {
|
|
55333
|
+
if (source.symbol !== target.symbol) {
|
|
55334
|
+
return 0;
|
|
55335
|
+
}
|
|
55293
55336
|
if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
|
|
55294
55337
|
resetErrorInfo(saveErrorInfo);
|
|
55295
55338
|
return result;
|
|
@@ -56085,7 +56128,7 @@ var ts;
|
|
|
56085
56128
|
return typeCouldHaveTopLevelSingletonTypes(constraint);
|
|
56086
56129
|
}
|
|
56087
56130
|
}
|
|
56088
|
-
return isUnitType(type) || !!(type.flags & 134217728);
|
|
56131
|
+
return isUnitType(type) || !!(type.flags & 134217728) || !!(type.flags & 268435456);
|
|
56089
56132
|
}
|
|
56090
56133
|
function getExactOptionalUnassignableProperties(source, target) {
|
|
56091
56134
|
if (isTupleType(source) && isTupleType(target))
|
|
@@ -57352,6 +57395,24 @@ var ts;
|
|
|
57352
57395
|
return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512)
|
|
57353
57396
|
&& (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
|
|
57354
57397
|
}
|
|
57398
|
+
function isMemberOfStringMapping(source, target) {
|
|
57399
|
+
if (target.flags & (4 | 3)) {
|
|
57400
|
+
return true;
|
|
57401
|
+
}
|
|
57402
|
+
if (target.flags & 134217728) {
|
|
57403
|
+
return isTypeAssignableTo(source, target);
|
|
57404
|
+
}
|
|
57405
|
+
if (target.flags & 268435456) {
|
|
57406
|
+
var mappingStack = [];
|
|
57407
|
+
while (target.flags & 268435456) {
|
|
57408
|
+
mappingStack.unshift(target.symbol);
|
|
57409
|
+
target = target.type;
|
|
57410
|
+
}
|
|
57411
|
+
var mappedSource = ts.reduceLeft(mappingStack, function (memo, value) { return getStringMappingType(value, memo); }, source);
|
|
57412
|
+
return mappedSource === source && isMemberOfStringMapping(source, target);
|
|
57413
|
+
}
|
|
57414
|
+
return false;
|
|
57415
|
+
}
|
|
57355
57416
|
function isValidTypeForTemplateLiteralPlaceholder(source, target) {
|
|
57356
57417
|
if (source === target || target.flags & (1 | 4)) {
|
|
57357
57418
|
return true;
|
|
@@ -57360,7 +57421,8 @@ var ts;
|
|
|
57360
57421
|
var value = source.value;
|
|
57361
57422
|
return !!(target.flags & 8 && isValidNumberString(value, false) ||
|
|
57362
57423
|
target.flags & 64 && isValidBigIntString(value, false) ||
|
|
57363
|
-
target.flags & (512 | 98304) && value === target.intrinsicName
|
|
57424
|
+
target.flags & (512 | 98304) && value === target.intrinsicName ||
|
|
57425
|
+
target.flags & 268435456 && isMemberOfStringMapping(getStringLiteralType(value), target));
|
|
57364
57426
|
}
|
|
57365
57427
|
if (source.flags & 134217728) {
|
|
57366
57428
|
var texts = source.texts;
|
|
@@ -71827,10 +71889,35 @@ var ts;
|
|
|
71827
71889
|
return true;
|
|
71828
71890
|
}
|
|
71829
71891
|
function checkAliasSymbol(node) {
|
|
71892
|
+
var _a, _b, _c, _d, _e;
|
|
71830
71893
|
var symbol = getSymbolOfNode(node);
|
|
71831
71894
|
var target = resolveAlias(symbol);
|
|
71832
71895
|
if (target !== unknownSymbol) {
|
|
71833
71896
|
symbol = getMergedSymbol(symbol.exportSymbol || symbol);
|
|
71897
|
+
if (ts.isInJSFile(node) && !(target.flags & 111551) && !ts.isTypeOnlyImportOrExportDeclaration(node)) {
|
|
71898
|
+
var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name :
|
|
71899
|
+
ts.isNamedDeclaration(node) ? node.name :
|
|
71900
|
+
node;
|
|
71901
|
+
ts.Debug.assert(node.kind !== 274);
|
|
71902
|
+
if (node.kind === 275) {
|
|
71903
|
+
var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
|
|
71904
|
+
var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText);
|
|
71905
|
+
if (alreadyExportedSymbol === target) {
|
|
71906
|
+
var exportingDeclaration = (_c = alreadyExportedSymbol.declarations) === null || _c === void 0 ? void 0 : _c.find(ts.isJSDocNode);
|
|
71907
|
+
if (exportingDeclaration) {
|
|
71908
|
+
ts.addRelatedInfo(diag, ts.createDiagnosticForNode(exportingDeclaration, ts.Diagnostics._0_is_automatically_exported_here, ts.unescapeLeadingUnderscores(alreadyExportedSymbol.escapedName)));
|
|
71909
|
+
}
|
|
71910
|
+
}
|
|
71911
|
+
}
|
|
71912
|
+
else {
|
|
71913
|
+
ts.Debug.assert(node.kind !== 254);
|
|
71914
|
+
var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration));
|
|
71915
|
+
var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "...";
|
|
71916
|
+
var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName);
|
|
71917
|
+
error(errorNode, ts.Diagnostics._0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation, importedIdentifier, "import(\"" + moduleSpecifier + "\")." + importedIdentifier);
|
|
71918
|
+
}
|
|
71919
|
+
return;
|
|
71920
|
+
}
|
|
71834
71921
|
var excludedMeanings = (symbol.flags & (111551 | 1048576) ? 111551 : 0) |
|
|
71835
71922
|
(symbol.flags & 788968 ? 788968 : 0) |
|
|
71836
71923
|
(symbol.flags & 1920 ? 1920 : 0);
|