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
Exporting DND component all other HOC props are lost #1287
Comments
Just to be clear this is a typings issue and not a runtime issue right? |
When we define the output type of the HOCs and we base their return type on the input type (e.g. YourComponent & ReactComponentClass), then the React-DnD-injected props will be included in the resultant type, which would result in a lot of "missing props" errors in typescript (e.g. why don't you have the connectDragSource prop defined in client code?) . At one point I experimented with making the DnD-injected props optional props on the client side interfaces (e.g. What we have now is a bit of a compromise, and I realize the typings aren't perfect. I favored client-ergonomics over type purity. I have not run across a satisfying solution to that problem, but PRs are welcome. |
* fix: experiment with diff typings to make the hoc-based components more accurate fix #1287 * fix: work on decorator typings, examples not building atm * feat: correct the decorator typings
* fix: experiment with diff typings to make the hoc-based components more accurate fix #1287 * fix: work on decorator typings, examples not building atm * feat: correct the decorator typings
Describe the bug
When exporting a draggable component all other HOC props are removed, like auth etc.
To Reproduce
Create a typescript react project.
Add mapstatetoprops/mapdispatchtoprops
Add react DND
tada, no props are added and everything breaks at compile.
Expected behavior
Does not interfere with other props.
Screenshots
Here's the exporting issue code block:
The text was updated successfully, but these errors were encountered: