Last active
July 4, 2017 14:45
-
-
Save tonysneed/a1609615f8261b040f40faa6888be67d to your computer and use it in GitHub Desktop.
Function to convert array of object literals to strongly typed objects
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 function convertObjects<Target>(objects: Object[], types: Target[]) { | |
| for (let i = 0; i < objects.length; i++) { | |
| Object.assign(types[i], objects[i]) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment