Type Alias: InferPropertyType<T, K>

InferPropertyType<T, K>: K extends `${infer K1}.${infer K2}` ? K1 extends keyof T ? InferPropertyType<NonNullable<T[K1]>, K2> : never : K extends keyof T ? T[K] : never

Type Parameters

T

K extends string

Example

type A = { a?: { b?: { c: string } } } type B = InferPropertyType<A, "a"> // { b?: { c: string } } type C = InferPropertyType<A, "a.b"> // { c: string }

Defined in

packages/core/src/utils/types.ts:13