Visual Studio not displaying compile time errors in editor

后端 未结 8 1275
南旧
南旧 2020-12-28 12:32

For example, when I write:

string x = \"turtle\";
x.Go();

There is no red squiggly line detecting the absence of the Go() method on String.

8条回答
  •  醉酒成梦
    2020-12-28 12:58

    JavaScript Type Checking Sometimes type checking your JavaScript code can help you spot mistakes you might have not caught otherwise. You can run the TypeScript type checker against your existing JavaScript code by simply adding a // @ts-check comment to the top of your file.

    // @ts-nocheck 
    
    let easy = true;
    easy = 42;
    

    Tip: You can also enable the checks workspace or application wide by adding "javascript.implicitProjectConfig.checkJs": true to your workspace or user settings and explicitly ignoring files or lines using // @ts-nocheck and // @ts-ignore. Check out the docs on JavaScript in VS Code to learn more.

提交回复
热议问题