Is there any utility type in TS to help me get generic type?
I'm looking for something like GenericType
const foo = ['foo']
type MyStringType = GenericType<typeof foo> // equal to type MyStringType = string
let bar : Promise<number>
type MyNumberType = GenericType<typeof bar> // equal to type MyNumberType = number
I am using jest-axe
and in let results: axe.AxeResults;
I have TS2503: Cannot find namespace 'axe'.
error, Also I cannot import AxeResults
I want to use GenericType<ReturnType<typeof axe>>
Generic types are usually represented by letters in typescript as in Array<T,U>. Also the most generic type in typescript is any
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.