How can I specify U in a type expression involving Array<T>.prototype.map<U>?

Viewed 60

In the following example

type Test = ReturnType<Array<string>['map']>

the type of Test is unknown[].

How can I parameterize the map function so that the type of Test becomes e.g. number[]?

I would expect something like

type Test = ReturnType<Array<string>['map']<number>>

but this is invalid syntax.

0 Answers
Related