Type alias DotPathToKeyPath<DP>

DotPathToKeyPath<DP>: 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

Example

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

Generated using TypeDoc