those are the actions.
export const fetchProductsStart = () => ({
type: ProductListActionTypes.PRODUCT_LIST_START,
});
export const fetchProductSuccess = (products: IProduct) => ({
type: ProductListActionTypes.PRODUCT_LIST_SUCCESS,
payload: products,
});
export const fetchProductFailure = (error: any) => ({
type: ProductListActionTypes.PRODUCT_LIST_FAILURE,
payload: error,
});
I wrote Action like this:
export type Action =
| ReturnType<typeof fetchProductsStart>
| ReturnType<typeof fetchProductSuccess>
| ReturnType<typeof fetchProductFailure>;
I passed this to the reducer's Action type
case ProductListActionTypes.PRODUCT_LIST_SUCCESS:
return { loading: false, products: action.payload };
case ProductListActionTypes.PRODUCT_LIST_FAILURE:
return { loading: false, error: action.payload };
I got warning for action.payload. it says "Property 'payload' does not exist on type Action"