mirror of
https://github.com/swc-project/swc.git
synced 2024-11-28 11:13:43 +03:00
fix(es/typescript): Don't generate class field for abstract properties (#6174)
This commit is contained in:
parent
55a836ac82
commit
9d93b6cd85
@ -4,9 +4,6 @@ class A {
|
||||
foo() {
|
||||
console.log(this.x);
|
||||
}
|
||||
constructor(){
|
||||
_define_property(this, "x", void 0);
|
||||
}
|
||||
}
|
||||
class B extends A {
|
||||
constructor(...args){
|
||||
|
@ -1,6 +1,5 @@
|
||||
//// [abstractProperty.ts]
|
||||
class A {
|
||||
x;
|
||||
foo() {
|
||||
console.log(this.x);
|
||||
}
|
||||
|
@ -1972,7 +1972,12 @@ where
|
||||
{
|
||||
false
|
||||
}
|
||||
ClassMember::ClassProp(ClassProp { declare: true, .. }) => false,
|
||||
ClassMember::ClassProp(
|
||||
ClassProp { declare: true, .. }
|
||||
| ClassProp {
|
||||
is_abstract: true, ..
|
||||
},
|
||||
) => false,
|
||||
ClassMember::ClassProp(ClassProp {
|
||||
value: None,
|
||||
ref decorators,
|
||||
|
@ -4637,3 +4637,21 @@ test!(
|
||||
foo();
|
||||
"#
|
||||
);
|
||||
|
||||
test_with_config!(
|
||||
issue_6023,
|
||||
strip::Config {
|
||||
use_define_for_class_fields: true,
|
||||
..Default::default()
|
||||
},
|
||||
"
|
||||
abstract class Shape {
|
||||
abstract height: number;
|
||||
abstract width: number;
|
||||
}
|
||||
",
|
||||
"
|
||||
class Shape {
|
||||
}
|
||||
"
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user