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.
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>
InterfaceA<string>
did you mean something like that ? :
interface InterfaceA<U> {} declare function myFunc<V, U extends InterfaceA<V>>(value: U): V;
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
Fixed by #5949
Activity
fdecampredon commentedon Jul 24, 2014
I don't really understand this one, in the following example :
c is correctly typed to
InterfaceA<string>did you mean something like that ? :
Pajn commentedon Sep 20, 2015
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 commentedon Feb 20, 2016
Fixed by #5949