Created
April 13, 2023 14:38
-
-
Save nielk/9fb33eaa053faeed42310a8cd53c79c0 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
const obj = { | |
'a': (a: string, b: number): string => `${a}: ${b}`, | |
'b': (b: number): string => `${b}`, | |
'c': (): string => 'c', | |
} | |
const getFn = <K extends keyof typeof obj>(key: K) => { | |
return obj[key] | |
} | |
getFn('a')('a', 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment