Type alias DotPathValue<T, DP>

DotPathValue<T, DP>: DP extends `${infer P}.${infer C}`
    ? DotPathValue<T[P], C>
    : T[DP]

get the type of nested data through the use of a dot-path

Type Parameters

  • T extends {
        [key: string]: any;
    }
  • DP extends DotPath

Example

const data = { kill: { your: { self: [0, 1, { 0: 0, 1: { noice: "YAHAHA", 0: "you found me!" } }] } } }
const dotpath_to_noice_parent = "kill.your.self.2.1"
const noice_parent: DotPathValue<typeof data, typeof dotpath_to_noice_parent> = { noice: "YAHAHA", 0: "you found me!" }

Generated using TypeDoc