Skip to content

Instantly share code, notes, and snippets.

@CurtisFenner
Created October 29, 2021 23:38
Show Gist options
  • Save CurtisFenner/2fcce5a90f99170d733dce8fda1c54b1 to your computer and use it in GitHub Desktop.
Save CurtisFenner/2fcce5a90f99170d733dce8fda1c54b1 to your computer and use it in GitHub Desktop.
type Pin<X extends Record<string, Record<string, keyof X>>> = {
[Obj in keyof X]: {
[F in keyof X[Obj]]: Pin<X>[X[Obj][F]]
}
};
type Loopy = Pin<{
one: {
a: "one",
b: "two",
},
two: {
c: "one",
d: "two",
},
}>;
function descend(loopy: Loopy) {
return loopy.one.a.a.b.c.a.b.c.b.d;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment