mirror of
https://github.com/swc-project/swc.git
synced 2024-11-27 04:47:03 +03:00
fix(es/codegen): Emit declare keyword for class properties (#8478)
This commit is contained in:
parent
faf8cdec19
commit
2076ef8f35
@ -1606,6 +1606,11 @@ where
|
||||
emit!(dec)
|
||||
}
|
||||
|
||||
if n.declare {
|
||||
keyword!("declare");
|
||||
space!();
|
||||
}
|
||||
|
||||
self.emit_accessibility(n.accessibility)?;
|
||||
|
||||
if n.is_static {
|
||||
|
@ -7,4 +7,5 @@ class MyClass extends Base {
|
||||
readonly #prop6 = "asdf";
|
||||
public abstract override readonly prop7 = 5;
|
||||
override readonly #prop8 = 5;
|
||||
declare public static readonly prop9: string;
|
||||
}
|
||||
|
@ -7,4 +7,5 @@ class MyClass extends Base {
|
||||
readonly #prop6 = "asdf";
|
||||
public abstract override readonly prop7 = 5;
|
||||
override readonly #prop8 = 5;
|
||||
declare public static readonly prop9: string;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
class MyClass extends Base{prop1?: string;prop2!: string;#prop3?: string;#prop4?: string="test";static readonly prop5!: string;readonly #prop6="asdf";public abstract override readonly prop7=5;override readonly #prop8=5}
|
||||
class MyClass extends Base{prop1?: string;prop2!: string;#prop3?: string;#prop4?: string="test";static readonly prop5!: string;readonly #prop6="asdf";public abstract override readonly prop7=5;override readonly #prop8=5;declare public static readonly prop9: string}
|
||||
|
@ -143,6 +143,7 @@ impl VisitMut for StripType {
|
||||
}
|
||||
|
||||
fn visit_mut_class_prop(&mut self, prop: &mut ClassProp) {
|
||||
prop.declare = false;
|
||||
prop.readonly = false;
|
||||
prop.is_override = false;
|
||||
prop.is_optional = false;
|
||||
|
Loading…
Reference in New Issue
Block a user