-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
It is possible to generalize liftN to any number of arguments:
export function liftN<T extends NewtypeRepr<N>[], N extends Newtype<any, any> = never>(f: (...args: T) => NewtypeRepr<N>): (...args: { [K in keyof T]: N; }) => N {
return f as unknown as (...args: { [K in keyof T]: N; }) => N;
}Unfortunately, this requires users to explicitly pass in the type of their parameter list as an argument, even though type inference is good enough to figure it out. We'd like T to be inferred, but N to have to be explicit.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request