Skip to content

Commit

Permalink
fix: support ts
Browse files Browse the repository at this point in the history
  • Loading branch information
wxnet2013 committed Aug 27, 2018
1 parent 5d34e78 commit 8638f9d
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
import { Observable } from 'rxjs';

export interface Model {
name: string,
state?: any,
reducers?: any,
epics?: any,
}

export interface Action {
type: string,
payload?: any,
data?: any,
}

export type Reducer = (state: any, action: Action) => any;

export type Epic = (action$: Observable<any>, cancel$: Observable<any>) => Observable<any>;

export interface EpicsMapObject {
[key: string]: Epic,
}

export interface ReducersMapObject {
[key: string]: Reducer,
}

export interface Model {
name: string,
state?: any,
reducers?: ReducersMapObject,
epics?: EpicsMapObject,
}

export interface RxLoopInstance {
model: (model: Model) => void,
stream: (modelName: String) => Observable<any>,
dispatch: (action: Action) => void,
getState: (modelName: String) => any,
next: (action: Action) => void,
}

export interface Config {
plugins?: Array<function>,
}

export default function rxloop(): RxLoopInstance;
export default function rxloop(conf?: Config): RxLoopInstance;

0 comments on commit 8638f9d

Please sign in to comment.