问题
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?
回答1:
You need to add
"lib": [ "es2017.object" ]
https://github.com/Microsoft/TypeScript/issues/8482#issuecomment-262847071
来源:https://stackoverflow.com/questions/42410029/how-do-i-make-object-entries-available-in-typescript