mirror of
https://github.com/swc-project/swc.git
synced 2024-11-27 04:47:03 +03:00
Strip TypeScript class properties without value assigned (#956)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
This commit is contained in:
parent
dde9defbe4
commit
4ab3c58f6a
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "swc_ecma_transforms"
|
||||
version = "0.19.3"
|
||||
version = "0.19.4"
|
||||
authors = ["강동윤 <kdy1997.dev@gmail.com>"]
|
||||
license = "Apache-2.0/MIT"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
|
@ -388,6 +388,8 @@ impl ClassProperties {
|
||||
}
|
||||
};
|
||||
|
||||
let assigned_value = prop.value.is_some();
|
||||
|
||||
let value = prop.value.unwrap_or_else(|| undefined(prop_span));
|
||||
let value = if prop.is_static {
|
||||
value
|
||||
@ -427,7 +429,7 @@ impl ClassProperties {
|
||||
}
|
||||
.into_stmt(),
|
||||
);
|
||||
} else {
|
||||
} else if assigned_value {
|
||||
constructor_exprs.push(Box::new(Expr::Assign(AssignExpr {
|
||||
span: DUMMY_SP,
|
||||
left: (PatOrExpr::Expr(Box::new(
|
||||
|
@ -762,6 +762,9 @@ test!(
|
||||
"class A extends B {
|
||||
foo = 'foo'
|
||||
b = this.a;
|
||||
|
||||
declare1
|
||||
declare2!: string
|
||||
|
||||
constructor(private readonly a: string, readonly c, private d: number = 1) {
|
||||
super()
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@swc/core",
|
||||
"version": "1.2.17",
|
||||
"version": "1.2.18",
|
||||
"description": "Super-fast alternative for babel",
|
||||
"main": "./index.js",
|
||||
"author": "강동윤 <kdy1997.dev@gmail.com>",
|
||||
|
Loading…
Reference in New Issue
Block a user