File tree 3 files changed +27
-1
lines changed
3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ swc_core : patch
3
+ swc_typescript : patch
4
+ ---
5
+
6
+ fix(typescript): Check whether the method is abstract when checking ` is_overload `
Original file line number Diff line number Diff line change @@ -758,7 +758,7 @@ impl FastDts {
758
758
}
759
759
}
760
760
ClassMember :: Method ( method) => {
761
- let is_overload = method. function . body . is_none ( ) ;
761
+ let is_overload = method. function . body . is_none ( ) && !method . is_abstract ;
762
762
if !prev_is_overload || is_overload {
763
763
prev_is_overload = is_overload;
764
764
true
Original file line number Diff line number Diff line change @@ -218,6 +218,26 @@ fn dts_class_decl_prop_infer_test() {
218
218
) ;
219
219
}
220
220
221
+ #[ test]
222
+ fn dts_class_abstract_method_test ( ) {
223
+ transform_dts_test (
224
+ r#"export abstract class Manager {
225
+ protected abstract A(): void;
226
+ protected B(): void {
227
+ console.log("B");
228
+ }
229
+ protected C(): void {
230
+ console.log("B");
231
+ }
232
+ }"# ,
233
+ r#"export declare abstract class Manager {
234
+ protected abstract A(): void;
235
+ protected B(): void;
236
+ protected C(): void;
237
+ }"# ,
238
+ ) ;
239
+ }
240
+
221
241
#[ test]
222
242
fn dts_var_decl_test ( ) {
223
243
transform_dts_test (
You can’t perform that action at this time.
0 commit comments