Questions tagged «es2017»

2
类型“ ObjectConstructor”上不存在属性“ entries”
我正在研究ng2实现。我正在使用以下函数调用将对象转换为数组: var authors = Object.entries(responseObject.Authors); 这是一个标准的js函数。但是,ts编译器返回以下错误: "Property 'entries' does not exist on type 'ObjectConstructor'" 根据一个快速的谷歌,似乎解决方案可能是将CompilerOptions target属性从es5更改为es6。但是,在对以前的问题进行了一些先前的研究之后,我认为我可以通过在下面的tsconfig.json中包含其他“ lib”属性来利用es6功能: "compilerOptions": { "emitDecoratorMetadata": true, "experimentalDecorators": true, "module": "commonjs", "noEmitOnError": true, "noImplicitAny": false, "outDir": "../Scripts/", "removeComments": false, "sourceMap": true, "target": "es5", "moduleResolution": "node", "lib": [ "es2015", "dom" ] } 我也尝试将target属性更改为es2015,然后重建项目并执行“ typescriptUsingTsConfig”,但仍然遇到相同的错误。知道我可以在这里做什么以利用Object.entries()函数吗?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.