FortAwesome / react-fontawesome

Font Awesome React component
https://fontawesome.com
MIT License
3.67k stars 264 forks source link

Typescript errors from the new `fasds` variant in 6.6.0 #567

Closed earthtone0ne closed 1 month ago

earthtone0ne commented 1 month ago

Describe the bug Typescript errors due to addition of fasds variant in FontAwesome version 6.6.0. The icon renders correctly, but the Typescript error breaks the build.

Reproducible test case Install @fortawesome/pro-light-svg-icons@"^6.6.0"

import { faWarning } from '@fortawesome/pro-light-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
[...]
 <FontAwesomeIcon icon={faWarning} />

error from Typescript:

TS2322: Type 'IconDefinition' is not assignable to type 'IconProp'.
  Type 'IconDefinition' is not assignable to type 'IconLookup'.
    Types of property 'prefix' are incompatible.
      Type 'import("path/to/node_modules/@fortawesome/fontawesome-common-types/index").IconPrefix' is not assignable to type 'import("path/to/node_modules/@fortawesome/fontawesome-svg-core/node_modules/@fortawesome/fontawesome-common-types/index").IconPrefix'.
        Type '"fasds"' is not assignable to type 'IconPrefix'. Did you mean '"fass"'?

Expected behavior "fasds" is an acceptable IconPrefix and the app builds without error

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

earthtone0ne commented 1 month ago

Got it.. needed to install @fortawesome/fontawesome-svg-core and import {type IconProp}