Font-awesome: Argument of type 'IconPack' is not assignable to parameter of type 'IconDefinitionOrPack' as of @fortawesome/[email protected]

Created on 11 Dec 2019  路  7Comments  路  Source: FortAwesome/Font-Awesome

Describe the bug
Can't add icon packs to library in TypeScript after updating to @fortawesome/[email protected]

Argument of type 'IconPack' is not assignable to parameter of type 'IconDefinitionOrPack'.
  Type 'IconPack' is missing the following properties from type 'IconDefinition': icon, prefix, iconName  TS2345

    1 | import { library } from '@fortawesome/fontawesome-svg-core';
    2 | import { fal } from '@fortawesome/pro-light-svg-icons';
    3 | import { far } from '@fortawesome/pro-regular-svg-icons';
    4 | import { fas } from '@fortawesome/pro-solid-svg-icons';
  > 5 | library.add(fal, far, fas);
      |             ^

To Reproduce
Updated from @fortawesome/[email protected] to @fortawesome/[email protected]

Version and implementation
Version: @fortawesome/[email protected]

Bug report checklist

  • [x] I have filled out as much of the above information as I can
  • [x] I have included a test case because my odds go _way_ up that the team can fix this when I do
  • [x] I have searched for existing issues and to the best of my knowledge this is not a duplicate

Most helpful comment

Adding @fortawesome/fontawesome-common-types to my dependencies fixes it for me

All 7 comments

@adambowles you'll have to provide a reproducible test case that we can actually run locally and debug.

I'm running into this too I believe... I think it's a thing with the new firefox icon that was just added. I'm not using it in my project, but it's showing up in an error message right after updating to latest version.

Screen Shot 2019-12-11 at 3 14 58 PM

I just checked the types for those and they look ok. Happy to work on this if someone can provide a reproduction. Please make sure that you've upgraded the @fortawesome/fontawesome-common-types package as well.

Thanks @robmadole. Tried to reproduce my error in a fresh environment but it worked perfectly. Then I tried restarting my TS server after these package updates and that fixed the error message 馃檭

"Hello IT, have you tried turning it off and on again?"

@elramus no worries! "I'll just put this over here with the rest of...the fire"

Adding @fortawesome/fontawesome-common-types to my dependencies fixes it for me

Good deal :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yarcowang picture yarcowang  路  3Comments

huuphat picture huuphat  路  3Comments

desspro picture desspro  路  3Comments

ufoczek picture ufoczek  路  3Comments

omnimint picture omnimint  路  3Comments