-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
Overview
Typescript allows you to specify overloads for functions. Ideally wrappers should maintain types for overloaded functions, however currently wrappers do not preserve overloaded function types.
declare function overloaded(arg1: string): string;
declare function overloaded(arg1: string, arg2: number): number;
type Overloaded = typeof overloaded
// ^? { (arg1: string): string, (arg1: string, arg2: number): number }
const basicOverloaded = basic(overloaded)
// ^? (arg1: string, arg2: number) => number
In the above, the overloaded type of overloaded
is not preserved. Instead, only the last defined overload prevails. In the playground link modify the order of the overloads to notice this.
Links
The above issue was discovered on Twitter.
It is also related to the following open issues on Typescript:
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed