Reputation: 1013
This is my code :
type fnType = ((a: number, b: number) => void) | ((a: number, b: number) => Promise<void>);
Is there a way to avoid heavy repetition with function arguments?
Upvotes: 1
Views: 40
Reputation: 33061
Yes, there is
type Fn<R> = (a: number, b: number) => R;
// your type
type fnType = Fn<void> | Fn<Promise<void>>
Upvotes: 2