Skip to content

Instantly share code, notes, and snippets.

@frontdevops
Last active August 4, 2016 08:17
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 frontdevops/868670e35cadad15dedb8fce3143d8ce to your computer and use it in GitHub Desktop.
Save frontdevops/868670e35cadad15dedb8fce3143d8ce to your computer and use it in GitHub Desktop.
Redux-elm declarations written on Facebook Flowtype (source file named index.js.flow)
/* @flow */
import type { Component as ReactComponent } from 'react';
export type Action = Object;
export type StatelessReactComponent = (props : Object) => ReactElement;
export type Component = ReactComponent | StatelessReactComponent;
export type Dispatch = (action : Action) => void;
export type MatcherResult = {
wrap: string;
unwrap: string;
args: Object;
};
export type Matcher = (pattern : string) => ((action : Action) => MatcherResult | boolean);
export interface Matchers {
static matcher : Matcher;
static parameterizedMatcher : Matcher;
};
declare export class Updater<M> {
constructor(initialModel : M, saga? : () => Generator, matcher? : Matcher) : Updater<M>;
case(pattern : string, handler : (model : M, action : Action) => M, matcher? : Matcher) : Updater<M>;
toReducer() : (model : M, action : Action) => M
};
declare export function forwardTo(dispatch : function, ...rest : Array<any>) : function;
declare export function wrapAction(action : Object, ...rest : Array<any>) : Object;
declare export function view(component : Component) : Component;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment