I'm working on an ng2 implementation. I'm using the following function call to convert an object to an array:
var authors = Object.entries(responseObject.Authors);
This is a standard js function. However, the ts compiler returns the following error:
"Property 'entries' does not exist on type 'ObjectConstructor'"
Based on a quick google it appears that the solution may be to change the compilerOptions target property from es5 to es6. However, after some previous research for a previous issue, I thought that I was able to leverage es6 functionality by including the additional "lib" property on my tsconfig.json below:
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../Scripts/",
"removeComments": false,
"sourceMap": true,
"target": "es5",
"moduleResolution": "node",
"lib": [
"es2015",
"dom"
]
}
I also tried changing the target property to es2015 and then rebuilt the project and executed "typescriptUsingTsConfig" but I still get the same error. Any idea what I can do here in order to leverage the Object.entries()
function?