Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 98772

Unusual behavior, cannot find name 'Array'

$
0
0

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.

Here is the sample

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.

code compilation successfull

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.


Viewing all articles
Browse latest Browse all 98772

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>