Need help getting the method without losing the <T>
, here is the code:
type Foo = {
bar<T>(arg: T): T
}
type Bar = Foo['bar']
type Test = Bar<string> // Type 'Bar' is not generic.(2315)
Playground
Is there a way to get the method type without losing the generic argument?
I need to use the type of the method without losing it’s ‘genericness’. Also the <T>
can not be lifted to the Foo
itself (this is a simplified example, actually building something more complicated where the <T>
is unknown at instantiation of the class but will be known on the respective method call)
1