Skip to content

Commit

Permalink
Add Flow types for dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
frantic committed May 31, 2016
1 parent c351616 commit 4c72149
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
11 changes: 10 additions & 1 deletion components.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
// @flow

import React from 'react';
import {logIn, logOut} from './actions';
import {connect} from 'react-redux';

export function SettingsScreen(props) {
import type {Dispatch} from './store';

type Props = {
userName: string;
dispatch: Dispatch;
};

export function SettingsScreen(props: Props) {
return (
<div>
<div>
Expand Down
5 changes: 5 additions & 0 deletions store.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// @flow

import * as Redux from 'redux';
import * as reducers from './reducers';

import type {Action} from './actions';
export type Dispatch = (action: Action | Promise<Action>) => Promise;

const promiseMiddleware = store => next => action =>
typeof action.then === 'function'
? Promise.resolve(action).then(next)
Expand Down

0 comments on commit 4c72149

Please sign in to comment.