Created
May 18, 2024 21:53
-
-
Save brunoh3art/fd20f30bcf0f9523a92c8b7efa2efc57 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Replace<T, R> = Omit<T, keyof R> & R; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example of Using the Replace Type
Example
Suppose we have two types:
AandB. TypeAhas propertiesprop1,prop2,prop3, andprop4, while typeBhas propertiesprop3andprop4. We want to create a new typeXthat replaces the properties ofAwith the properties ofB.