Tom
Tom

Reputation: 128

Why does VS Code throw "Cannot find module 'typescript'. ts(2307)" while the module is there?

I'm using import * as ts from "typescript"; to import typescript in a .ts file.

The file runs fine, but VS Code is telling me Cannot find module 'typescript'. ts(2307).

Is there any way to suppress this problem?

Edit: the file can be compiled and run successfully

Upvotes: 3

Views: 6150

Answers (2)

Ricky Reyes
Ricky Reyes

Reputation: 21

To make the previous solution more clear.

Find Edit in VS Preferences/Settings settings.JSON in ESLint or TSLint or Typescript

settings.json example

{
    "javascript.format.enable": false,
    "typescript.validate.enable": false,
}

Upvotes: 1

Saddy
Saddy

Reputation: 1581

You want to change these two settings in VS Code's settings.json:

"typescript.validate.enable": false,
"javascript.validate.enable": false,

Source

Upvotes: 10

Related Questions