DEV Community

Discussion on: TypeScript Utility: keyof nested object

Collapse
 
kemotx90 profile image
kemotx90

use

`${Key}.${NestedKeyOf<ObjectType[Key]> extends infer U extends string ? U : never}`
Enter fullscreen mode Exit fullscreen mode

instead of

${Key}.${NestedKeyOf<ObjectType[Key]>}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
skmohammadi profile image
Karim Mohammadi

Your suggestion fixed the following TS error:

Type instantiation is excessively deep and possibly infinite.
Enter fullscreen mode Exit fullscreen mode