gonzofish / angular-librarian

An Angular 2+ scaffolding setup for creating libraries
https://www.npmjs.com/package/angular-librarian
MIT License
91 stars 9 forks source link

Librarian reports false unused module #84

Closed tommueller closed 6 years ago

tommueller commented 7 years ago

Building my library with angular 5 leads to a warning (maybe this could actually be in yellow, instead of red?) letting me now 'MatSelect' is imported from external module '@angular/material' but never used, which is not true, I do use this module in one of my components!


import { Component, ViewChild } from '@angular/core';
import { MatOption, MatSelect } from '@angular/material';

@Component({
  selector: 'dropdown',
  templateUrl: './dropdown.component.html',
  styleUrls: ['./dropdown.component.scss']
})
export class DropdownComponent {
  [...]

  @ViewChild('select')
  select: MatSelect;

  [...]
}
gonzofish commented 7 years ago

You're just using MatSelect as a type so, unless you instantiate it elsewhere in DropdownComponent, in the compiled code, there is no usage of MatSelect.

tommueller commented 6 years ago

Well I use it as a component as part of the template ... but this is just a warning, right? I can just ignore it I guess.

gonzofish commented 6 years ago

@tommueller I don't believe that using it as type information is enough for it to be considered "used" but that's more of a TypeScript/TSLint issue than Librarian