interface User {
profile: { name: string; age: number; };
tags: Set<string>;
metadata: Map<string, { value: string }>;
}
type UserName = PathValue<User, 'profile.name'>; // string
type Tag = PathValue<User, 'tags.0'>; // string
type MetaValue = PathValue<User, 'metadata.someKey.value'>; // string
// A key typed as a union with primitive members (e.g. `Config | false`)
// resolves against the object member instead of collapsing to `never` —
// the `T extends any` wrapper below is a bare type-param conditional,
// which forces the union to distribute (mirrors `PathNames`) before the
// `keyof T` checks run, so those checks see each member individually.
Extracts the value type at a specific string path.
Enables type-safe deep property access with compile-time validation of both path validity and return type correctness. Supports: