Skip to content

Commit 0de7e5b

Browse files
DanielRosenwassertimdorr
authored andcommitted
Fixed the definition of 'Reducer' for TypeScript 2.4. (#2467)
1 parent 6eed34d commit 0de7e5b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

index.d.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ export interface Action {
1717
type: any;
1818
}
1919

20+
/**
21+
* An Action type which accepts any other properties.
22+
* This is mainly for the use of the `Reducer` type.
23+
* This is not part of `Action` itself to prevent users who are extending `Action.
24+
* @private
25+
*/
26+
export interface AnyAction extends Action {
27+
// Allows any extra properties to be defined in an action.
28+
[extraProps: string]: any;
29+
}
30+
2031

2132
/* reducers */
2233

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

4859
/**
4960
* Object whose values correspond to different reducer functions.

0 commit comments

Comments
 (0)