Note: You'll need at least TypeScript 4.1
interface Shape {
a: {
b: string
c: number
},
d: number
}
const key = 'a.c'
type Value = Dotted<typeof key, Shape>
const value1: Value = 7 // passes
const value2: Value = 'a' // fails
const value3: Value = {'no': 'pe'} // fails