typescript 5.5.0-dev.20240312 → 5.5.0-dev.20240314
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 +126 -52
- package/lib/tsserver.js +238 -136
- package/lib/typescript.js +238 -136
- package/lib/typingsInstaller.js +10 -3
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240314`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6096,6 +6096,8 @@ var Diagnostics = {
|
|
|
6096
6096
|
The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration: diag(1494, 1 /* Error */, "The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration_1494", "The left-hand side of a 'for...in' statement cannot be an 'await using' declaration."),
|
|
6097
6097
|
_0_modifier_cannot_appear_on_an_await_using_declaration: diag(1495, 1 /* Error */, "_0_modifier_cannot_appear_on_an_await_using_declaration_1495", "'{0}' modifier cannot appear on an 'await using' declaration."),
|
|
6098
6098
|
Identifier_string_literal_or_number_literal_expected: diag(1496, 1 /* Error */, "Identifier_string_literal_or_number_literal_expected_1496", "Identifier, string literal, or number literal expected."),
|
|
6099
|
+
Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator: diag(1497, 1 /* Error */, "Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator_1497", "Expression must be enclosed in parentheses to be used as a decorator."),
|
|
6100
|
+
Invalid_syntax_in_decorator: diag(1498, 1 /* Error */, "Invalid_syntax_in_decorator_1498", "Invalid syntax in decorator."),
|
|
6099
6101
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
6100
6102
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
6101
6103
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -6342,7 +6344,7 @@ var Diagnostics = {
|
|
|
6342
6344
|
Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, 1 /* Error */, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."),
|
|
6343
6345
|
Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, 1 /* Error */, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),
|
|
6344
6346
|
A_tuple_type_cannot_be_indexed_with_a_negative_value: diag(2514, 1 /* Error */, "A_tuple_type_cannot_be_indexed_with_a_negative_value_2514", "A tuple type cannot be indexed with a negative value."),
|
|
6345
|
-
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, 1 /* Error */, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member
|
|
6347
|
+
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, 1 /* Error */, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member {1} from class '{2}'."),
|
|
6346
6348
|
All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, 1 /* Error */, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."),
|
|
6347
6349
|
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, 1 /* Error */, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."),
|
|
6348
6350
|
A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: diag(2518, 1 /* Error */, "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", "A 'this'-based type guard is not compatible with a parameter-based type guard."),
|
|
@@ -6452,9 +6454,13 @@ var Diagnostics = {
|
|
|
6452
6454
|
Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, 1 /* Error */, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."),
|
|
6453
6455
|
React_components_cannot_include_JSX_namespace_names: diag(2639, 1 /* Error */, "React_components_cannot_include_JSX_namespace_names_2639", "React components cannot include JSX namespace names"),
|
|
6454
6456
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, 1 /* 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."),
|
|
6457
|
+
Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more: diag(2650, 1 /* Error */, "Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and__2650", "Non-abstract class expression is missing implementations for the following members of '{0}': {1} and {2} more."),
|
|
6455
6458
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, 1 /* 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."),
|
|
6456
6459
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, 1 /* 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."),
|
|
6457
6460
|
Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: diag(2653, 1 /* Error */, "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."),
|
|
6461
|
+
Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2: diag(2654, 1 /* Error */, "Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_2654", "Non-abstract class '{0}' is missing implementations for the following members of '{1}': {2}."),
|
|
6462
|
+
Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more: diag(2655, 1 /* Error */, "Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more_2655", "Non-abstract class '{0}' is missing implementations for the following members of '{1}': {2} and {3} more."),
|
|
6463
|
+
Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1: diag(2656, 1 /* Error */, "Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_2656", "Non-abstract class expression is missing implementations for the following members of '{0}': {1}."),
|
|
6458
6464
|
JSX_expressions_must_have_one_parent_element: diag(2657, 1 /* Error */, "JSX_expressions_must_have_one_parent_element_2657", "JSX expressions must have one parent element."),
|
|
6459
6465
|
Type_0_provides_no_match_for_the_signature_1: diag(2658, 1 /* Error */, "Type_0_provides_no_match_for_the_signature_1_2658", "Type '{0}' provides no match for the signature '{1}'."),
|
|
6460
6466
|
super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: diag(2659, 1 /* Error */, "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."),
|
|
@@ -7743,6 +7749,8 @@ var Diagnostics = {
|
|
|
7743
7749
|
Add_optional_parameter_to_0: diag(95191, 3 /* Message */, "Add_optional_parameter_to_0_95191", "Add optional parameter to '{0}'"),
|
|
7744
7750
|
Add_optional_parameters_to_0: diag(95192, 3 /* Message */, "Add_optional_parameters_to_0_95192", "Add optional parameters to '{0}'"),
|
|
7745
7751
|
Add_all_optional_parameters: diag(95193, 3 /* Message */, "Add_all_optional_parameters_95193", "Add all optional parameters"),
|
|
7752
|
+
Wrap_in_parentheses: diag(95194, 3 /* Message */, "Wrap_in_parentheses_95194", "Wrap in parentheses"),
|
|
7753
|
+
Wrap_all_invalid_decorator_expressions_in_parentheses: diag(95195, 3 /* Message */, "Wrap_all_invalid_decorator_expressions_in_parentheses_95195", "Wrap all invalid decorator expressions in parentheses"),
|
|
7746
7754
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7747
7755
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7748
7756
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -7783,7 +7791,6 @@ var Diagnostics = {
|
|
|
7783
7791
|
_0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
|
|
7784
7792
|
The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
|
|
7785
7793
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
7786
|
-
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
7787
7794
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
7788
7795
|
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
7789
7796
|
};
|
|
@@ -17570,7 +17577,7 @@ function canUsePropertyAccess(name, languageVersion) {
|
|
|
17570
17577
|
}
|
|
17571
17578
|
function isJSDocOptionalParameter(node) {
|
|
17572
17579
|
return isInJSFile(node) && // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType
|
|
17573
|
-
(node.type && node.type.kind === 316 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(
|
|
17580
|
+
(node.type && node.type.kind === 316 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(isOptionalJSDocPropertyLikeTag));
|
|
17574
17581
|
}
|
|
17575
17582
|
function isOptionalDeclaration(declaration) {
|
|
17576
17583
|
switch (declaration.kind) {
|
|
@@ -17647,6 +17654,20 @@ function replaceFirstStar(s, replacement) {
|
|
|
17647
17654
|
function getNameFromImportAttribute(node) {
|
|
17648
17655
|
return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
|
|
17649
17656
|
}
|
|
17657
|
+
function isSyntacticallyString(expr) {
|
|
17658
|
+
expr = skipOuterExpressions(expr);
|
|
17659
|
+
switch (expr.kind) {
|
|
17660
|
+
case 226 /* BinaryExpression */:
|
|
17661
|
+
const left = expr.left;
|
|
17662
|
+
const right = expr.right;
|
|
17663
|
+
return expr.operatorToken.kind === 40 /* PlusToken */ && (isSyntacticallyString(left) || isSyntacticallyString(right));
|
|
17664
|
+
case 228 /* TemplateExpression */:
|
|
17665
|
+
case 11 /* StringLiteral */:
|
|
17666
|
+
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
17667
|
+
return true;
|
|
17668
|
+
}
|
|
17669
|
+
return false;
|
|
17670
|
+
}
|
|
17650
17671
|
|
|
17651
17672
|
// src/compiler/factory/baseNodeFactory.ts
|
|
17652
17673
|
function createBaseNodeFactory() {
|
|
@@ -55356,10 +55377,16 @@ function createTypeChecker(host) {
|
|
|
55356
55377
|
const symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */);
|
|
55357
55378
|
return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol;
|
|
55358
55379
|
}
|
|
55380
|
+
function hasEffectiveQuestionToken(node) {
|
|
55381
|
+
return hasQuestionToken(node) || isOptionalJSDocPropertyLikeTag(node) || isParameter(node) && isJSDocOptionalParameter(node);
|
|
55382
|
+
}
|
|
55359
55383
|
function isOptionalParameter(node) {
|
|
55360
|
-
if (
|
|
55384
|
+
if (hasEffectiveQuestionToken(node)) {
|
|
55361
55385
|
return true;
|
|
55362
55386
|
}
|
|
55387
|
+
if (!isParameter(node)) {
|
|
55388
|
+
return false;
|
|
55389
|
+
}
|
|
55363
55390
|
if (node.initializer) {
|
|
55364
55391
|
const signature = getSignatureFromDeclaration(node.parent);
|
|
55365
55392
|
const parameterIndex = node.parent.parameters.indexOf(node);
|
|
@@ -55459,7 +55486,7 @@ function createTypeChecker(host) {
|
|
|
55459
55486
|
if (type && type.kind === 201 /* LiteralType */) {
|
|
55460
55487
|
flags |= 2 /* HasLiteralTypes */;
|
|
55461
55488
|
}
|
|
55462
|
-
const isOptionalParameter2 =
|
|
55489
|
+
const isOptionalParameter2 = hasEffectiveQuestionToken(param) || isParameter(param) && param.initializer || isRestParameter(param) || iife && parameters.length > iife.arguments.length && !type;
|
|
55463
55490
|
if (!isOptionalParameter2) {
|
|
55464
55491
|
minArgumentCount = parameters.length;
|
|
55465
55492
|
}
|
|
@@ -57582,7 +57609,7 @@ function createTypeChecker(host) {
|
|
|
57582
57609
|
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
57583
57610
|
const typeVariable = typeSet[typeVarIndex];
|
|
57584
57611
|
const primitiveType = typeSet[1 - typeVarIndex];
|
|
57585
|
-
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
57612
|
+
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
57586
57613
|
const constraint = getBaseConstraintOfType(typeVariable);
|
|
57587
57614
|
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
|
|
57588
57615
|
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
|
|
@@ -58187,6 +58214,9 @@ function createTypeChecker(host) {
|
|
|
58187
58214
|
function isPatternLiteralType(type) {
|
|
58188
58215
|
return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
|
|
58189
58216
|
}
|
|
58217
|
+
function isGenericStringLikeType(type) {
|
|
58218
|
+
return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type);
|
|
58219
|
+
}
|
|
58190
58220
|
function isGenericType(type) {
|
|
58191
58221
|
return !!getGenericObjectFlags(type);
|
|
58192
58222
|
}
|
|
@@ -58209,7 +58239,7 @@ function createTypeChecker(host) {
|
|
|
58209
58239
|
}
|
|
58210
58240
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
58211
58241
|
}
|
|
58212
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */
|
|
58242
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
58213
58243
|
}
|
|
58214
58244
|
function getSimplifiedType(type, writing) {
|
|
58215
58245
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -72147,7 +72177,7 @@ function createTypeChecker(host) {
|
|
|
72147
72177
|
}
|
|
72148
72178
|
return resolveErrorCall(node);
|
|
72149
72179
|
}
|
|
72150
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
72180
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
72151
72181
|
skippedGenericFunction(node, checkMode);
|
|
72152
72182
|
return resolvingSignature;
|
|
72153
72183
|
}
|
|
@@ -72157,12 +72187,8 @@ function createTypeChecker(host) {
|
|
|
72157
72187
|
}
|
|
72158
72188
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
72159
72189
|
}
|
|
72160
|
-
function
|
|
72161
|
-
|
|
72162
|
-
return false;
|
|
72163
|
-
}
|
|
72164
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
72165
|
-
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
72190
|
+
function isGenericFunctionReturningFunction(signature) {
|
|
72191
|
+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
72166
72192
|
}
|
|
72167
72193
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
72168
72194
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -77340,7 +77366,56 @@ function createTypeChecker(host) {
|
|
|
77340
77366
|
}
|
|
77341
77367
|
}
|
|
77342
77368
|
}
|
|
77369
|
+
function checkGrammarDecorator(decorator) {
|
|
77370
|
+
const sourceFile = getSourceFileOfNode(decorator);
|
|
77371
|
+
if (!hasParseDiagnostics(sourceFile)) {
|
|
77372
|
+
let node = decorator.expression;
|
|
77373
|
+
if (isParenthesizedExpression(node)) {
|
|
77374
|
+
return false;
|
|
77375
|
+
}
|
|
77376
|
+
let canHaveCallExpression = true;
|
|
77377
|
+
let errorNode;
|
|
77378
|
+
while (true) {
|
|
77379
|
+
if (isExpressionWithTypeArguments(node) || isNonNullExpression(node)) {
|
|
77380
|
+
node = node.expression;
|
|
77381
|
+
continue;
|
|
77382
|
+
}
|
|
77383
|
+
if (isCallExpression(node)) {
|
|
77384
|
+
if (!canHaveCallExpression) {
|
|
77385
|
+
errorNode = node;
|
|
77386
|
+
}
|
|
77387
|
+
if (node.questionDotToken) {
|
|
77388
|
+
errorNode = node.questionDotToken;
|
|
77389
|
+
}
|
|
77390
|
+
node = node.expression;
|
|
77391
|
+
canHaveCallExpression = false;
|
|
77392
|
+
continue;
|
|
77393
|
+
}
|
|
77394
|
+
if (isPropertyAccessExpression(node)) {
|
|
77395
|
+
if (node.questionDotToken) {
|
|
77396
|
+
errorNode = node.questionDotToken;
|
|
77397
|
+
}
|
|
77398
|
+
node = node.expression;
|
|
77399
|
+
canHaveCallExpression = false;
|
|
77400
|
+
continue;
|
|
77401
|
+
}
|
|
77402
|
+
if (!isIdentifier(node)) {
|
|
77403
|
+
errorNode = node;
|
|
77404
|
+
}
|
|
77405
|
+
break;
|
|
77406
|
+
}
|
|
77407
|
+
if (errorNode) {
|
|
77408
|
+
addRelatedInfo(
|
|
77409
|
+
error(decorator.expression, Diagnostics.Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator),
|
|
77410
|
+
createDiagnosticForNode(errorNode, Diagnostics.Invalid_syntax_in_decorator)
|
|
77411
|
+
);
|
|
77412
|
+
return true;
|
|
77413
|
+
}
|
|
77414
|
+
}
|
|
77415
|
+
return false;
|
|
77416
|
+
}
|
|
77343
77417
|
function checkDecorator(node) {
|
|
77418
|
+
checkGrammarDecorator(node);
|
|
77344
77419
|
const signature = getResolvedSignature(node);
|
|
77345
77420
|
checkDeprecatedSignature(signature, node);
|
|
77346
77421
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -80036,9 +80111,9 @@ function createTypeChecker(host) {
|
|
|
80036
80111
|
return filter(symbol.declarations, (d) => d.kind === 263 /* ClassDeclaration */ || d.kind === 264 /* InterfaceDeclaration */);
|
|
80037
80112
|
}
|
|
80038
80113
|
function checkKindsOfPropertyMemberOverrides(type, baseType) {
|
|
80039
|
-
var _a, _b, _c, _d;
|
|
80114
|
+
var _a, _b, _c, _d, _e;
|
|
80040
80115
|
const baseProperties = getPropertiesOfType(baseType);
|
|
80041
|
-
|
|
80116
|
+
const notImplementedInfo = /* @__PURE__ */ new Map();
|
|
80042
80117
|
basePropertyCheck:
|
|
80043
80118
|
for (const baseProperty of baseProperties) {
|
|
80044
80119
|
const base = getTargetSymbol(baseProperty);
|
|
@@ -80064,36 +80139,11 @@ function createTypeChecker(host) {
|
|
|
80064
80139
|
continue basePropertyCheck;
|
|
80065
80140
|
}
|
|
80066
80141
|
}
|
|
80067
|
-
|
|
80068
|
-
|
|
80069
|
-
|
|
80070
|
-
|
|
80071
|
-
|
|
80072
|
-
typeToString(baseType)
|
|
80073
|
-
);
|
|
80074
|
-
}
|
|
80075
|
-
if (derivedClassDecl.kind === 231 /* ClassExpression */) {
|
|
80076
|
-
addRelatedInfo(
|
|
80077
|
-
inheritedAbstractMemberNotImplementedError,
|
|
80078
|
-
createDiagnosticForNode(
|
|
80079
|
-
baseProperty.valueDeclaration ?? (baseProperty.declarations && first(baseProperty.declarations)) ?? derivedClassDecl,
|
|
80080
|
-
Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1,
|
|
80081
|
-
symbolToString(baseProperty),
|
|
80082
|
-
typeToString(baseType)
|
|
80083
|
-
)
|
|
80084
|
-
);
|
|
80085
|
-
} else {
|
|
80086
|
-
addRelatedInfo(
|
|
80087
|
-
inheritedAbstractMemberNotImplementedError,
|
|
80088
|
-
createDiagnosticForNode(
|
|
80089
|
-
baseProperty.valueDeclaration ?? (baseProperty.declarations && first(baseProperty.declarations)) ?? derivedClassDecl,
|
|
80090
|
-
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2,
|
|
80091
|
-
typeToString(type),
|
|
80092
|
-
symbolToString(baseProperty),
|
|
80093
|
-
typeToString(baseType)
|
|
80094
|
-
)
|
|
80095
|
-
);
|
|
80096
|
-
}
|
|
80142
|
+
const baseTypeName = typeToString(baseType);
|
|
80143
|
+
const typeName = typeToString(type);
|
|
80144
|
+
const basePropertyName = symbolToString(baseProperty);
|
|
80145
|
+
const missedProperties = append((_a = notImplementedInfo.get(derivedClassDecl)) == null ? void 0 : _a.missedProperties, basePropertyName);
|
|
80146
|
+
notImplementedInfo.set(derivedClassDecl, { baseTypeName, typeName, missedProperties });
|
|
80097
80147
|
}
|
|
80098
80148
|
} else {
|
|
80099
80149
|
const derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived);
|
|
@@ -80104,7 +80154,7 @@ function createTypeChecker(host) {
|
|
|
80104
80154
|
const basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
80105
80155
|
const derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
80106
80156
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
80107
|
-
if ((getCheckFlags(base) & 6 /* Synthetic */ ? (
|
|
80157
|
+
if ((getCheckFlags(base) & 6 /* Synthetic */ ? (_b = base.declarations) == null ? void 0 : _b.some((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags)) : (_c = base.declarations) == null ? void 0 : _c.every((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags))) || getCheckFlags(base) & 262144 /* Mapped */ || derived.valueDeclaration && isBinaryExpression(derived.valueDeclaration)) {
|
|
80108
80158
|
continue;
|
|
80109
80159
|
}
|
|
80110
80160
|
const overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
@@ -80113,8 +80163,8 @@ function createTypeChecker(host) {
|
|
|
80113
80163
|
const errorMessage2 = overriddenInstanceProperty ? Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property : Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor;
|
|
80114
80164
|
error(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
80115
80165
|
} else if (useDefineForClassFields) {
|
|
80116
|
-
const uninitialized = (
|
|
80117
|
-
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 64 /* Abstract */) && !(derivedDeclarationFlags & 64 /* Abstract */) && !((
|
|
80166
|
+
const uninitialized = (_d = derived.declarations) == null ? void 0 : _d.find((d) => d.kind === 172 /* PropertyDeclaration */ && !d.initializer);
|
|
80167
|
+
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 64 /* Abstract */) && !(derivedDeclarationFlags & 64 /* Abstract */) && !((_e = derived.declarations) == null ? void 0 : _e.some((d) => !!(d.flags & 33554432 /* Ambient */)))) {
|
|
80118
80168
|
const constructor = findConstructorDeclaration(getClassLikeDeclarationOfSymbol(type.symbol));
|
|
80119
80169
|
const propName = uninitialized.name;
|
|
80120
80170
|
if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
@@ -80139,6 +80189,30 @@ function createTypeChecker(host) {
|
|
|
80139
80189
|
error(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
80140
80190
|
}
|
|
80141
80191
|
}
|
|
80192
|
+
for (const [errorNode, memberInfo] of notImplementedInfo) {
|
|
80193
|
+
if (length(memberInfo.missedProperties) === 1) {
|
|
80194
|
+
if (isClassExpression(errorNode)) {
|
|
80195
|
+
error(errorNode, Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, first(memberInfo.missedProperties), memberInfo.baseTypeName);
|
|
80196
|
+
} else {
|
|
80197
|
+
error(errorNode, Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, memberInfo.typeName, first(memberInfo.missedProperties), memberInfo.baseTypeName);
|
|
80198
|
+
}
|
|
80199
|
+
} else if (length(memberInfo.missedProperties) > 5) {
|
|
80200
|
+
const missedProperties = map(memberInfo.missedProperties.slice(0, 4), (prop) => `'${prop}'`).join(", ");
|
|
80201
|
+
const remainingMissedProperties = length(memberInfo.missedProperties) - 4;
|
|
80202
|
+
if (isClassExpression(errorNode)) {
|
|
80203
|
+
error(errorNode, Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more, memberInfo.baseTypeName, missedProperties, remainingMissedProperties);
|
|
80204
|
+
} else {
|
|
80205
|
+
error(errorNode, Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more, memberInfo.typeName, memberInfo.baseTypeName, missedProperties, remainingMissedProperties);
|
|
80206
|
+
}
|
|
80207
|
+
} else {
|
|
80208
|
+
const missedProperties = map(memberInfo.missedProperties, (prop) => `'${prop}'`).join(", ");
|
|
80209
|
+
if (isClassExpression(errorNode)) {
|
|
80210
|
+
error(errorNode, Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1, memberInfo.baseTypeName, missedProperties);
|
|
80211
|
+
} else {
|
|
80212
|
+
error(errorNode, Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2, memberInfo.typeName, memberInfo.baseTypeName, missedProperties);
|
|
80213
|
+
}
|
|
80214
|
+
}
|
|
80215
|
+
}
|
|
80142
80216
|
}
|
|
80143
80217
|
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
80144
80218
|
return baseDeclarationFlags & 64 /* Abstract */ && (!isPropertyDeclaration(declaration) || !declaration.initializer) || isInterfaceDeclaration(declaration.parent);
|
|
@@ -83863,7 +83937,7 @@ function createTypeChecker(host) {
|
|
|
83863
83937
|
if (parameter.initializer) {
|
|
83864
83938
|
return grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_cannot_have_an_initializer);
|
|
83865
83939
|
}
|
|
83866
|
-
} else if (
|
|
83940
|
+
} else if (hasEffectiveQuestionToken(parameter)) {
|
|
83867
83941
|
seenOptionalParameter = true;
|
|
83868
83942
|
if (parameter.questionToken && parameter.initializer) {
|
|
83869
83943
|
return grammarErrorOnNode(parameter.name, Diagnostics.Parameter_cannot_have_question_mark_and_initializer);
|
|
@@ -89330,7 +89404,7 @@ function transformTypeScript(context) {
|
|
|
89330
89404
|
),
|
|
89331
89405
|
valueExpression
|
|
89332
89406
|
);
|
|
89333
|
-
const outerAssignment = valueExpression
|
|
89407
|
+
const outerAssignment = isSyntacticallyString(valueExpression) ? innerAssignment : factory2.createAssignment(
|
|
89334
89408
|
factory2.createElementAccessExpression(
|
|
89335
89409
|
currentNamespaceContainerName,
|
|
89336
89410
|
innerAssignment
|