3 ms·
This is what my redux stuff looks like with TypeScript: const constants = { addMovie: 'movies/addMovie', } export const addMovie = createAct
by mikewhy 7y ago
This is what my redux stuff looks like with TypeScript:
const constants = {
addMovie: 'movies/addMovie',
}
export const addMovie = createAction<string>(constants.addMovie)
export const reducer = createReducer(initialState, {
[constants.addMovie]: (state, action: ReturnType<typeof addMovie>) => ({
...state,
})
})
But this forgoes applying any constraints to `dispatch` / the ability to have one giant union of all possible action types your app supports.