How do I make Object.entries available in TypeScript?

user776686 picture user776686 · Feb 23, 2017 · Viewed 16.4k times · Source

In my angular-cli-built app (which is currently using TypeScript 2.0.3) I want to be able to use this decomposition-based iterator:

for (let [key, value] of Object.entries(obj)) {

}

What do I have to do in order to have it recognized:

  • upgrade TypeScript?
  • use a polyfill?
    • if so: how do I import it - in individual .ts files or in a config file to make it globally available?
  • use a third-party library?

Answer

Günter Zöchbauer picture Günter Zöchbauer · Feb 23, 2017