Type alias DeepGetType<Target, Path>

DeepGetType<Target, Path>: Target extends unknown[]
    ? never
    : Target extends object
        ? Path extends _Path
            ? _DeepGetType<Target, _DestructurePath<Path>>
            : never
        : never

DeepGetType

Type Parameters

  • Target

    The array or object to search in

  • Path extends Branches<Target> | _Path

    The path to search for

Desc

Search for a value in an array or object

Returns

The value of the path

Example

type Target = { a: { b: { c: string } } };
type Path = 'a.b.c';
type Value = DeepGetType<Target, Path>; // string