Closed jacksontong closed 4 years ago
I'm using ActionHelper.ts from the typescript example to create my action and I don't know how to typing the action in my saga watcher
// action.ts import { createAction, ActionsUnion } from "ActionHelper" export enum ActionTypes { REQUEST_DELETE = "REQUEST_DELETE", } export const Actions = { requestDelete: (id: number) => createAction(ActionTypes.REQUEST_DELETE, { id }), } export type ActionsUnion = ActionsUnion<typeof Actions> // saga.ts function* handleRequestDelete(action: any) { const id = action.payload.id }
I'm able to solve this by ReturnType
// saga.ts function* handleRequestDelete(action: ReturnType<typeof Actions.requestDelete>) { const id = action.payload.id }
I'm using ActionHelper.ts from the typescript example to create my action and I don't know how to typing the action in my saga watcher