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

Icons don't match the exported type in @tabler/icons-react #1127

Open
th0th opened this issue May 8, 2024 · 4 comments
Open

Icons don't match the exported type in @tabler/icons-react #1127

th0th opened this issue May 8, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@th0th
Copy link

th0th commented May 8, 2024

The icons in @tabler/icons-react don't seem to match the exported type Icon. Typescript shows an error like this:

TS2322: Type
ForwardRefExoticComponent<Omit<IconProps, "ref"> & RefAttributes<Icon>>
is not assignable to type Icon

Here I created an example on codesandbox. You can see the error in App.tsx on line 4. https://codesandbox.io/p/sandbox/gracious-fast-t362lv?file=%2Fsrc%2FApp.tsx

@BG-Software-BG BG-Software-BG added the bug Something isn't working label May 9, 2024
@CHE1RON
Copy link

CHE1RON commented May 14, 2024

Maybe related to #1035 (which contains a possible workaround) 🤔

@th0th
Copy link
Author

th0th commented May 14, 2024

Thank you @CHE1RON. I also created my custom type as a workaround. But getting rid of it, and using the type from the package would be easier :)

@CHE1RON
Copy link

CHE1RON commented May 14, 2024

Would you be willing to share your workaround? I experienced some issue in v3.3.0 and could give it a try 😉

@th0th
Copy link
Author

th0th commented May 14, 2024

Would you be willing to share your workaround? I experienced some issue in v3.3.0 and could give it a try 😉

Of course. I use this one:

import { Icon, IconProps } from "@tabler/icons-react";
import { ForwardRefExoticComponent, RefAttributes } from "react";

export type TablerIcon = ForwardRefExoticComponent<Omit<IconProps, "ref"> & RefAttributes<Icon>>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants