繁体   English   中英

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

[英]VSCode and Path Error in an Angular Project

在Visual Studio Code中,几天以来,Intellisense停止在我的代码中为错误的路径文件添加下划线。

当我将鼠标放在错误的行上时,它显示为“ module'*'”:

路径错误

如何(重新)激活它?

我添加更多信息:这是我的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"
    ]
  }
}

VSCode中的用户设置:

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

}

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

我在文件typings.d.ts中输入了这一行。

declare module '*';

没关系

暂无
暂无

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

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