mizchi / hard-reducer

Type friendly reducer helper
56 stars 6 forks source link

Add typing for asynchronous ActionCreator with no arguments #12

Closed hachibeeDI closed 5 years ago

hachibeeDI commented 5 years ago

引数なしAsync & Thunk ActionCreatorの型定義サポート :pray:

i.e.

// thunk example
const thunkedNoArgs = createThunkAction(
  "thunked-noargs",
  async (_input: void, dispatch, getState) => {
    dispatch(inc(0));
    dispatch(dec(0));
    dispatch(inc(0));
    return getState();
  }
);

thunkedNoArgs();
mizchi commented 5 years ago

👍