devtypes - v1.1.0
    Preparing search index...

    Type Alias PathValue<T, P>

    PathValue: P extends `${infer K}.${infer Rest}`
        ? K extends keyof T ? PathValue<T[K], Rest> : never
        : P extends keyof T ? T[P] : never

    Resolve the value type at a given property path.

    Type Parameters

    • T

      Object type to traverse

    • P extends string

      Dot-separated property path

    Supports dot-separated paths and resolves deeply nested property types. Returns never for invalid paths.

    type User = { id: number; profile: { name: string; address: { city: string } } };
    type City = PathValue< User, "profile.address.city" >; // string