You can use infer:
type TypeWithGeneric<T> = T[]
type extractGeneric<Type> = Type extends TypeWithGeneric<infer X> ? X : never
type extracted = extractGeneric<TypeWithGeneric<number>>
// extracted === number
More Related Contents:
- ‘unknown’ vs. ‘any’
- Element implicitly has an ‘any’ type because expression of type ‘string’ can’t be used to index
- TypeScript function overloading
- How can I see the full expanded contract of a Typescript type?
- typescript interface require one of two properties to exist
- Typescript: check if a type is a union
- How to pass optional parameters while omitting some other optional parameters?
- How do you produce a .d.ts “typings” definition file from an existing JavaScript library?
- Typescript Interface – Possible to make “one or the other” properties required?
- Difference between ‘object’ ,{} and Object in TypeScript
- Forcing excess-property checking on variable passed to TypeScript function
- Combining generics with index type
- Why can Typescript not figure out the type in my code?
- How to overwrite incorrect TypeScript type definition installed via @types/package
- TypeScript TS7015 error when accessing an enum using a string type parameter
- DeepReadonly Object Typescript
- Property ‘includes’ does not exist on type ‘string[]’
- Typescript: Cannot use import statement outside a module
- Angular2 – Share data between components using services
- ‘this’ implicitly has type ‘any’ because it does not have a type annotation
- TypeScript class implements class with private functions
- how to debug typescript files in visual studio code
- Is there a way to create nominal types in TypeScript that extend primitive types?
- Typescript: Retrieve element type information from array type
- Get route query params
- TypeScript empty object for a typed variable
- What does a TypeScript index signature actually mean?
- Why does a Typescript type conditional on `T extends undefined`, with T instantiated with `boolean`, resolve T to `never`?
- What exactly $event object do in Angular 2?
- Is it possible to export * as foo in typescript