microsoft / microsoft/TypeScript

VSCode Angular 9 Auto-Import for Custom Libraries

Open
#37,222 9 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Investigation
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TS Template added by @mjbvz

TypeScript Version: 3.8.3

Search Terms

  • angular

I'm currently building an Angular 9 Library using VSCode (version 1.42.1 on MAC OS). I followed the Angular Tutorial on how to create libraries - https://angular.io/guide/creating-libraries.

I also added schematics to the angular package, I'm currently having problems when I add the Library to Angular Application using the ng add ~/projects/my-library-0.01.tgz --save command.

VSCode is unable to auto-import components or classes defined in this package.

Cannot find name 'MyService'.

If I manually add import { MyService } from 'my-library' this works fines.

Is there a reason why the auto-import is not working for custom angular libraries?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the documented ng add ~/projects/my-library-0.01.tgz --save command in the Angular 9 library setup, then compare auto-import behavior with the working manual import from my-library. No source file or test is named; done means determining whether exported components and classes from the custom package are offered by VSCode auto-import and capturing that behavior in a focused regression test if the issue remains reproducible.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.