我正在尝试使用通过JSON解析的Map:
Object.entries((JSON.parse(variables)))
编译器抛出错误
Property 'entries' does not exist on type 'ObjectConstructor'
但是该方法有效,我能够检索我的地图。我寻找了其他问题,并更改了tsconfig文件中的target和lib。在tsconfig.app.json
内部,我有:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2017",
"target": "ESNext",
"baseUrl": "",
"types": [
"node"
],
"lib": [
"es2018",
"dom"
]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
和tsconfig.spec.json
中的
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "ESNext",
"baseUrl": "",
"types": [
"jasmine",
"node"
],
"lib": [
"es2018",
"dom"
]
},
"files": [
"test.ts",
"polyfills.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
我认为设置目标和lib就足够了,但是它仍然无法正常工作。要消除编译器错误还要更改什么?