Skip to content

Commit

Permalink
Annotate composeMiddleware.js
Browse files Browse the repository at this point in the history
  • Loading branch information
acdlite committed Jun 14, 2015
1 parent e30f3fd commit f2b37cd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/utils/composeMiddleware.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
export default function compose(...middlewares) {
return middlewares.reduceRight((composed, m) => m(composed));
/* @flow */

import { Middleware, Dispatch } from '../types';

export default function compose(...middlewares: Middleware[]): Middleware {
return middlewares.reduceRight(
(composed: Middleware | Dispatch, m: Middleware | Dispatch) => m(composed)
);
}

1 comment on commit f2b37cd

@acdlite
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently fails due to a bug in Flow where the initialValue parameter of reduceRight is not optional. I submitted a PR to fix: facebook/flow#519

Please sign in to comment.