react-fontawesome icon indicating copy to clipboard operation
react-fontawesome copied to clipboard

TypeScript 3.4.1 Expression produces a union type that is too complex to represent.

Open timothyallan opened this issue 5 years ago • 3 comments

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.

timothyallan avatar Mar 29 '19 18:03 timothyallan

having this issue also

chrisbutler avatar Apr 11 '19 14:04 chrisbutler

@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.

robmadole avatar Apr 12 '19 01:04 robmadole

I'm going to go ahead and lock this and let's move replies to https://github.com/FortAwesome/Font-Awesome/issues/14774

robmadole avatar Apr 12 '19 01:04 robmadole