coding
interface StoreActions {
setUserName: string
actionOne: string[]
actionTwo: { testValue: string }
}
interface CustomActions extends AnyAction {
typeOfAction: keyof StoreActions
// additionalData:???
}
The attribute typeOfAction
in CustomActions corresponds to the keys in StoreActions
Anticipated Results
- For typeOfAction = 'setUserName', the data type is
string
- For typeOfAction = 'actionOne', the data type is
string[]
- For typeOfAction = 'actionTwo', the data type is
{ testValue: string }