Skip to content

Instantly share code, notes, and snippets.

@tonysneed
Last active July 4, 2017 14:45
Show Gist options
  • Select an option

  • Save tonysneed/a1609615f8261b040f40faa6888be67d to your computer and use it in GitHub Desktop.

Select an option

Save tonysneed/a1609615f8261b040f40faa6888be67d to your computer and use it in GitHub Desktop.
Function to convert array of object literals to strongly typed objects
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