Created
July 4, 2022 21:20
-
-
Save palpich/f61841a643ce75831f8006886d053bcc to your computer and use it in GitHub Desktop.
Assign By Key
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
function assignByKey<T, S extends T, K extends keyof T & keyof S>( | |
target: T, | |
source: S, | |
key: K | |
) { | |
target[key] = source[key] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment