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

Generic that extends a type with a generic #5929

Closed
bgrieder opened this issue Dec 4, 2015 · 3 comments
Closed

Generic that extends a type with a generic #5929

bgrieder opened this issue Dec 4, 2015 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@bgrieder
Copy link

bgrieder commented Dec 4, 2015

Say I have an interface

interface Applicative<T> {}

Now I want to define a function f that:

  • takes a Function and takes a type U extending an Applicative wrapping any
  • returns an U wrapping Function

My naive attempts were

  function f<U extends Applicative>(fn: Function, a: U<any>): U<Function>

and

  function f<T, U<T> extends Applicative<T>>(fn: Function, a: U<any>): U<Function>

but none is valid

Can we have a Generic extend a type with a generic ?

@sandersn
Copy link
Member

sandersn commented Dec 4, 2015

No, typescript doesn't have higher-kinded types.

@sandersn
Copy link
Member

sandersn commented Dec 4, 2015

Duplicate of #1213 and probably others.

@sandersn sandersn added the Duplicate An existing issue was already created label Dec 4, 2015
@bgrieder
Copy link
Author

bgrieder commented Dec 4, 2015 via email

@sandersn sandersn closed this as completed Dec 4, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants