angularconfigurationvisual-studio-codeauto-import

VSCode. Angular auto import uses sources for libraries


I've installed some extensions to improve VSCode usages in angular project. There are Auto Import, 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?


Solution

  • Sounds like this bug. It should be fixed for TypeScript 2.7 which will be included in 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