Created
October 2, 2020 14:41
-
-
Save akshayjai1/84624f49846604926929ecc284c69577 to your computer and use it in GitHub Desktop.
typescript type for redux dispatch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Dispatch } from 'redux'; | |
export interface IDom { | |
value?: string; | |
name?: string; | |
className?: string; | |
style?: any; | |
} | |
export interface IEvent { | |
target?: IDom; | |
currentTarget?: IDom; | |
} | |
export type thunkApiType = BaseThunkAPI<any, any, any, any>; | |
declare class RejectWithValue<RejectValue> { | |
readonly value: RejectValue; | |
constructor(value: RejectValue); | |
} | |
export declare type BaseThunkAPI< | |
S, | |
E, | |
D extends Dispatch = Dispatch, | |
RejectedValue = undefined | |
> = { | |
dispatch: D; | |
getState: () => S; | |
extra: E; | |
requestId: string; | |
signal: AbortSignal; | |
rejectWithValue(value: RejectedValue): RejectWithValue<RejectedValue>; | |
}; | |
export type Action<Payload> = { | |
type: string; | |
payload?: Payload; | |
meta?: any; | |
}; | |
export type DispatchType = (action: Action<any>) => void; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment