angular - VSCode/tslint 不解析 tsconfig.json 中的路径

标签 angular typescript visual-studio-code tsconfig tsconfig-paths

vscode 以某种方式不尊重我的 tsconfig.json(几个星期以来,它已经不同了。无论是我的错误还是 vscode 更新......)

{
"compileOnSave": false,
"compilerOptions": {
    "baseUrl": "./",
    "paths": {
        "@foo-animation/*": [
            "src/app/animation/*"
        ],
        ...
enter image description here
分别在问题选项卡中:

Cannot find module '@foo-animation/animation-micro' or its corresponding type declarations. ts(2307)


常规基本路径 (如 @angular/core)得到妥善解决 ,只是我的“自定义”是问题...
编译、构建、运行......一切都像魅力一样。 所以我相信从 Angular/ typescript 的 Angular 来看一切都很好。 (另外,我使用 IntelliJ 的开发人员没有问题......)所以它似乎归结为“告诉 vscode 关于它”......:-/
我的 tsconfig.json位于项目的根文件夹中。唯一的一点是,我使用另一个 tsconfig.app.json ,其中包括以上 tsconfig.json .
enter image description here
那么有没有办法告诉 vscode 在哪里寻找它的 tsconfig.json (鼓励解析这些路径)?
This SO questionthis VSCode github issue可能是相关的,但我仍然不知道该怎么做。

最佳答案

我最近在设置存储库时遇到了类似的问题,我认为将此行添加到您的 vscode settings.json 应该会有所帮助:

"tslint.configFile": "./tslint.json"
如果您的 tslint.json 不在根目录中,您应该添加自己的路径。

关于angular - VSCode/tslint 不解析 tsconfig.json 中的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64737639/

相关文章:

javascript - nestjs 应用程序的生产部署的正确方法是什么

Angular 自定义管道不起作用 'pipe not found'

javascript - Angular 表达式绑定(bind)中的未定义属性

angular - 如何在 typescript 中将日期转换为字符串格式yyyy-mm-dd

visual-studio-code - VS 代码中的扩展警告

visual-studio-code - Visual Studio Code files.exclude 设置不起作用

visual-studio-code - 禁用在 VS Code 中显示有关符号/对象信息的悬停

Angular2 获取表单控件的现有验证器

angular - 无法读取未定义Angular 8的属性 'native-element'

typescript - 从参数元组中删除最后一个元素,取消最后一个参数