VSCode。 Angular 自动导入使用库源

VSCode. Angular auto import uses sources for libraries

我安装了一些扩展来改进 VSCode 在 angular 项目中的使用。有Auto Import, TypeScript Hero个。现在它帮助我为我的类型脚本自动导入依赖项 类。但问题是,如果我通过弹出菜单使用自动导入,它只会添加源依赖项。我希望 angular 依赖项类似于:

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

但是有:

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

最后由于导入不正确而无法编译。 有人知道修复它的原因和方法吗?

听起来像 this bug。它应该针对将包含在 VS Code 1.20 中的 TypeScript 2.7 进行修复。

您今天可以使用当前 VS Code insiders build or by using typescript@next with these instructions

尝试修复