Nested keyof
Hi all, I am trying to use a fancy type to get a nested keyof effect. I found this code snippet online:
and when using it on the declaration side it definitely works, but I am having trouble using it to index into the type.
here's a link to the code snippet: https://www.typescriptlang.org/play?#code/C4TwDgpgBAchDOwIBMDSEQHkBmAeTARgFYQDGwAKuNBAB5IB2y8UA9sWcAHxQC8UAbwBQUKAG10IKAEsGUANYZW2KIRLkqkKADIoACkQAnWQHMoAHygMArgFsCEQwEoAugC5VHDdQkYXUOkZmNi9gEVEoAH4oAAMAEgFJAF8AOgS4RBRJHHxQzQhfEBcuJJjw0Q94xIxSgG4hJLFFEGVPdUpqHX0jUwsrOwdnF3qhUC0AMVZWPkFyqAIAQ0MPYQi1+YWALw8ehhM5pIAaOewpneBjPYahIVJWBkQFDA8MpDQMHMnWHn4AIkXDClFptfiM7g9gFBTqwPF8ZqsIgCVsCPP8tr8jiczlBftDfg0oAsWODEGD7o9DAhrAAbSH8aFNPy1IA
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
1 Reply
ok looks like I can get what i want using lodash: https://lodash.com/docs/4.17.15#set
(problem being that indexing into an object with a nested property can't be done like
obj["a.b.c"]
)
gonna mark as solved