Skip to content

Instantly share code, notes, and snippets.

@felix-lipski
Created February 14, 2023 09:33
Show Gist options
  • Save felix-lipski/420207999d48bd63b7a5548ddc0ed720 to your computer and use it in GitHub Desktop.
Save felix-lipski/420207999d48bd63b7a5548ddc0ed720 to your computer and use it in GitHub Desktop.
Deeply casts interfaces to type aliases in TypeScript
/**
* Deeply casts interfaces to type aliases
*/
export type DeepImplicitIndex<I> = {
[P in keyof Pick<I, keyof I>]: Pick<I, keyof I> extends Record<any, any>
? DeepImplicitIndex<Pick<I, keyof I>[P]>
: Pick<I, keyof I>[P];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment