Considering the following example:
type Foo<T> = (x: T) => T[]
type X = ReturnType<Foo<number>>
As expected, X = number[]
Now, the function is a part of an interface:
interface Bar {
foo<T>(x: T): T[]
}
type BarFoo = Bar['foo']
type Y = ReturnType<BarFoo<number>>
type Z = ReturnType<Bar['foo']<number>>
Line Y
fails with BarFoo is not generic
Line Z
fails with a syntax error ('>' expected
)
How do I get a specific version of a generic interface method?