Say I have a type like React.ComponentClass and I want to reference the Props part but it is unnamed in my current context.
React.ComponentClass
Props
To
You can use infer:
type TypeWithGeneric = T[] type extractGeneric = Type extends TypeWithGeneric ? X : never type extracted = extractGeneric> // extracted === number
Playground