export type PathWrapper = { [P in keyof T]: PathWrapper; }; export interface IPath { [0]: keyof T; [1]?: keyof T[IPath[0]]; } export type Path = IPath; export type KeysOf = keyof T[K]; export function path(p: Path) { // } export interface IShip { pilot: {}; } export interface IState { ships: { serenity: IShip, }; } path(["ships"]);