mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(transformer): missing initializer for readonly consructor properties (#4103)
This commit is contained in:
parent
e386b62331
commit
4413e2d298
3 changed files with 26 additions and 8 deletions
|
|
@ -241,7 +241,7 @@ impl<'a> TypeScriptAnnotations<'a> {
|
|||
// for each of them in the constructor body.
|
||||
if def.kind == MethodDefinitionKind::Constructor {
|
||||
for param in def.value.params.items.as_mut_slice() {
|
||||
if param.accessibility.is_some() {
|
||||
if param.accessibility.is_some() || param.readonly || param.r#override {
|
||||
if let Some(id) = param.pattern.get_binding_identifier() {
|
||||
self.assignments.push(Assignment {
|
||||
span: id.span,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
class Foo {
|
||||
constructor(public foo, private bar, protected zoo, too) {
|
||||
boom: number;
|
||||
constructor(public foo, private bar, protected zoo, readonly bang, too) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
class Bar extends Foo {
|
||||
constructor(public foo, private bar, protected zoo, readonly bang, override boom, too) {
|
||||
super(foo, bar, zoo, bang, too);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,19 @@
|
|||
class Foo {
|
||||
constructor(foo, bar, zoo, too) {
|
||||
this.foo = foo;
|
||||
this.bar = bar;
|
||||
this.zoo = zoo;
|
||||
boom;
|
||||
constructor(foo, bar, zoo, bang, too) {
|
||||
this.foo = foo;
|
||||
this.bar = bar;
|
||||
this.zoo = zoo;
|
||||
this.bang = bang;
|
||||
}
|
||||
}
|
||||
}
|
||||
class Bar extends Foo {
|
||||
constructor(foo, bar, zoo, bang, boom, too) {
|
||||
super(foo, bar, zoo, bang, too);
|
||||
this.foo = foo;
|
||||
this.bar = bar;
|
||||
this.zoo = zoo;
|
||||
this.bang = bang;
|
||||
this.boom = boom;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue