typescript 4.6.0-dev.20211208 → 4.6.0-dev.20211212
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +104 -32
- package/lib/tsserver.js +112 -32
- package/lib/tsserverlibrary.js +112 -32
- package/lib/typescript.js +112 -32
- package/lib/typescriptServices.js +112 -32
- package/lib/typingsInstaller.js +109 -32
- package/package.json +2 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211212";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -24632,7 +24632,7 @@ var ts;
|
|
|
24632
24632
|
// @api
|
|
24633
24633
|
function createAssertClause(elements, multiLine) {
|
|
24634
24634
|
var node = createBaseNode(292 /* AssertClause */);
|
|
24635
|
-
node.elements = elements;
|
|
24635
|
+
node.elements = createNodeArray(elements);
|
|
24636
24636
|
node.multiLine = multiLine;
|
|
24637
24637
|
node.transformFlags |= 4 /* ContainsESNext */;
|
|
24638
24638
|
return node;
|
|
@@ -54253,7 +54253,27 @@ var ts;
|
|
|
54253
54253
|
return mapType(source, function (t) { return getRestType(t, properties, symbol); });
|
|
54254
54254
|
}
|
|
54255
54255
|
var omitKeyType = getUnionType(ts.map(properties, getLiteralTypeFromPropertyName));
|
|
54256
|
+
var spreadableProperties = [];
|
|
54257
|
+
var unspreadableToRestKeys = [];
|
|
54258
|
+
for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
|
|
54259
|
+
var prop = _a[_i];
|
|
54260
|
+
var literalTypeFromProperty = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
54261
|
+
if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType)
|
|
54262
|
+
&& !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))
|
|
54263
|
+
&& isSpreadableProperty(prop)) {
|
|
54264
|
+
spreadableProperties.push(prop);
|
|
54265
|
+
}
|
|
54266
|
+
else {
|
|
54267
|
+
unspreadableToRestKeys.push(literalTypeFromProperty);
|
|
54268
|
+
}
|
|
54269
|
+
}
|
|
54256
54270
|
if (isGenericObjectType(source) || isGenericIndexType(omitKeyType)) {
|
|
54271
|
+
if (unspreadableToRestKeys.length) {
|
|
54272
|
+
// If the type we're spreading from has properties that cannot
|
|
54273
|
+
// be spread into the rest type (e.g. getters, methods), ensure
|
|
54274
|
+
// they are explicitly omitted, as they would in the non-generic case.
|
|
54275
|
+
omitKeyType = getUnionType(__spreadArray([omitKeyType], unspreadableToRestKeys, true));
|
|
54276
|
+
}
|
|
54257
54277
|
if (omitKeyType.flags & 131072 /* Never */) {
|
|
54258
54278
|
return source;
|
|
54259
54279
|
}
|
|
@@ -54264,13 +54284,9 @@ var ts;
|
|
|
54264
54284
|
return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
|
|
54265
54285
|
}
|
|
54266
54286
|
var members = ts.createSymbolTable();
|
|
54267
|
-
for (var
|
|
54268
|
-
var prop =
|
|
54269
|
-
|
|
54270
|
-
&& !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))
|
|
54271
|
-
&& isSpreadableProperty(prop)) {
|
|
54272
|
-
members.set(prop.escapedName, getSpreadSymbol(prop, /*readonly*/ false));
|
|
54273
|
-
}
|
|
54287
|
+
for (var _b = 0, spreadableProperties_1 = spreadableProperties; _b < spreadableProperties_1.length; _b++) {
|
|
54288
|
+
var prop = spreadableProperties_1[_b];
|
|
54289
|
+
members.set(prop.escapedName, getSpreadSymbol(prop, /*readonly*/ false));
|
|
54274
54290
|
}
|
|
54275
54291
|
var result = createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, getIndexInfosOfType(source));
|
|
54276
54292
|
result.objectFlags |= 8388608 /* ObjectRestType */;
|
|
@@ -74537,7 +74553,7 @@ var ts;
|
|
|
74537
74553
|
typeArguments.pop();
|
|
74538
74554
|
}
|
|
74539
74555
|
while (typeArguments.length < typeParameters.length) {
|
|
74540
|
-
typeArguments.push(getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
|
|
74556
|
+
typeArguments.push(getDefaultFromTypeParameter(typeParameters[typeArguments.length]) || getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
|
|
74541
74557
|
}
|
|
74542
74558
|
return typeArguments;
|
|
74543
74559
|
}
|
|
@@ -75193,8 +75209,7 @@ var ts;
|
|
|
75193
75209
|
*/
|
|
75194
75210
|
function checkCallExpression(node, checkMode) {
|
|
75195
75211
|
var _a;
|
|
75196
|
-
|
|
75197
|
-
checkGrammarArguments(node.arguments);
|
|
75212
|
+
checkGrammarTypeArguments(node, node.typeArguments);
|
|
75198
75213
|
var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode);
|
|
75199
75214
|
if (signature === resolvingSignature) {
|
|
75200
75215
|
// CheckMode.SkipGenericFunctions is enabled and this is a call to a generic function that
|
|
@@ -75299,8 +75314,7 @@ var ts;
|
|
|
75299
75314
|
}
|
|
75300
75315
|
function checkImportCallExpression(node) {
|
|
75301
75316
|
// Check grammar of dynamic import
|
|
75302
|
-
|
|
75303
|
-
checkGrammarImportCallExpression(node);
|
|
75317
|
+
checkGrammarImportCallExpression(node);
|
|
75304
75318
|
if (node.arguments.length === 0) {
|
|
75305
75319
|
return createPromiseReturnType(node, anyType);
|
|
75306
75320
|
}
|
|
@@ -82408,7 +82422,7 @@ var ts;
|
|
|
82408
82422
|
for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) {
|
|
82409
82423
|
var prop = properties_4[_a];
|
|
82410
82424
|
var existing = seen.get(prop.escapedName);
|
|
82411
|
-
if (existing &&
|
|
82425
|
+
if (existing && prop.parent === existing.parent) {
|
|
82412
82426
|
seen.delete(prop.escapedName);
|
|
82413
82427
|
}
|
|
82414
82428
|
}
|
|
@@ -85961,20 +85975,6 @@ var ts;
|
|
|
85961
85975
|
}
|
|
85962
85976
|
return false;
|
|
85963
85977
|
}
|
|
85964
|
-
function checkGrammarForOmittedArgument(args) {
|
|
85965
|
-
if (args) {
|
|
85966
|
-
for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
|
|
85967
|
-
var arg = args_4[_i];
|
|
85968
|
-
if (arg.kind === 226 /* OmittedExpression */) {
|
|
85969
|
-
return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
|
|
85970
|
-
}
|
|
85971
|
-
}
|
|
85972
|
-
}
|
|
85973
|
-
return false;
|
|
85974
|
-
}
|
|
85975
|
-
function checkGrammarArguments(args) {
|
|
85976
|
-
return checkGrammarForOmittedArgument(args);
|
|
85977
|
-
}
|
|
85978
85978
|
function checkGrammarHeritageClause(node) {
|
|
85979
85979
|
var types = node.types;
|
|
85980
85980
|
if (checkGrammarForDisallowedTrailingComma(types)) {
|
|
@@ -103222,7 +103222,7 @@ var ts;
|
|
|
103222
103222
|
if (ts.isIdentifier(node.expression)) {
|
|
103223
103223
|
var expression = substituteExpressionIdentifier(node.expression);
|
|
103224
103224
|
noSubstitution[ts.getNodeId(expression)] = true;
|
|
103225
|
-
if (!ts.isIdentifier(expression)) {
|
|
103225
|
+
if (!ts.isIdentifier(expression) && !(ts.getEmitFlags(node.expression) & 4096 /* HelperName */)) {
|
|
103226
103226
|
return ts.addEmitFlags(factory.updateCallExpression(node, expression,
|
|
103227
103227
|
/*typeArguments*/ undefined, node.arguments), 536870912 /* IndirectCall */);
|
|
103228
103228
|
}
|
|
@@ -103233,7 +103233,7 @@ var ts;
|
|
|
103233
103233
|
if (ts.isIdentifier(node.tag)) {
|
|
103234
103234
|
var tag = substituteExpressionIdentifier(node.tag);
|
|
103235
103235
|
noSubstitution[ts.getNodeId(tag)] = true;
|
|
103236
|
-
if (!ts.isIdentifier(tag)) {
|
|
103236
|
+
if (!ts.isIdentifier(tag) && !(ts.getEmitFlags(node.tag) & 4096 /* HelperName */)) {
|
|
103237
103237
|
return ts.addEmitFlags(factory.updateTaggedTemplateExpression(node, tag,
|
|
103238
103238
|
/*typeArguments*/ undefined, node.template), 536870912 /* IndirectCall */);
|
|
103239
103239
|
}
|
|
@@ -113859,6 +113859,7 @@ var ts;
|
|
|
113859
113859
|
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
113860
113860
|
/** @internal */
|
|
113861
113861
|
ts.plainJSErrors = new ts.Set([
|
|
113862
|
+
// binder errors
|
|
113862
113863
|
ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
|
|
113863
113864
|
ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
|
|
113864
113865
|
ts.Diagnostics.Another_export_default_is_here.code,
|
|
@@ -113874,6 +113875,81 @@ var ts;
|
|
|
113874
113875
|
ts.Diagnostics.A_label_is_not_allowed_here.code,
|
|
113875
113876
|
ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
|
|
113876
113877
|
ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
|
|
113878
|
+
// grammar errors
|
|
113879
|
+
ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,
|
|
113880
|
+
ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code,
|
|
113881
|
+
ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code,
|
|
113882
|
+
ts.Diagnostics.A_class_member_cannot_have_the_0_keyword.code,
|
|
113883
|
+
ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code,
|
|
113884
|
+
ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code,
|
|
113885
|
+
ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
|
|
113886
|
+
ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
|
|
113887
|
+
ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code,
|
|
113888
|
+
ts.Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code,
|
|
113889
|
+
ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code,
|
|
113890
|
+
ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer.code,
|
|
113891
|
+
ts.Diagnostics.A_get_accessor_cannot_have_parameters.code,
|
|
113892
|
+
ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern.code,
|
|
113893
|
+
ts.Diagnostics.A_rest_element_cannot_have_a_property_name.code,
|
|
113894
|
+
ts.Diagnostics.A_rest_element_cannot_have_an_initializer.code,
|
|
113895
|
+
ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern.code,
|
|
113896
|
+
ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
|
|
113897
|
+
ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
|
|
113898
|
+
ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
|
|
113899
|
+
ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
|
|
113900
|
+
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
113901
|
+
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
113902
|
+
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
113903
|
+
ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module.code,
|
|
113904
|
+
ts.Diagnostics.An_export_declaration_cannot_have_modifiers.code,
|
|
113905
|
+
ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module.code,
|
|
113906
|
+
ts.Diagnostics.An_import_declaration_cannot_have_modifiers.code,
|
|
113907
|
+
ts.Diagnostics.An_object_member_cannot_be_declared_optional.code,
|
|
113908
|
+
ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
|
|
113909
|
+
ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code,
|
|
113910
|
+
ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code,
|
|
113911
|
+
ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code,
|
|
113912
|
+
ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code,
|
|
113913
|
+
ts.Diagnostics.Classes_can_only_extend_a_single_class.code,
|
|
113914
|
+
ts.Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
|
|
113915
|
+
ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code,
|
|
113916
|
+
ts.Diagnostics.Duplicate_label_0.code,
|
|
113917
|
+
ts.Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code,
|
|
113918
|
+
ts.Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block.code,
|
|
113919
|
+
ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,
|
|
113920
|
+
ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,
|
|
113921
|
+
ts.Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array.code,
|
|
113922
|
+
ts.Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code,
|
|
113923
|
+
ts.Diagnostics.Jump_target_cannot_cross_function_boundary.code,
|
|
113924
|
+
ts.Diagnostics.Line_terminator_not_permitted_before_arrow.code,
|
|
113925
|
+
ts.Diagnostics.Modifiers_cannot_appear_here.code,
|
|
113926
|
+
ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code,
|
|
113927
|
+
ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code,
|
|
113928
|
+
ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code,
|
|
113929
|
+
ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code,
|
|
113930
|
+
ts.Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier.code,
|
|
113931
|
+
ts.Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain.code,
|
|
113932
|
+
ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async.code,
|
|
113933
|
+
ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer.code,
|
|
113934
|
+
ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer.code,
|
|
113935
|
+
ts.Diagnostics.Trailing_comma_not_allowed.code,
|
|
113936
|
+
ts.Diagnostics.Variable_declaration_list_cannot_be_empty.code,
|
|
113937
|
+
ts.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses.code,
|
|
113938
|
+
ts.Diagnostics._0_expected.code,
|
|
113939
|
+
ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2.code,
|
|
113940
|
+
ts.Diagnostics._0_list_cannot_be_empty.code,
|
|
113941
|
+
ts.Diagnostics._0_modifier_already_seen.code,
|
|
113942
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration.code,
|
|
113943
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element.code,
|
|
113944
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter.code,
|
|
113945
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind.code,
|
|
113946
|
+
ts.Diagnostics._0_modifier_cannot_be_used_here.code,
|
|
113947
|
+
ts.Diagnostics._0_modifier_must_precede_1_modifier.code,
|
|
113948
|
+
ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code,
|
|
113949
|
+
ts.Diagnostics.const_declarations_must_be_initialized.code,
|
|
113950
|
+
ts.Diagnostics.extends_clause_already_seen.code,
|
|
113951
|
+
ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,
|
|
113952
|
+
ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
113877
113953
|
]);
|
|
113878
113954
|
/**
|
|
113879
113955
|
* Determine if source file needs to be re-created even if its text hasn't changed
|
|
@@ -114903,9 +114979,10 @@ var ts;
|
|
|
114903
114979
|
var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
|
|
114904
114980
|
|| sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
|
|
114905
114981
|
var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
|
|
114906
|
-
var checkDiagnostics = includeBindAndCheckDiagnostics
|
|
114982
|
+
var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
|
|
114907
114983
|
if (isPlainJs) {
|
|
114908
114984
|
bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
|
|
114985
|
+
checkDiagnostics = ts.filter(checkDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
|
|
114909
114986
|
}
|
|
114910
114987
|
// skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
|
|
114911
114988
|
return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
|
|
@@ -127981,6 +128058,9 @@ var ts;
|
|
|
127981
128058
|
}
|
|
127982
128059
|
return;
|
|
127983
128060
|
}
|
|
128061
|
+
if (ts.isConstTypeReference(token.parent)) {
|
|
128062
|
+
return 3 /* keyword */;
|
|
128063
|
+
}
|
|
127984
128064
|
}
|
|
127985
128065
|
return 2 /* identifier */;
|
|
127986
128066
|
}
|
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-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211212";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -24632,7 +24632,7 @@ var ts;
|
|
|
24632
24632
|
// @api
|
|
24633
24633
|
function createAssertClause(elements, multiLine) {
|
|
24634
24634
|
var node = createBaseNode(292 /* AssertClause */);
|
|
24635
|
-
node.elements = elements;
|
|
24635
|
+
node.elements = createNodeArray(elements);
|
|
24636
24636
|
node.multiLine = multiLine;
|
|
24637
24637
|
node.transformFlags |= 4 /* ContainsESNext */;
|
|
24638
24638
|
return node;
|
|
@@ -54253,7 +54253,27 @@ var ts;
|
|
|
54253
54253
|
return mapType(source, function (t) { return getRestType(t, properties, symbol); });
|
|
54254
54254
|
}
|
|
54255
54255
|
var omitKeyType = getUnionType(ts.map(properties, getLiteralTypeFromPropertyName));
|
|
54256
|
+
var spreadableProperties = [];
|
|
54257
|
+
var unspreadableToRestKeys = [];
|
|
54258
|
+
for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
|
|
54259
|
+
var prop = _a[_i];
|
|
54260
|
+
var literalTypeFromProperty = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
54261
|
+
if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType)
|
|
54262
|
+
&& !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))
|
|
54263
|
+
&& isSpreadableProperty(prop)) {
|
|
54264
|
+
spreadableProperties.push(prop);
|
|
54265
|
+
}
|
|
54266
|
+
else {
|
|
54267
|
+
unspreadableToRestKeys.push(literalTypeFromProperty);
|
|
54268
|
+
}
|
|
54269
|
+
}
|
|
54256
54270
|
if (isGenericObjectType(source) || isGenericIndexType(omitKeyType)) {
|
|
54271
|
+
if (unspreadableToRestKeys.length) {
|
|
54272
|
+
// If the type we're spreading from has properties that cannot
|
|
54273
|
+
// be spread into the rest type (e.g. getters, methods), ensure
|
|
54274
|
+
// they are explicitly omitted, as they would in the non-generic case.
|
|
54275
|
+
omitKeyType = getUnionType(__spreadArray([omitKeyType], unspreadableToRestKeys, true));
|
|
54276
|
+
}
|
|
54257
54277
|
if (omitKeyType.flags & 131072 /* Never */) {
|
|
54258
54278
|
return source;
|
|
54259
54279
|
}
|
|
@@ -54264,13 +54284,9 @@ var ts;
|
|
|
54264
54284
|
return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
|
|
54265
54285
|
}
|
|
54266
54286
|
var members = ts.createSymbolTable();
|
|
54267
|
-
for (var
|
|
54268
|
-
var prop =
|
|
54269
|
-
|
|
54270
|
-
&& !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))
|
|
54271
|
-
&& isSpreadableProperty(prop)) {
|
|
54272
|
-
members.set(prop.escapedName, getSpreadSymbol(prop, /*readonly*/ false));
|
|
54273
|
-
}
|
|
54287
|
+
for (var _b = 0, spreadableProperties_1 = spreadableProperties; _b < spreadableProperties_1.length; _b++) {
|
|
54288
|
+
var prop = spreadableProperties_1[_b];
|
|
54289
|
+
members.set(prop.escapedName, getSpreadSymbol(prop, /*readonly*/ false));
|
|
54274
54290
|
}
|
|
54275
54291
|
var result = createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, getIndexInfosOfType(source));
|
|
54276
54292
|
result.objectFlags |= 8388608 /* ObjectRestType */;
|
|
@@ -74537,7 +74553,7 @@ var ts;
|
|
|
74537
74553
|
typeArguments.pop();
|
|
74538
74554
|
}
|
|
74539
74555
|
while (typeArguments.length < typeParameters.length) {
|
|
74540
|
-
typeArguments.push(getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
|
|
74556
|
+
typeArguments.push(getDefaultFromTypeParameter(typeParameters[typeArguments.length]) || getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
|
|
74541
74557
|
}
|
|
74542
74558
|
return typeArguments;
|
|
74543
74559
|
}
|
|
@@ -75193,8 +75209,7 @@ var ts;
|
|
|
75193
75209
|
*/
|
|
75194
75210
|
function checkCallExpression(node, checkMode) {
|
|
75195
75211
|
var _a;
|
|
75196
|
-
|
|
75197
|
-
checkGrammarArguments(node.arguments);
|
|
75212
|
+
checkGrammarTypeArguments(node, node.typeArguments);
|
|
75198
75213
|
var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode);
|
|
75199
75214
|
if (signature === resolvingSignature) {
|
|
75200
75215
|
// CheckMode.SkipGenericFunctions is enabled and this is a call to a generic function that
|
|
@@ -75299,8 +75314,7 @@ var ts;
|
|
|
75299
75314
|
}
|
|
75300
75315
|
function checkImportCallExpression(node) {
|
|
75301
75316
|
// Check grammar of dynamic import
|
|
75302
|
-
|
|
75303
|
-
checkGrammarImportCallExpression(node);
|
|
75317
|
+
checkGrammarImportCallExpression(node);
|
|
75304
75318
|
if (node.arguments.length === 0) {
|
|
75305
75319
|
return createPromiseReturnType(node, anyType);
|
|
75306
75320
|
}
|
|
@@ -82408,7 +82422,7 @@ var ts;
|
|
|
82408
82422
|
for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) {
|
|
82409
82423
|
var prop = properties_4[_a];
|
|
82410
82424
|
var existing = seen.get(prop.escapedName);
|
|
82411
|
-
if (existing &&
|
|
82425
|
+
if (existing && prop.parent === existing.parent) {
|
|
82412
82426
|
seen.delete(prop.escapedName);
|
|
82413
82427
|
}
|
|
82414
82428
|
}
|
|
@@ -85961,20 +85975,6 @@ var ts;
|
|
|
85961
85975
|
}
|
|
85962
85976
|
return false;
|
|
85963
85977
|
}
|
|
85964
|
-
function checkGrammarForOmittedArgument(args) {
|
|
85965
|
-
if (args) {
|
|
85966
|
-
for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
|
|
85967
|
-
var arg = args_4[_i];
|
|
85968
|
-
if (arg.kind === 226 /* OmittedExpression */) {
|
|
85969
|
-
return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
|
|
85970
|
-
}
|
|
85971
|
-
}
|
|
85972
|
-
}
|
|
85973
|
-
return false;
|
|
85974
|
-
}
|
|
85975
|
-
function checkGrammarArguments(args) {
|
|
85976
|
-
return checkGrammarForOmittedArgument(args);
|
|
85977
|
-
}
|
|
85978
85978
|
function checkGrammarHeritageClause(node) {
|
|
85979
85979
|
var types = node.types;
|
|
85980
85980
|
if (checkGrammarForDisallowedTrailingComma(types)) {
|
|
@@ -103222,7 +103222,7 @@ var ts;
|
|
|
103222
103222
|
if (ts.isIdentifier(node.expression)) {
|
|
103223
103223
|
var expression = substituteExpressionIdentifier(node.expression);
|
|
103224
103224
|
noSubstitution[ts.getNodeId(expression)] = true;
|
|
103225
|
-
if (!ts.isIdentifier(expression)) {
|
|
103225
|
+
if (!ts.isIdentifier(expression) && !(ts.getEmitFlags(node.expression) & 4096 /* HelperName */)) {
|
|
103226
103226
|
return ts.addEmitFlags(factory.updateCallExpression(node, expression,
|
|
103227
103227
|
/*typeArguments*/ undefined, node.arguments), 536870912 /* IndirectCall */);
|
|
103228
103228
|
}
|
|
@@ -103233,7 +103233,7 @@ var ts;
|
|
|
103233
103233
|
if (ts.isIdentifier(node.tag)) {
|
|
103234
103234
|
var tag = substituteExpressionIdentifier(node.tag);
|
|
103235
103235
|
noSubstitution[ts.getNodeId(tag)] = true;
|
|
103236
|
-
if (!ts.isIdentifier(tag)) {
|
|
103236
|
+
if (!ts.isIdentifier(tag) && !(ts.getEmitFlags(node.tag) & 4096 /* HelperName */)) {
|
|
103237
103237
|
return ts.addEmitFlags(factory.updateTaggedTemplateExpression(node, tag,
|
|
103238
103238
|
/*typeArguments*/ undefined, node.template), 536870912 /* IndirectCall */);
|
|
103239
103239
|
}
|
|
@@ -113859,6 +113859,7 @@ var ts;
|
|
|
113859
113859
|
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
113860
113860
|
/** @internal */
|
|
113861
113861
|
ts.plainJSErrors = new ts.Set([
|
|
113862
|
+
// binder errors
|
|
113862
113863
|
ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
|
|
113863
113864
|
ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
|
|
113864
113865
|
ts.Diagnostics.Another_export_default_is_here.code,
|
|
@@ -113874,6 +113875,81 @@ var ts;
|
|
|
113874
113875
|
ts.Diagnostics.A_label_is_not_allowed_here.code,
|
|
113875
113876
|
ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
|
|
113876
113877
|
ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
|
|
113878
|
+
// grammar errors
|
|
113879
|
+
ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,
|
|
113880
|
+
ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code,
|
|
113881
|
+
ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code,
|
|
113882
|
+
ts.Diagnostics.A_class_member_cannot_have_the_0_keyword.code,
|
|
113883
|
+
ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code,
|
|
113884
|
+
ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code,
|
|
113885
|
+
ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
|
|
113886
|
+
ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
|
|
113887
|
+
ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code,
|
|
113888
|
+
ts.Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code,
|
|
113889
|
+
ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code,
|
|
113890
|
+
ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer.code,
|
|
113891
|
+
ts.Diagnostics.A_get_accessor_cannot_have_parameters.code,
|
|
113892
|
+
ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern.code,
|
|
113893
|
+
ts.Diagnostics.A_rest_element_cannot_have_a_property_name.code,
|
|
113894
|
+
ts.Diagnostics.A_rest_element_cannot_have_an_initializer.code,
|
|
113895
|
+
ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern.code,
|
|
113896
|
+
ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
|
|
113897
|
+
ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
|
|
113898
|
+
ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
|
|
113899
|
+
ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
|
|
113900
|
+
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
113901
|
+
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
113902
|
+
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
113903
|
+
ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module.code,
|
|
113904
|
+
ts.Diagnostics.An_export_declaration_cannot_have_modifiers.code,
|
|
113905
|
+
ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module.code,
|
|
113906
|
+
ts.Diagnostics.An_import_declaration_cannot_have_modifiers.code,
|
|
113907
|
+
ts.Diagnostics.An_object_member_cannot_be_declared_optional.code,
|
|
113908
|
+
ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
|
|
113909
|
+
ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code,
|
|
113910
|
+
ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code,
|
|
113911
|
+
ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code,
|
|
113912
|
+
ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code,
|
|
113913
|
+
ts.Diagnostics.Classes_can_only_extend_a_single_class.code,
|
|
113914
|
+
ts.Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
|
|
113915
|
+
ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code,
|
|
113916
|
+
ts.Diagnostics.Duplicate_label_0.code,
|
|
113917
|
+
ts.Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code,
|
|
113918
|
+
ts.Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block.code,
|
|
113919
|
+
ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,
|
|
113920
|
+
ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,
|
|
113921
|
+
ts.Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array.code,
|
|
113922
|
+
ts.Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code,
|
|
113923
|
+
ts.Diagnostics.Jump_target_cannot_cross_function_boundary.code,
|
|
113924
|
+
ts.Diagnostics.Line_terminator_not_permitted_before_arrow.code,
|
|
113925
|
+
ts.Diagnostics.Modifiers_cannot_appear_here.code,
|
|
113926
|
+
ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code,
|
|
113927
|
+
ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code,
|
|
113928
|
+
ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code,
|
|
113929
|
+
ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code,
|
|
113930
|
+
ts.Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier.code,
|
|
113931
|
+
ts.Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain.code,
|
|
113932
|
+
ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async.code,
|
|
113933
|
+
ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer.code,
|
|
113934
|
+
ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer.code,
|
|
113935
|
+
ts.Diagnostics.Trailing_comma_not_allowed.code,
|
|
113936
|
+
ts.Diagnostics.Variable_declaration_list_cannot_be_empty.code,
|
|
113937
|
+
ts.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses.code,
|
|
113938
|
+
ts.Diagnostics._0_expected.code,
|
|
113939
|
+
ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2.code,
|
|
113940
|
+
ts.Diagnostics._0_list_cannot_be_empty.code,
|
|
113941
|
+
ts.Diagnostics._0_modifier_already_seen.code,
|
|
113942
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration.code,
|
|
113943
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element.code,
|
|
113944
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter.code,
|
|
113945
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind.code,
|
|
113946
|
+
ts.Diagnostics._0_modifier_cannot_be_used_here.code,
|
|
113947
|
+
ts.Diagnostics._0_modifier_must_precede_1_modifier.code,
|
|
113948
|
+
ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code,
|
|
113949
|
+
ts.Diagnostics.const_declarations_must_be_initialized.code,
|
|
113950
|
+
ts.Diagnostics.extends_clause_already_seen.code,
|
|
113951
|
+
ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,
|
|
113952
|
+
ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
113877
113953
|
]);
|
|
113878
113954
|
/**
|
|
113879
113955
|
* Determine if source file needs to be re-created even if its text hasn't changed
|
|
@@ -114903,9 +114979,10 @@ var ts;
|
|
|
114903
114979
|
var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
|
|
114904
114980
|
|| sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
|
|
114905
114981
|
var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
|
|
114906
|
-
var checkDiagnostics = includeBindAndCheckDiagnostics
|
|
114982
|
+
var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
|
|
114907
114983
|
if (isPlainJs) {
|
|
114908
114984
|
bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
|
|
114985
|
+
checkDiagnostics = ts.filter(checkDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
|
|
114909
114986
|
}
|
|
114910
114987
|
// skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
|
|
114911
114988
|
return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
|
|
@@ -127981,6 +128058,9 @@ var ts;
|
|
|
127981
128058
|
}
|
|
127982
128059
|
return;
|
|
127983
128060
|
}
|
|
128061
|
+
if (ts.isConstTypeReference(token.parent)) {
|
|
128062
|
+
return 3 /* keyword */;
|
|
128063
|
+
}
|
|
127984
128064
|
}
|
|
127985
128065
|
return 2 /* identifier */;
|
|
127986
128066
|
}
|