-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Property 'then' does not exist on type 'AsyncThunkAction' #849
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
declare module 'redux' {
export interface Dispatch<A extends Action = AnyAction> extends typeof store.dispatch { }
} |
Sorry if I'm in the wrong place, but I'm having a problem that I think is somewhat related. If I want to use this action creator inside an async function and, for example, console.log the result after the async action has been completed, I get "await has no effect on the type of this expression" before the dispatch function, although everything is working fine and it actually awaits for the action to be completed. Here's the Link for my code and here's a Link for an example of this use in the RTK documentation. This is not an issue per se, but I'm guessing a problem with the dispatch typing. As I'm not using typescript, is there a workaround to fix this in javascript? Thanks and thanks for this amazing library! |
Had same issue and solved it within
Then I changed to:
That tiny difference helped a lot. Now my dispatch function is typed correctly and I can use
|
I have an async action created with
createAsyncThunk
. LinkNow I bind the dispatch to it with
bindActionCreators
and I expose the action with a custom hook. LinkIf now I try to use the async action, the
then
is not a recognized property and I get an error LinkProperty 'then' does not exist on type 'AsyncThunkAction<number, number, {}>'
Do you have any ideas?
My dispatch is custom typed and therefore everything should be correct
The text was updated successfully, but these errors were encountered: