Created
February 5, 2019 01:02
-
-
Save christianscott/74fad298cf8030e1ac09b3ce5b22c010 to your computer and use it in GitHub Desktop.
typesafe pick
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 pick<T, K extends keyof T>(k: K): (t: T) => T[K] { | |
return (t: T) => t[k]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment