1import type { ActionFromMatcher, Matcher, UnionToIntersection } from './tsHelpers'; 2import type { AsyncThunk, AsyncThunkFulfilledActionCreator, AsyncThunkPendingActionCreator, AsyncThunkRejectedActionCreator } from './createAsyncThunk'; 3/** @public */ 4export declare type ActionMatchingAnyOf<Matchers extends [Matcher<any>, ...Matcher<any>[]]> = ActionFromMatcher<Matchers[number]>; 5/** @public */ 6export declare type ActionMatchingAllOf<Matchers extends [Matcher<any>, ...Matcher<any>[]]> = UnionToIntersection<ActionMatchingAnyOf<Matchers>>; 7/** 8 * A higher-order function that returns a function that may be used to check 9 * whether an action matches any one of the supplied type guards or action 10 * creators. 11 * 12 * @param matchers The type guards or action creators to match against. 13 * 14 * @public 15 */ 16export declare function isAnyOf<Matchers extends [Matcher<any>, ...Matcher<any>[]]>(...matchers: Matchers): (action: any) => action is ActionFromMatcher<Matchers[number]>; 17/** 18 * A higher-order function that returns a function that may be used to check 19 * whether an action matches all of the supplied type guards or action 20 * creators. 21 * 22 * @param matchers The type guards or action creators to match against. 23 * 24 * @public 25 */ 26export declare function isAllOf<Matchers extends [Matcher<any>, ...Matcher<any>[]]>(...matchers: Matchers): (action: any) => action is UnionToIntersection<ActionFromMatcher<Matchers[number]>>; 27/** 28 * @param action A redux action 29 * @param validStatus An array of valid meta.requestStatus values 30 * 31 * @internal 32 */ 33export declare function hasExpectedRequestMetadata(action: any, validStatus: readonly string[]): boolean; 34export declare type UnknownAsyncThunkPendingAction = ReturnType<AsyncThunkPendingActionCreator<unknown>>; 35export declare type PendingActionFromAsyncThunk<T extends AnyAsyncThunk> = ActionFromMatcher<T['pending']>; 36/** 37 * A higher-order function that returns a function that may be used to check 38 * whether an action was created by an async thunk action creator, and that 39 * the action is pending. 40 * 41 * @public 42 */ 43export declare function isPending(): (action: any) => action is UnknownAsyncThunkPendingAction; 44/** 45 * A higher-order function that returns a function that may be used to check 46 * whether an action belongs to one of the provided async thunk action creators, 47 * and that the action is pending. 48 * 49 * @param asyncThunks (optional) The async thunk action creators to match against. 50 * 51 * @public 52 */ 53export declare function isPending<AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]>(...asyncThunks: AsyncThunks): (action: any) => action is PendingActionFromAsyncThunk<AsyncThunks[number]>; 54/** 55 * Tests if `action` is a pending thunk action 56 * @public 57 */ 58export declare function isPending(action: any): action is UnknownAsyncThunkPendingAction; 59export declare type UnknownAsyncThunkRejectedAction = ReturnType<AsyncThunkRejectedActionCreator<unknown, unknown>>; 60export declare type RejectedActionFromAsyncThunk<T extends AnyAsyncThunk> = ActionFromMatcher<T['rejected']>; 61/** 62 * A higher-order function that returns a function that may be used to check 63 * whether an action was created by an async thunk action creator, and that 64 * the action is rejected. 65 * 66 * @public 67 */ 68export declare function isRejected(): (action: any) => action is UnknownAsyncThunkRejectedAction; 69/** 70 * A higher-order function that returns a function that may be used to check 71 * whether an action belongs to one of the provided async thunk action creators, 72 * and that the action is rejected. 73 * 74 * @param asyncThunks (optional) The async thunk action creators to match against. 75 * 76 * @public 77 */ 78export declare function isRejected<AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]>(...asyncThunks: AsyncThunks): (action: any) => action is RejectedActionFromAsyncThunk<AsyncThunks[number]>; 79/** 80 * Tests if `action` is a rejected thunk action 81 * @public 82 */ 83export declare function isRejected(action: any): action is UnknownAsyncThunkRejectedAction; 84export declare type UnknownAsyncThunkRejectedWithValueAction = ReturnType<AsyncThunkRejectedActionCreator<unknown, unknown>>; 85export declare type RejectedWithValueActionFromAsyncThunk<T extends AnyAsyncThunk> = ActionFromMatcher<T['rejected']> & (T extends AsyncThunk<any, any, { 86 rejectValue: infer RejectedValue; 87}> ? { 88 payload: RejectedValue; 89} : unknown); 90/** 91 * A higher-order function that returns a function that may be used to check 92 * whether an action was created by an async thunk action creator, and that 93 * the action is rejected with value. 94 * 95 * @public 96 */ 97export declare function isRejectedWithValue(): (action: any) => action is UnknownAsyncThunkRejectedAction; 98/** 99 * A higher-order function that returns a function that may be used to check 100 * whether an action belongs to one of the provided async thunk action creators, 101 * and that the action is rejected with value. 102 * 103 * @param asyncThunks (optional) The async thunk action creators to match against. 104 * 105 * @public 106 */ 107export declare function isRejectedWithValue<AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]>(...asyncThunks: AsyncThunks): (action: any) => action is RejectedWithValueActionFromAsyncThunk<AsyncThunks[number]>; 108/** 109 * Tests if `action` is a rejected thunk action with value 110 * @public 111 */ 112export declare function isRejectedWithValue(action: any): action is UnknownAsyncThunkRejectedAction; 113export declare type UnknownAsyncThunkFulfilledAction = ReturnType<AsyncThunkFulfilledActionCreator<unknown, unknown>>; 114export declare type FulfilledActionFromAsyncThunk<T extends AnyAsyncThunk> = ActionFromMatcher<T['fulfilled']>; 115/** 116 * A higher-order function that returns a function that may be used to check 117 * whether an action was created by an async thunk action creator, and that 118 * the action is fulfilled. 119 * 120 * @public 121 */ 122export declare function isFulfilled(): (action: any) => action is UnknownAsyncThunkFulfilledAction; 123/** 124 * A higher-order function that returns a function that may be used to check 125 * whether an action belongs to one of the provided async thunk action creators, 126 * and that the action is fulfilled. 127 * 128 * @param asyncThunks (optional) The async thunk action creators to match against. 129 * 130 * @public 131 */ 132export declare function isFulfilled<AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]>(...asyncThunks: AsyncThunks): (action: any) => action is FulfilledActionFromAsyncThunk<AsyncThunks[number]>; 133/** 134 * Tests if `action` is a fulfilled thunk action 135 * @public 136 */ 137export declare function isFulfilled(action: any): action is UnknownAsyncThunkFulfilledAction; 138export declare type UnknownAsyncThunkAction = UnknownAsyncThunkPendingAction | UnknownAsyncThunkRejectedAction | UnknownAsyncThunkFulfilledAction; 139export declare type AnyAsyncThunk = { 140 pending: { 141 match: (action: any) => action is any; 142 }; 143 fulfilled: { 144 match: (action: any) => action is any; 145 }; 146 rejected: { 147 match: (action: any) => action is any; 148 }; 149}; 150export declare type ActionsFromAsyncThunk<T extends AnyAsyncThunk> = ActionFromMatcher<T['pending']> | ActionFromMatcher<T['fulfilled']> | ActionFromMatcher<T['rejected']>; 151/** 152 * A higher-order function that returns a function that may be used to check 153 * whether an action was created by an async thunk action creator. 154 * 155 * @public 156 */ 157export declare function isAsyncThunkAction(): (action: any) => action is UnknownAsyncThunkAction; 158/** 159 * A higher-order function that returns a function that may be used to check 160 * whether an action belongs to one of the provided async thunk action creators. 161 * 162 * @param asyncThunks (optional) The async thunk action creators to match against. 163 * 164 * @public 165 */ 166export declare function isAsyncThunkAction<AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]>(...asyncThunks: AsyncThunks): (action: any) => action is ActionsFromAsyncThunk<AsyncThunks[number]>; 167/** 168 * Tests if `action` is a thunk action 169 * @public 170 */ 171export declare function isAsyncThunkAction(action: any): action is UnknownAsyncThunkAction; 172