Skip to content

Commit

Permalink
fix(typescript): Fixed typescript definitions to fix createReducers (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeam authored Jun 1, 2020
1 parent 117880a commit 20f7a53
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@ declare module 'reduxsauce' {
import { Action, AnyAction, Reducer, ActionCreator } from 'redux';

export interface Actions {
[action: string]: (string[] | DefaultActionTypes | ActionCreator<DefaultActionTypes>) | null;
[action: string]: (string[] | ActionTypes | ActionCreator<ActionTypes>) | null;
}

export interface DefaultActionTypes {
export interface ActionTypes {
[action: string]: string | number | DefaultActionTypes | null;
}

export interface DefaultActionTypes {
[action: string]: string;
}

export interface DefaultActionCreators {
[action: string]: (...args: any[]) => AnyAction;
}

export interface Handlers<S, A = AnyAction> {
[type: string]: (state: S, action: A) => S;
export interface Handlers<S> {
[type: string]: (state: S, action: any) => S;
}

/**
Expand All @@ -38,7 +42,7 @@ declare module 'reduxsauce' {

export function createReducer<S = {}, A extends Action = AnyAction>(
initialState: S,
handlers: Handlers<S, A>
handlers: Handlers<S>
): Reducer<S, A>;

export function createTypes<T = DefaultActionTypes>(types: string, options?: Options): T;
Expand Down

0 comments on commit 20f7a53

Please sign in to comment.