Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular CLI build fails because typeClasses and iconClasses have no index signature #148

Closed
andrewpmontgomery opened this issue Mar 7, 2018 · 2 comments · Fixed by #152

Comments

@andrewpmontgomery
Copy link
Contributor

Bug report

When I create a new project using angular-cli (v1.7.2) and Angular2-Toaster (v5.0.0), ng build returns the following error:

ERROR in
node_modules\angular2-toaster\src\toaster-container.component.d.ts.ToasterContainerComponent.html(8,17): 
  Element implicitly has an 'any' type because type 'Object' has no index signature.
node_modules\angular2-toaster\src\toaster-container.component.d.ts.ToasterContainerComponent.html(5,17): 
  Element implicitly has an 'any' type because type 'Object' has no index signature.

This is because toaster-config.ts has the following definitions:

  • typeClasses?: Object;
  • iconClasses?: Object;

and toaster-container.component.ts has the following HTML template:

  • [ngClass]="toasterconfig.typeClasses[toast.type]"
  • [iconClass]="toasterconfig.iconClasses[toast.type]"

I'll provide a PR to fix this.

@Stabzs
Copy link
Owner

Stabzs commented Mar 10, 2018

@andrewpmontgomery I've actually failed to reproduce this now in several attempts. Can you please describe the base configuration required to reproduce this? i want to make sure the project is properly configured to highlight these issues going forward.

@andrewpmontgomery
Copy link
Contributor Author

andrewpmontgomery commented Mar 15, 2018

You can reproduce the problem in your latest branch simply by changing:
"suppressImplicitAnyIndexErrors": true,
to
"suppressImplicitAnyIndexErrors": false,
in the tsconfig-aot.json file.

I can't reproduce this in a sample consuming application, so perhaps something has changed in angular-cli or another package.

Stabzs added a commit that referenced this issue Mar 16, 2018
- Typescript compilation was failing for implicit any conversions for object typings for the configuration of showCloseButton, timeout, iconClasses and typeClasses. The type arguments have been strengthened to make more rigid compilation happy.  This should not affect anyone who was not abusing the expected typed arguments.
Closes #150, closes #148.

- The webpack demo has been rebuilt against `angular2-toaster@5.0.0` and webpack 4.
Closes #147.
@Stabzs Stabzs mentioned this issue Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants