Skip to content

Instantly share code, notes, and snippets.

@dmmarmol
Created December 30, 2017 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmmarmol/f21ab9338fb7fd5dea8a3f087c2264e3 to your computer and use it in GitHub Desktop.
Save dmmarmol/f21ab9338fb7fd5dea8a3f087c2264e3 to your computer and use it in GitHub Desktop.
An example of a typed react-redux middleware using Typescript
import { Action } from 'redux/store-types';
import { Dispatch, MiddlewareAPI, Store } from 'redux';
export const authMiddleware = (_api: MiddlewareAPI<Store<void>>) => (
next: Dispatch<void>
) => <A extends Action>(action: A) => {
return next(action);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment