mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-21 00:59:29 +00:00
Fix type errors for react-redux upgrade
This commit is contained in:
parent
8590f89cd4
commit
6eeac392f7
4 changed files with 11 additions and 2 deletions
|
|
@ -161,7 +161,7 @@ export function useTypedSelector<T>(selector: (state: AppState) => T): T {
|
|||
export function useActionCreator<T extends (...args: any[]) => Action | Thunk>(
|
||||
actionCreator: T
|
||||
): (...funcArgs: Parameters<T>) => void {
|
||||
const dispatch = useDispatch();
|
||||
const dispatch = useTypedDispatch();
|
||||
return useCallback(
|
||||
(...args) => dispatch(actionCreator(...args)),
|
||||
[dispatch, actionCreator]
|
||||
|
|
@ -169,5 +169,8 @@ export function useActionCreator<T extends (...args: any[]) => Action | Thunk>(
|
|||
}
|
||||
|
||||
export function useTypedDispatch(): (action: Action | Thunk) => void {
|
||||
// useDispatch does not know about thunks. In theory this should be solvable, but I haven't bothered to figure it out:
|
||||
// https://redux.js.org/usage/usage-with-typescript#type-checking-redux-thunks
|
||||
// @ts-ignore
|
||||
return useDispatch();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ class Webamp {
|
|||
});
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider<Action> store={this.store}>
|
||||
<Provider store={this.store}>
|
||||
<App media={this.media} filePickers={this.options.filePickers || []} />
|
||||
</Provider>,
|
||||
node
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@
|
|||
"react-dom": "^18.0.0-alpha-9c8161ba8-20211028",
|
||||
"react-redux": "^8.0.0-alpha.0",
|
||||
"redux": "^4.1.0-alpha.0",
|
||||
"redux-thunk": "^2.4.0",
|
||||
"reselect": "^3.0.1",
|
||||
"tinyqueue": "^1.2.3",
|
||||
"winamp-eqf": "^1.0.0"
|
||||
|
|
|
|||
|
|
@ -13344,6 +13344,11 @@ redux-thunk@^2.3.0:
|
|||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.3.0.tgz#51c2c19a185ed5187aaa9a2d08b666d0d6467622"
|
||||
|
||||
redux-thunk@^2.4.0:
|
||||
version "2.4.0"
|
||||
resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.4.0.tgz#ac89e1d6b9bdb9ee49ce69a69071be41bbd82d67"
|
||||
integrity sha512-/y6ZKQNU/0u8Bm7ROLq9Pt/7lU93cT0IucYMrubo89ENjxPa7i8pqLKu6V4X7/TvYovQ6x01unTeyeZ9lgXiTA==
|
||||
|
||||
redux@^4.0.0, redux@^4.0.1:
|
||||
version "4.0.5"
|
||||
resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.5.tgz#4db5de5816e17891de8a80c424232d06f051d93f"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue