Disallow decorators on abstract/declare fields (#19210)

This commit is contained in:
fisker Cheung authored and GitHub committed 2026-05-27 02:28:30 +08:00
1 parent e3d23c2cef
commit 5d7f64ef5b
5 files changed
-45

No files matched your search

-3
View File
@@ -223,9 +223,6 @@ const allowedReasonCodesArray = [
```
*/
"DeclarationMissingInitializer",
// https://github.com/babel/babel/pull/17949
"DecoratorAbstractMethod",
];
const allowedReasonCodes = new Set(allowedReasonCodesArray);
@@ -3,14 +3,6 @@ class Foo {
@decorator
readonly /* comment */ propertyDefinition;
// TSAbstractPropertyDefinition
@decorator
abstract /* comment */ abstractPropertyDefinition;
// TSAbstractMethodDefinition
@decorator
abstract /* comment */ abstractMethodDefinition;
// MethodDefinition
@decorator
private /* comment */ methodDefinition() {}
@@ -260,14 +260,6 @@ class Foo {
@decorator
readonly /* comment */ propertyDefinition;
// TSAbstractPropertyDefinition
@decorator
abstract /* comment */ abstractPropertyDefinition;
// TSAbstractMethodDefinition
@decorator
abstract /* comment */ abstractMethodDefinition;
// MethodDefinition
@decorator
private /* comment */ methodDefinition() {}
@@ -289,14 +281,6 @@ class Foo {
@decorator
readonly /* comment */ propertyDefinition;
// TSAbstractPropertyDefinition
@decorator
abstract /* comment */ abstractPropertyDefinition;
// TSAbstractMethodDefinition
@decorator
abstract /* comment */ abstractMethodDefinition;
// MethodDefinition
@decorator
private /* comment */ methodDefinition() {}
@@ -292,12 +292,6 @@ class Something {
readonly property: Array<string>
}
class Something2 {
@foo()
// comment
abstract property: Array<string>
}
=====================================output=====================================
class Foo1 {
@foo
@@ -329,12 +323,6 @@ class Something {
readonly property: Array<string>;
}
class Something2 {
@foo()
// comment
abstract property: Array<string>;
}
================================================================================
`;
@@ -28,9 +28,3 @@ class Something {
// comment
readonly property: Array<string>
}
class Something2 {
@foo()
// comment
abstract property: Array<string>
}