Created
January 3, 2022 05:23
-
-
Save arbaz52/a764155eb7f8ed2d841137fadbac3941 to your computer and use it in GitHub Desktop.
Rename key inside an interface
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
export type RenameKey<I, K extends keyof I, N extends PropertyKey> = Omit< | |
I, | |
K | |
> & | |
{ | |
[P in N]: I[K]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment