TypeScript error: "Cannot find name" in Visual Studio


I’ve seen a lot of threads and discussions about that but I’m not getting to fix the issue. This is my post from some days ago.

One of the purposes of typings is to avoid the use of <reference> tags, right?

But if I don’t use it, Visual Studio complains:

enter image description here

Visual Studio stops complaining once I reference browser.d.ts.

Here is my tsconfig:

{
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5"
  },
  "files": [

  ],
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}

I also tried removing the "files" property from the tsconfig as suggested here, but if I do this, I get compilation error in other typescript files inside the ambient folder of typings.

The code runs and all is fine, but I want to understand if I’m doing something wrong or if it’s a Visual Studio problem.

Leave a Reply

Your email address will not be published. Required fields are marked *