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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Type error when customize icon with function #761

Closed
Vl3oss opened this issue May 23, 2022 · 0 comments 路 Fixed by #762
Closed

[Bug] Type error when customize icon with function #761

Vl3oss opened this issue May 23, 2022 · 0 comments 路 Fixed by #762

Comments

@Vl3oss
Copy link
Contributor

Vl3oss commented May 23, 2022

Do you want to request a feature or report a bug?

report a bug 馃悶

What is the current behavior?

When customize icon with function like the last example in the doc, Typescript will complain about type mismatched.

For example toast("Wow so easy !", { icon: () => "a" }) would results in this error from

Type '() => string' is not assignable to type 'ReactNode'.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

https://codesandbox.io/s/react-toastify-customize-icon-spjxlf?file=/src/App.tsx

What is the expected behavior?

No type error when customize icon with function (the functionality seems to be working as expected)

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

React version 17-18

@Vl3oss Vl3oss changed the title Type error when customize icon with function [Bug] Type error when customize icon with function May 23, 2022
Vl3oss added a commit to Vl3oss/react-toastify that referenced this issue May 23, 2022
fkhadra added a commit that referenced this issue May 29, 2022
fix: add function type in `icon` prop #761
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant