- Notifications
You must be signed in to change notification settings - Fork27
Open
Description
It would be nice to have an examples folder with a real redux app with all the various ways this can be used and best practices, Esp async stuff.
My use case is that I'm trying to understand a codebase I've inherited and am not sure if this is a standard practice or not:
import{Site}from'../../model/Site';import{loadSitesaseventApiLoadSites}from'../../rest-api/Event-api';import{Dispatch}from'redux';import{actionCreatorFactory,AnyAction}from'typescript-fsa';importwrapAsyncWorkerfrom'./wrapAsyncWorker';constactionCreator=actionCreatorFactory();exportconstLoadSites=actionCreator.async<null,Site[]>('LoadSites');constloadSitesWorker=wrapAsyncWorker(LoadSites,():Promise<Site[]>=>eventApiLoadSites());exportconstloadSites=()=>{return(dispatch:Dispatch<AnyAction>)=>loadSitesWorker(dispatch,null);};
loadSites() is passed to an argument to store.dispatch and is giving me typing errors:
TypeScript error: Argument of type '(dispatch: Dispatch<AnyAction>) => Promise<Site[]>' is not assignable to parameter of type 'AnyAction'.
Metadata
Metadata
Assignees
Labels
No labels