Type Alias DotPathToKeyPath<DP>

DotPathToKeyPath: DP extends `${infer P}.${DotPathLeaf<DP>}`
    ? [...DotPathToKeyPath<P>, DotPathLeaf<DP>]
    : [DP]

convert dot-path to an array of key-path in the format compliant with the type KeyPathsOf.

Type Parameters

const
data = { kill: { your: { self: [0, 1, { 0: 0, 1: { noice: "YAHAHA", 0: "you found me!" } }] } } },
dotpath_to_noice = "kill.your.self.2.1.noice",
keypath_to_noice:
DotPathToKeyPath<typeof dotpath_to_noice> & KeyPathsOf<typeof data>
= ["kill", "your", "self", "2", "1", "noice"]