Skip to content

Commit

Permalink
fix: strip exported TypeScript function overloads (#14458)
Browse files Browse the repository at this point in the history
fixes #14455
  • Loading branch information
dummdidumm authored Nov 28, 2024
1 parent 41e47a4 commit d6fc176
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/shy-starfishes-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: strip exported TypeScript function overloads
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ const visitors = {
if (node.exportKind === 'type') return b.empty;

if (node.declaration) {
return context.next();
const result = context.next();
if (result?.declaration?.type === 'EmptyStatement') {
return b.empty;
}
return result;
}

if (node.specifiers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
export type Foo = true
}
export function overload(a: boolean): boolean;
export function overload(b: string): number;
export function overload(c: any): any {}
export type { Hello };
</script>

Expand Down

0 comments on commit d6fc176

Please sign in to comment.