File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed
Expand file tree Collapse file tree 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 {
758758 }
759759 }
760760 ClassMember :: Method ( method) => {
761- let is_overload = method. function . body . is_none ( ) ;
761+ let is_overload = method. function . body . is_none ( ) && !method . is_abstract ;
762762 if !prev_is_overload || is_overload {
763763 prev_is_overload = is_overload;
764764 true
Original file line number Diff line number Diff line change @@ -218,6 +218,26 @@ fn dts_class_decl_prop_infer_test() {
218218 ) ;
219219}
220220
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+
221241#[ test]
222242fn dts_var_decl_test ( ) {
223243 transform_dts_test (
You can’t perform that action at this time.
0 commit comments