This packages exposes types that allow you to extract deeply nested types.
Extracts a deeply-nested type from the target Path
in Source
, skipping arrays and ignoring null|undefined|optional types:
type QueryResult = { allPosts?: Array<{ users?: Array<{ name: string }> }> };
// will be { name: string }
type User = DeepExtractTypeSkipArrays<QueryResult, ["allPosts", "users"]>;
Extracts a deeply-nested type from the target Path
in Source
, ignoring null|undefined|optional types:
type QueryResult = { user?: { firstPost?: { title: string } } };
// will be { title: string }
type Post = DeepExtractType<QueryResult, ["user", "firstPost"]>;