Created
April 2, 2021 02:41
-
-
Save tolluset/7a53fb2ff792127240420d1e1f4de6af to your computer and use it in GitHub Desktop.
Get values using generic
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
const getValue = <T, U extends keyof T>(obj: T, key: U): T[U] => { | |
return obj[key]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment