mirror of
https://github.com/swc-project/swc.git
synced 2024-11-27 04:47:03 +03:00
Fix typescript strip in class properties pass (#954)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
This commit is contained in:
parent
e1f5d681e3
commit
dde9defbe4
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "swc_ecma_transforms"
|
||||
version = "0.19.2"
|
||||
version = "0.19.3"
|
||||
authors = ["강동윤 <kdy1997.dev@gmail.com>"]
|
||||
license = "Apache-2.0/MIT"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
|
@ -586,7 +586,10 @@ impl ClassProperties {
|
||||
c.params = c.params.move_map(|mut param| match &mut param {
|
||||
ParamOrTsParamProp::TsParamProp(p) => match &p.param {
|
||||
TsParamPropParam::Ident(i) => {
|
||||
typescript_constructor_properties.push(store(i));
|
||||
typescript_constructor_properties.push(store(&Ident {
|
||||
type_ann: None,
|
||||
..i.clone()
|
||||
}));
|
||||
ParamOrTsParamProp::Param(Param {
|
||||
span: p.span,
|
||||
decorators: take(&mut p.decorators),
|
||||
@ -595,11 +598,19 @@ impl ClassProperties {
|
||||
}
|
||||
TsParamPropParam::Assign(pat) => match &*pat.left {
|
||||
Pat::Ident(i) => {
|
||||
typescript_constructor_properties.push(store(i));
|
||||
typescript_constructor_properties.push(store(&Ident {
|
||||
type_ann: None,
|
||||
..i.clone()
|
||||
}));
|
||||
ParamOrTsParamProp::Param(Param {
|
||||
span: p.span,
|
||||
decorators: take(&mut p.decorators),
|
||||
pat: Pat::Ident(i.clone()),
|
||||
pat: Pat::Assign(AssignPat {
|
||||
span: DUMMY_SP,
|
||||
left: pat.left.clone(),
|
||||
right: pat.right.clone(),
|
||||
type_ann: None,
|
||||
}),
|
||||
})
|
||||
}
|
||||
_ => param,
|
||||
|
@ -763,15 +763,17 @@ test!(
|
||||
foo = 'foo'
|
||||
b = this.a;
|
||||
|
||||
constructor(readonly a) {
|
||||
constructor(private readonly a: string, readonly c, private d: number = 1) {
|
||||
super()
|
||||
this.foo.subscribe()
|
||||
}
|
||||
}",
|
||||
"class A extends B {
|
||||
constructor(a) {
|
||||
constructor(a, c, d = 1) {
|
||||
super();
|
||||
this.a = a;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.foo = 'foo';
|
||||
this.b = this.a;
|
||||
this.foo.subscribe();
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@swc/core",
|
||||
"version": "1.2.16",
|
||||
"version": "1.2.17",
|
||||
"description": "Super-fast alternative for babel",
|
||||
"main": "./index.js",
|
||||
"author": "강동윤 <kdy1997.dev@gmail.com>",
|
||||
|
Loading…
Reference in New Issue
Block a user