Skip to content

Commit

Permalink
feat: add dispatch type definition (#2219)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwzm authored and sorrycc committed Nov 4, 2019
1 parent bc64c64 commit c222a81
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/dva/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
Reducer,
Action,
AnyAction,
ReducersMapObject,
Dispatch,
Expand Down Expand Up @@ -54,6 +55,10 @@ export interface EffectsMapObject {
[key: string]: Effect | EffectWithType,
}

export interface Dispatch<A extends Action = AnyAction> {
<T extends A>(action: T): Promise<any> | T;
}

export interface SubscriptionAPI {
history: History,
dispatch: Dispatch<any>,
Expand Down

0 comments on commit c222a81

Please sign in to comment.