1
let Bob = {
    age: 24,
    name: 'bob',
    son: {
        foo: {
            age: 2,
        },
    },
}
const doSomething = (deepKey: any) => {
    // doSomething
}
// I want to have a type hint
doSomething('son.foo.age')

I want to have a literal type hint, What do I do with deepKey to get a literal type hint ?

hyisYoo
  • 99
  • 2
  • You can do [this](https://tsplay.dev/wXK49W) using the answer to the linked question – jcalz May 07 '22 at 03:25
  • Here's the other end of the deal, extracting the type of the value referenced by the deep-key: https://tsplay.dev/wOPj6N – spender May 07 '22 at 03:27

0 Answers0