I am trying to use the array functionality in angular 7 but I am facing the error saying, cannot find name 'Array'
. Similarly, I am not able to use the simple array methods like push and pop.
Angular7 is not letting me initialize the variable like:
list: Array<number> = [1, 2, 3];
What is the root cause and how to resolve it?
Updated: tsconfig.js
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
}
}
Moreover, code is compiling without error.
Mysterious Resolution: I manage to resolve the compilation error by updating the visual studio code. The issue was particularly with the visual studio code update.