Skip to content

Commit

Permalink
Additional fix to exported types
Browse files Browse the repository at this point in the history
The reducer created by .build() now has no type dependencies on either
of typescript-fsa or typescript-fsa-reducers.
  • Loading branch information
dphilipson committed May 2, 2017
1 parent 7eb065c commit 1734e5b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { Action, ActionCreator, isType } from "typescript-fsa";

// Redeclare AnyAction from typescript-fsa so modules can export reducers created by this library
// without requiring a dependency on typescript-fsa.
export interface AnyAction {
type: any;
}
import { Action, ActionCreator, AnyAction, isType } from "typescript-fsa";

export interface ReducerBuilder<InS extends OutS, OutS> {
case<P>(actionCreator: ActionCreator<P>, handler: Handler<InS, OutS, P>): ReducerBuilder<InS, OutS>;
caseWithAction<P>(
actionCreator: ActionCreator<P>,
handler: Handler<InS, OutS, Action<P>>,
): ReducerBuilder<InS, OutS>;
build(): (state: InS, action: AnyAction) => OutS;
// Intentionally avoid AnyAction type so modules can export reducers created using .build()
// without requiring a dependency on typescript-fsa.
build(): (state: InS, action: { type: any }) => OutS;
(state: InS, action: AnyAction): OutS;
}

Expand Down

0 comments on commit 1734e5b

Please sign in to comment.