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

Support nested type parameters #214

Closed
jameslong opened this issue Jul 23, 2014 · 3 comments
Closed

Support nested type parameters #214

jameslong opened this issue Jul 23, 2014 · 3 comments
Labels
Fixed A PR has been merged for this issue Suggestion An idea for TypeScript

Comments

@jameslong
Copy link

E.g. you cannot have an interface and function which satisfy the types:

interface InterfaceA<U>
function<U extends InterfaceA<V>>(value: U): U 

This means you cannot make generic functions to handle derived types unless you are willing to lose the type information for the return value.

@fdecampredon
Copy link

I don't really understand this one, in the following example :

interface InterfaceA<U> {}
declare function myFunc<U extends InterfaceA<any>>(value: U): U ;
var b: InterfaceA<string>;
var c = myFunc(b);

c is correctly typed to InterfaceA<string>

did you mean something like that ? :

interface InterfaceA<U> {}
declare function myFunc<V, U extends InterfaceA<V>>(value: U): V;

@Pajn
Copy link

Pajn commented Sep 20, 2015

did you mean something like that?

I would expect so, this is something I would want too.
See https://j201.github.io/posts/2014-08-30-TypeScript-The-Bad-Parts.html#higher-kinded-types

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Feb 20, 2016
@mhegazy mhegazy added this to the TypeScript 1.8 milestone Feb 20, 2016
@mhegazy mhegazy removed the Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. label Feb 20, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Feb 20, 2016

Fixed by #5949

@mhegazy mhegazy closed this as completed Feb 20, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants