简体   繁体   English

VSCode。 Angular自动导入使用库源

[英]VSCode. Angular auto import uses sources for libraries

I've installed some extensions to improve VSCode usages in angular project. 我安装了一些扩展程序来改进Angular项目中VSCode的用法。 There are Auto Import , TypeScript Hero . 自动导入TypeScript Hero Right now it helps me import automatically dependencies for my type script classes. 现在,它可以帮助我自动为类型脚本类导入依赖项。 But issue is if I use automatic import via popup menu it adds sources dependencies only. 但是问题是,如果我通过弹出菜单使用自动导入,它将仅添加源依赖项。 I expect for angular dependencies something like: 我期望角度依赖性类似:

import { Input } from '@angular/core';

but there is: 但是还有:

import { Input } from '@angular/core/src/metadata/directives';

And in very end it is not compilable because of incorrect import. 最后,由于导入错误,它是不可编译的。 Is anyone knows reason and recipe to fix it? 有谁知道原因和解决方法?

Sounds like this bug . 听起来像是这个bug It should be fixed for TypeScript 2.7 which will be included in VS Code 1.20. 它应该为TypeScript 2.7修复,该脚本将包含在VS Code 1.20中。

You can try the fix out today by using the current VS Code insiders build or by using typescript@next with these instructions 您可以使用当前的VS Code内部人员内部版本或使用带有以下说明的 typescript@next尝试进行修复

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

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