简体   繁体   English

角度项目中的VSCode和路径错误

[英]VSCode and Path Error in an Angular Project

In Visual Studio Code, since few days, Intellisense stop to underline wrong path file in my code. 在Visual Studio Code中,几天以来,Intellisense停止在我的代码中为错误的路径文件添加下划线。

And when I put the mouse over the wrong line, it displaying "module '*'" : 当我将鼠标放在错误的行上时,它显示为“ module'*'”:

路径错误

How to (re)activate this? 如何(重新)激活它?

I add more informations : here is my tsconfig : 我添加更多信息:这是我的tsconfig:

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "types": ["node"],
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  }
}

User settings in VSCode : VSCode中的用户设置:

{
    "files.exclude": {
        "**/*.js": {"when" : "$(basename).ts"},
        "**/*.js.map": true
    }

}

您需要在tsconfig中设置“模块”属性。

I've comment this line in the file typings.d.ts 我在文件typings.d.ts中输入了这一行。

declare module '*';

It's ok now. 没关系

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM