#can I check if type is a generic type?

1 messages · Page 1 of 1 (latest)

scarlet bobcat
#

Hi, I assume it's a very specific use case, and most likely the answer is no, but is there a way to check in a type if the type is generic and accepts types itself?
for example I imagine something like that:

type TCheckType<T> = T extends GENERIC ? TypeA : TypeB

the use case is meant to be later inferred so I'm hoping for something like

type TCheckType<T> = T extends infer A<infer B> ? (value: B) => A : () => T

in this case of course A and B do not exist and are both inferred

Thanks upfront!

#

can I check if type is a generic type?

oak lily
#

No, but if you know A then it could work.

scarlet bobcat