简体   繁体   English

VS代码中的Typescript路径

[英]Typescript path in VS code

I can't get typescript paths to work for VS Code in an Angular cli project. 我无法在Angular cli项目中获取VS Code工作的打字稿路径。

If you look at https://github.com/gatimus/multiple-test/blob/master/src/app1/app/app.module.ts#L3 throws 如果你看一下https://github.com/gatimus/multiple-test/blob/master/src/app1/app/app.module.ts#L3 throws

[ts] Cannot find module 'shared/shared.module', [ts]无法找到模块'shared / shared.module',

even though path is set in tsconfig.app.json and settings.json has the line 即使在tsconfig.app.json settings.json了路径, settings.json也有该行

"typescript.tsdk": "node_modules/typescript/lib/"

Update: It seems the apps run but VS Code can't find the module. 更新:似乎应用程序运行但VS Code无法找到该模块。 I have version 1.16.1 我有1.16.1版 在此输入图像描述

Renaming tsconfig.app.json to tsconfig.json and updating .angular-cli.json seems to work. tsconfig.app.json重命名为tsconfig.json并更新.angular-cli.json似乎有效。

I am curious though, if the tsconfig file wasn't configurable in angular cli, how would you tell VS Code to use tsconfig.app.json ? 我很好奇,如果tsconfig文件在angular cli中不可配置,你怎么告诉VS Code使用tsconfig.app.json

For anyone still struggling with this, I was having this problem in Atom and it was fixed by following the sym link. 对于仍在努力解决这个问题的人,我在Atom中遇到了这个问题,并且通过遵循sym链接来修复它。 (cmnd/ctrl click on the module name that throws the error). (cmnd / ctrl单击抛出错误的模块名称)。 This seems to suggest that it is an issue with the IDE and not angular. 这似乎表明它是IDE的一个问题,而不是角度。

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

相关问题 VS Code中的打字稿,测试和调试 - Typescript, tests and debugging in VS Code VS 代码 angular 和 typescript 在 templateUrl 上掉毛 - VS Code angular and typescript linting on templateUrl 使用Angular + Typescript VS Code中的语言进行路由 - routing with language in Angular + Typescript VS Code 相对路径问题-TypeScript编译器在Windows和Linux上的行为不同 - Relative path Issue - TypeScript compiler behaving differently on Windows vs Linux VS Code 修复库的导入路径 - VS Code fix import path(s) for library 如何使用VS Code调试器在Chrome中查看Typescript代码 - How to view Typescript code in Chrome with VS Code debugger Jasmine Test Explorer 在 VS Code 中显示了 typescript jasmine 测试 - Jasmine Test Explorer is showing typescript jasmine tests in VS Code VS Code中的“找不到名称'x'”Typescript错误不一致 - Inconsistent “Cannot find name 'x'” Typescript errors in VS Code 如何配置angular2-typescript应用程序以在VS Code中运行 - How to configure angular2-typescript application to run in VS Code 使用 TypeScript 和 Angular 2 在 VS Code 中找不到从位置导入 {} - Import {} from location is not found in VS Code using TypeScript and Angular 2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM