mirror of
https://github.com/swc-project/swc.git
synced 2024-11-23 00:32:15 +03:00
fix(es/typescript): Strip declaration of exported function overloads (#9397)
- Closes https://github.com/swc-project/swc/issues/9396
This commit is contained in:
parent
d479cc2914
commit
5c8aa522da
6
.changeset/eleven-dryers-brake.md
Normal file
6
.changeset/eleven-dryers-brake.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
swc_fast_ts_strip: patch
|
||||
swc_core: patch
|
||||
---
|
||||
|
||||
fix(es/typescript): Strip declaration of exported function overloads
|
@ -655,14 +655,6 @@ impl Visit for TsStrip {
|
||||
n.visit_children_with(self);
|
||||
}
|
||||
|
||||
fn visit_fn_decl(&mut self, n: &FnDecl) {
|
||||
if n.function.body.is_none() {
|
||||
self.add_replacement(n.function.span);
|
||||
return;
|
||||
}
|
||||
n.visit_children_with(self);
|
||||
}
|
||||
|
||||
fn visit_import_decl(&mut self, n: &ImportDecl) {
|
||||
if n.type_only {
|
||||
self.add_replacement(n.span);
|
||||
@ -955,6 +947,9 @@ impl IsTsDecl for Decl {
|
||||
Self::Var(ref var) => var.declare,
|
||||
Self::Fn(FnDecl { declare: true, .. })
|
||||
| Self::Class(ClassDecl { declare: true, .. }) => true,
|
||||
|
||||
Self::Fn(FnDecl { function, .. }) => function.body.is_none(),
|
||||
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
1
crates/swc_fast_ts_strip/tests/fixture/issue-9396.js
Normal file
1
crates/swc_fast_ts_strip/tests/fixture/issue-9396.js
Normal file
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
export { };
|
1
crates/swc_fast_ts_strip/tests/fixture/issue-9396.ts
Normal file
1
crates/swc_fast_ts_strip/tests/fixture/issue-9396.ts
Normal file
@ -0,0 +1 @@
|
||||
export function f();
|
Loading…
Reference in New Issue
Block a user