Closed
Description
Since v3.0 update, defining generic rest parameters
is possible. The, how about adding generic parameters in the Function
type and related features?
By the implementation, specifying those methods' types are possible (who've handled only any
type):
Function.apply
clearly.Function.bind
maybe?
interface Function<Ret = any, Params extends any[] = any>
{
// It's possible to specifying types of return and parameters.
apply(thisArg: any, args: Params): Ret;
// Well, I don't know the solution... but it seems possible maybe...
bind<T>(thisArg: any, elem: T): Function<Ret, Pop<Params, T>>;
bind<Pops extend any[]>(thisArg: any, ...args: Pops): Function<Ret, Remainder<Params, Pops>>;
}