Skip to content

Commit

Permalink
Fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
clarus committed Nov 28, 2016
1 parent adf75eb commit 9cd6247
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions examples/http-request/src/eye/__tests__/model.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// @flow
import * as EyeModel from '../model';

const patches = [{
const commits = [{
type: 'LoadStart',
}, {
type: 'LoadSuccess',
color: 'red',
}]

test('model', () => {
patches.forEach(commit => {
commits.forEach(commit => {
expect(EyeModel.reduce(EyeModel.initialState, commit)).toMatchSnapshot();
});
});
2 changes: 1 addition & 1 deletion examples/http-request/src/movies/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type Action = {
type: 'Load',
};

export function* control(action: Action): Ship.Ship<*, MoviesModel.Patch, MoviesModel.State, void> {
export function* control(action: Action): Ship.Ship<*, MoviesModel.Commit, MoviesModel.State, void> {
switch (action.type) {
case 'Load': {
yield* Ship.commit({type: 'LoadStart'});
Expand Down
8 changes: 4 additions & 4 deletions examples/http-request/src/movies/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ export const initialState: State = {
movies: null,
};

export type Patch = {
export type Commit = {
type: 'LoadStart',
} | {
type: 'LoadSuccess',
movies: string[],
};

export function reduce(state: State, patch: Patch): State {
switch (patch.type) {
export function reduce(state: State, commit: Commit): State {
switch (commit.type) {
case 'LoadStart':
return {
...state,
Expand All @@ -28,7 +28,7 @@ export function reduce(state: State, patch: Patch): State {
return {
...state,
isLoading: false,
movies: patch.movies,
movies: commit.movies,
};
default:
return state;
Expand Down

0 comments on commit 9cd6247

Please sign in to comment.