Skip to content

Commit 7c1df51

Browse files
author
Sam Storie
committed
Adding a typescript definition file. Filename chosen to leverage typescript's default definition file strategy for npm packages. Definitions based upon this discussion: #32
1 parent 981625b commit 7c1df51

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

index.d.ts

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
declare module ngRedux {
2+
3+
interface Reducer extends Function {
4+
(state: any, action: any): any;
5+
}
6+
7+
interface Dispatch extends Function {
8+
(action: any): any;
9+
}
10+
11+
interface MiddlewareArg {
12+
dispatch: Dispatch;
13+
getState: Function;
14+
}
15+
16+
interface Middleware extends Function {
17+
(obj: MiddlewareArg): Function;
18+
}
19+
20+
interface INgRedux {
21+
getReducer(): Reducer;
22+
replaceReducer(nextReducer: Reducer): void;
23+
dispatch(action: any): any;
24+
getState(): any;
25+
subscribe(listener: Function): Function;
26+
connect(
27+
mapStateToTarget: (state: any) => Object,
28+
mapDispatchToTarget?: Object | ((dispatch: Function) => Object)
29+
): (target: Function | Object) => () => void;
30+
}
31+
32+
interface INgReduxProvider {
33+
createStoreWith(reducer: Reducer, middlewares?: Array<Middleware | string>, storeEnhancers?: Function[]): void;
34+
}
35+
}
36+
37+
declare module "ngRedux" {
38+
export = ngRedux;
39+
}

0 commit comments

Comments
 (0)