Skip to content

Commit

Permalink
Fixed the definition of 'Reducer' for TypeScript 2.4. (#2467)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRosenwasser authored and timdorr committed Jun 28, 2017
1 parent 6eed34d commit 0de7e5b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ export interface Action {
type: any;
}

/**
* An Action type which accepts any other properties.
* This is mainly for the use of the `Reducer` type.
* This is not part of `Action` itself to prevent users who are extending `Action.
* @private
*/
export interface AnyAction extends Action {
// Allows any extra properties to be defined in an action.
[extraProps: string]: any;
}


/* reducers */

Expand All @@ -43,7 +54,7 @@ export interface Action {
*
* @template S State object type.
*/
export type Reducer<S> = <A extends Action>(state: S, action: A) => S;
export type Reducer<S> = (state: S, action: AnyAction) => S;

/**
* Object whose values correspond to different reducer functions.
Expand Down

0 comments on commit 0de7e5b

Please sign in to comment.