Created
October 18, 2021 13:00
-
-
Save davemecha/f7ab40f34a39a209736d2601e0fc35b0 to your computer and use it in GitHub Desktop.
Typed replacement for Object.fromEntries
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
export function fromEntries<K extends string, V>(entries: [K, V][]) { | |
return Object.fromEntries(entries) as { | |
[key in K]: V | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment