Skip to content

Commit 61ead3a

Browse files
Added error message for private identifiers used with static decorators. There is no spec to go with this behavior as of yet.
1 parent 161a7b6 commit 61ead3a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35900,6 +35900,9 @@ namespace ts {
3590035900
}
3590135901

3590235902
function checkClassDeclaration(node: ClassDeclaration) {
35903+
if (some(node.decorators) && some(node.members, p => hasStaticModifier(p) && isPrivateIdentifierClassElementDeclaration(p))) {
35904+
grammarErrorOnNode(node.decorators[0], Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator);
35905+
}
3590335906
if (!node.name && !hasSyntacticModifier(node, ModifierFlags.Default)) {
3590435907
grammarErrorOnFirstToken(node, Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name);
3590535908
}

src/compiler/diagnosticMessages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6319,5 +6319,9 @@
63196319
"Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name.": {
63206320
"category": "Error",
63216321
"code": 18035
6322+
},
6323+
"Class decorators can't be used with static private identifier. Consider removing the experimental decorator.": {
6324+
"category": "Error",
6325+
"code": 18036
63226326
}
63236327
}

0 commit comments

Comments
 (0)