-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Type errors in connected HOC in [email protected]
#100
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
Comments
I don't see changeTheme declared in InjectedProps interface |
@piotrwitek No that doesn't help. The problem is that I want to dispatch an action inside the HOC, not in the wrapped component. Let me use your example from the docs. I can't connect it to the redux store properly. I get this error:
And here is the code:
Any ideas please? |
@jakub-astrahit I can share with you some workaround that work for a moment, but I will search for a better solution within nightly build on the next branch. Note: You have to adapt it yourself for your own use-case, unfortunately I don't have time for that. Getting rid of
|
[email protected]
@piotrwitek I tried your workaround (I modified it to match my need), but it doesn't work. I'm trying to use connect() from redux but it gives me this error now:
Here is my component code:
|
@issuehuntfest has funded $20.00 to this issue. See it on IssueHunt |
[email protected]
[email protected]
@jakub-astrahit, I think that your compose is just closed too soon, try this (it worked for me):
|
Hey @jakub-astrahit, I reproduced your issue in my component and it looks like the issue is in connect type-definitions, because other higher order components work just fine. I would suggest filing an issue on definitely typed, I cannot do anything more with this here. |
@piotrwitek has cancelled @IssueHunt's funding for this issue.(Cancelled amount: $20.00) See it on IssueHunt |
@sachadvt Your approach removes the type error (that's great!), but the component can't be used - it gives me this error when used:
@piotrwitek The only solution for me now is to do this:
where Hoc is my class: |
I think I figured a way to get this working for my own problem. I'm also using thunk, but I don't think the pattern should differ much if you don't need it. Here's an example:
I created a helper type to more easily construct that complex
|
Hi, I have an HOC based on this example: https://github.com/piotrwitek/react-redux-typescript-guide/blob/master/playground/src/hoc/with-state.tsx
I am trying to use connect() on this HOC but the typings don't work - I have to use
as any
at the end when I return. How can I fix this code so that it works withoutas any
please?If I don't use
as any
, then I get this typescript error:How can I fix the code above so that it works without
as any
please?The text was updated successfully, but these errors were encountered: