Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the definition of 'Reducer<S>' for TypeScript 2.4. #2467

Merged
merged 1 commit into from
Jun 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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