react-fontawesome
react-fontawesome copied to clipboard
TypeScript 3.4.1 Expression produces a union type that is too complex to represent.
Hey all, this is probably a TypeScript issue, but I'm wondering if there's a clever workaround for FA. I just updated to TypeScript 3.4.1 and am getting compile errors now for a function that returns either a Font Awesome string of type IconProp
, or an empty string.
return iconFound ? getIconName(iconFound) : '';
I've tried casting the empty string to type IconProp, but TS still barfs.
In VSCode, hovering over the function tells me the return type is:
'"function" | "500px" | "accessible-icon" | "accusoft" | "acquisitions-incorporated" | "adn" | "adobe" | "adversal" | "affiliatetheme" | "airbnb" | "algolia" | "alipay" | "amazon" | ... 1973 more ... | ""
It's not the end of the world, as I can @ts-ignore
it, but without that, it does stop compilation.
having this issue also
@timothyallan @chrisbutler please see https://github.com/FortAwesome/Font-Awesome/issues/14774
I need some help creating a reduced and reproducible example. Once I have that I can work with the Typescript crew.
I'm going to go ahead and lock this and let's move replies to https://github.com/FortAwesome/Font-Awesome/issues/14774