File tree 6 files changed +14
-3
lines changed
tests/fixture/typescript/class_method
swc_ecma_transforms_typescript/src
6 files changed +14
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ swc_ecma_codegen : patch
3
+ swc_ecma_transforms_typescript : patch
4
+ ---
5
+
6
+ fix(es/codegen): Emit question token for class methods
Original file line number Diff line number Diff line change @@ -1599,6 +1599,10 @@ where
1599
1599
}
1600
1600
}
1601
1601
1602
+ if n. is_optional {
1603
+ punct ! ( "?" ) ;
1604
+ }
1605
+
1602
1606
if let Some ( type_params) = & n. function . type_params {
1603
1607
emit ! ( type_params) ;
1604
1608
}
Original file line number Diff line number Diff line change 1
1
class MyClass extends Base {
2
2
public override method ( param : number ) : string {
3
3
}
4
- public abstract override log ( msg : string ) : void ;
4
+ public abstract override log ? < TValue > (msg: string): TValue ;
5
5
}
Original file line number Diff line number Diff line change 1
1
class MyClass extends Base {
2
2
public override method ( param : number ) : string { }
3
- public abstract override log ( msg : string ) : void ;
3
+ public abstract override log ? < TValue > (msg: string): TValue ;
4
4
}
Original file line number Diff line number Diff line change 1
- class MyClass extends Base { public override method ( param :number ) :string { } public abstract override log ( msg :string ) :void }
1
+ class MyClass extends Base { public override method ( param :number ) :string { } public abstract override log ? < TValue > (msg:string):TValue }
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ impl VisitMut for StripType {
84
84
n. accessibility = None ;
85
85
n. is_override = false ;
86
86
n. is_abstract = false ;
87
+ n. is_optional = false ;
87
88
n. visit_mut_children_with ( self ) ;
88
89
}
89
90
You can’t perform that action at this time.
0 commit comments