Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type the redux middleware #2

Open
caasi opened this issue Sep 28, 2017 · 0 comments
Open

Type the redux middleware #2

caasi opened this issue Sep 28, 2017 · 0 comments

Comments

@caasi
Copy link
Member

caasi commented Sep 28, 2017

Flow keep picking the wrong branch in a union type of two functions(Dispatch).

Type the function will help me to describe my async acitons like const setDate: RawAction<[string], string>.

type InjectStore<A, B> = RawAction<A, B> => Action<A, B>
export type Dispatch
  = DispatchAPI<PlainAction>
  | InjectStore<*, *>

const app: ? = store => next => action =>
  typeof action === 'function'
    ? action(store)
    : next(action)

see: facebook/flow#1948 for more information about union type and functions.

caasi added a commit that referenced this issue Sep 28, 2017
Flow keeps picking the wrong branch. See #2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant