Created
September 24, 2020 23:17
-
-
Save jtmthf/8577d6653a98b532f30704f2471fabc4 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 const pick = < | |
| T extends Record<keyof unknown, unknown>, | |
| K extends keyof T | |
| >( | |
| object: T, | |
| paths: readonly K[], | |
| ): Pick<T, K> => | |
| Object.assign({}, ...paths.map((path) => ({ [path]: object[path] }))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment