TS Redux
Create TS Redux File Structure
switch acts as type guard
define interface per action
removes need for action types
add enum for action types
import Dispatch type definition from redux
import { Dispatch } from "redux";
import Action typeimport { Action } from "../actions";
TS annotate dispatch action type
const searchRepo = (term: string) => async (dispatch: Dispatch<Action\>) => {
dispatch({
type: ActionType.SEARCH_REPO,
});
};