{"action":"created","issue":{"url":"https://api.github.com/repos/reduxjs/redux/issues/3066","repository_url":"https://api.github.com/repos/reduxjs/redux","labels_url":"https://api.github.com/repos/reduxjs/redux/issues/3066/labels{/name}","comments_url":"https://api.github.com/repos/reduxjs/redux/issues/3066/comments","events_url":"https://api.github.com/repos/reduxjs/redux/issues/3066/events","html_url":"https://github.com/reduxjs/redux/issues/3066","id":342746573,"node_id":"MDU6SXNzdWUzNDI3NDY1NzM=","number":3066,"title":"Upgrading to the latest redux and react-redux breaks typings for async actions","user":{"login":"mduu","id":8256317,"node_id":"MDQ6VXNlcjgyNTYzMTc=","avatar_url":"https://avatars3.githubusercontent.com/u/8256317?v=4","gravatar_id":"","url":"https://api.github.com/users/mduu","html_url":"https://github.com/mduu","followers_url":"https://api.github.com/users/mduu/followers","following_url":"https://api.github.com/users/mduu/following{/other_user}","gists_url":"https://api.github.com/users/mduu/gists{/gist_id}","starred_url":"https://api.github.com/users/mduu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mduu/subscriptions","organizations_url":"https://api.github.com/users/mduu/orgs","repos_url":"https://api.github.com/users/mduu/repos","events_url":"https://api.github.com/users/mduu/events{/privacy}","received_events_url":"https://api.github.com/users/mduu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-19T14:14:27Z","updated_at":"2018-07-19T14:16:23Z","closed_at":null,"author_association":"NONE","body":"**Do you want to request a *feature* or report a *bug*?**  \r\n\r\nBug\r\n\r\n**What is the current behavior?**\r\n\r\nAfter upgrading to the latest redux and react-readux packages (including their typings) we get type errors where we dispatch async actions. The TypeScript compiler complains about a missing \"type\" property.\r\n\r\nHere is where the TS compiler complains:\r\n\r\n```typescript\r\nfunction mapDispatchToProps(dispatch: Dispatch): TDispatchProps {\r\n    return {\r\n        fetchDetails: (forceFetch?: boolean) => dispatch(fetchDetailsAsync(forceFetch)) // <-- ERROR\r\n    };\r\n}\r\n```\r\nThe compiler error we get:\r\n\r\n```\r\nError:(54, 58) TS2345: Argument of type 'TDispatchableReturn<ContractsAction, IState>' is not assignable to parameter of type 'AnyAction'.\r\n  Property 'type' is missing in type 'TDispatchableReturn<ContractsAction, IState>'.\r\n```\r\n\r\n**fetchDatailsAsync():**\r\n\r\n```typescript\r\nexport function fetchDetailsAsync(forceFetch?: boolean): TDispatchableReturn<ContractsAction, IState> {\r\n    return async function (dispatch, getState) {\r\n...\r\n```\r\n\r\nWe updated our ``IDispatchableReturn`` so it looks like this:\r\n\r\n```typescript\r\nimport { Action } from 'redux';\r\n\r\nexport type TDispatchableReturn<TAction extends Action, TState> = (\r\n    dispatch: (args: TAction) => void,\r\n    getState: () => TState\r\n) => Promise<TAction>;\r\n```\r\n...but had no lock.\r\n\r\nWe researched why this happens after upgrading the typings. For us it looks like in the past ``react-redux`` provided its own typing for ``Dispose`` with lesser type-contrains. Not its doesn't anymore so we have to use the ``Dispose`` typing from ``redux`` itself. These got improved/fixed for Redux 4.0.0. They need a ``Action`` which needs a ``type`` property. But async actions don't have this.\r\n\r\nThe [Redux documentation still](https://redux.js.org/advanced/async-actions) shows the same pattern how to use async actions but this does not work with the currently Typescript typings of Redux 4.0.0 anymore.\r\n\r\n**What is the expected behavior?**\r\n\r\nThat we get the above code compile (and work again). Eighter the docs are wrong/outdated or the typings don't address async-actions. ...at least as we see it.\r\n\r\n**Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?**\r\n\r\n- redux: 4.0.0\r\n- react-redux: 5.0.7 (typing: 6.0.4)"},"comment":{"url":"https://api.github.com/repos/reduxjs/redux/issues/comments/406291647","html_url":"https://github.com/reduxjs/redux/issues/3066#issuecomment-406291647","issue_url":"https://api.github.com/repos/reduxjs/redux/issues/3066","id":406291647,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjI5MTY0Nw==","user":{"login":"encodotom","id":36399263,"node_id":"MDQ6VXNlcjM2Mzk5MjYz","avatar_url":"https://avatars0.githubusercontent.com/u/36399263?v=4","gravatar_id":"","url":"https://api.github.com/users/encodotom","html_url":"https://github.com/encodotom","followers_url":"https://api.github.com/users/encodotom/followers","following_url":"https://api.github.com/users/encodotom/following{/other_user}","gists_url":"https://api.github.com/users/encodotom/gists{/gist_id}","starred_url":"https://api.github.com/users/encodotom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/encodotom/subscriptions","organizations_url":"https://api.github.com/users/encodotom/orgs","repos_url":"https://api.github.com/users/encodotom/repos","events_url":"https://api.github.com/users/encodotom/events{/privacy}","received_events_url":"https://api.github.com/users/encodotom/received_events","type":"User","site_admin":false},"created_at":"2018-07-19T14:16:23Z","updated_at":"2018-07-19T14:16:23Z","author_association":"NONE","body":"Also experiencing the same issue."}}
{"actor":{"display_login":"encodotom"}}