Answer the question
In order to leave comments, you need to log in
How can you call U differently when typing type InferValueTypes = T extends { [key: string]: infer U }? U: never?
type InferValueTypes = T extends { [key: string]: infer U } ? U : never
What is another name for U ?
Answer the question
In order to leave comments, you need to log in
U is the name you enter, it can be any valid name instead:
type InferValueTypes<T> = T extends { [key: string]: infer IDontKnowWhat2CallThis } ? IDontKnowWhat2CallThis : never
type InferValueTypes<T extends Record<string, unknown>> = T[string];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question