Created
February 14, 2023 09:33
-
-
Save felix-lipski/420207999d48bd63b7a5548ddc0ed720 to your computer and use it in GitHub Desktop.
Deeply casts interfaces to type aliases in TypeScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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