@oazmi/kitchensink - v0.9.13
    Preparing search index...

    Type Alias KeyPathValue<T, KP>

    KeyPathValue: KP extends [KP[0], ...(infer R)]
        ? R extends KeyPath ? KeyPathValue<T[KP[0]], R> : T[KP[0]]
        : unknown

    get the type of nested data through the use of an array of key-path.

    Type Parameters

    • T extends { [key: string | number]: any }
    • KP extends KeyPath
    const
    data = { kill: { your: { self: [0, 1, { 0: 0, 1: { noice: "YAHAHA", 0: "you found me!" } }] } } } as const,
    keypath_to_noice_parent: ["kill", "your", "self", 2, 1] = ["kill", "your", "self", 2, 1],
    noice_parent:
    KeyPathValue<typeof data, typeof keypath_to_noice_parent>
    = { noice: "YAHAHA", 0: "you found me!" }