Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How about generic parameters in the "Function" type? #26114

Closed
samchon opened this issue Aug 1, 2018 · 1 comment
Closed

How about generic parameters in the "Function" type? #26114

samchon opened this issue Aug 1, 2018 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@samchon
Copy link

samchon commented Aug 1, 2018

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>>;
}
@AlCalzone
Copy link
Contributor

Duplicate of
#25973
#212

@ghost ghost added the Duplicate An existing issue was already created label Aug 1, 2018
@samchon samchon closed this as completed Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants