mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
feat(redux-api-middleware): add createAction types (#43918)
This commit is contained in:
parent
ce90df6301
commit
3aaa00afc9
6
types/redux-api-middleware/index.d.ts
vendored
6
types/redux-api-middleware/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for redux-api-middleware 3.0
|
||||
// Type definitions for redux-api-middleware 3.2
|
||||
// Project: https://github.com/agraboso/redux-api-middleware
|
||||
// Definitions by: Andrew Luca <https://github.com/iamandrewluca>
|
||||
// Craig S <https://github.com/Mrman>
|
||||
@ -147,6 +147,10 @@ export type RSAAResultAction<Payload = never, Meta = never> =
|
||||
|
||||
export type RSAAActions = RSAARequestAction | RSAAResultAction;
|
||||
|
||||
export function createAction<State, Payload, Meta>(
|
||||
clientCall: RSAACall<State, Payload, Meta>
|
||||
): RSAAAction<State, Payload, Meta>;
|
||||
|
||||
/**
|
||||
* Redux behaviour changed by middleware, so overloads here
|
||||
*/
|
||||
|
||||
@ -18,6 +18,7 @@ import {
|
||||
RSAAFailureTypeDescriptor,
|
||||
RSAARequestAction,
|
||||
RSAAResultAction,
|
||||
createAction,
|
||||
} from 'redux-api-middleware';
|
||||
|
||||
{
|
||||
@ -322,3 +323,14 @@ import {
|
||||
error: true,
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
createAction(); // $ExpectError
|
||||
createAction({}); // $ExpectError
|
||||
// $ExpectType RSAAAction<any, any, any>
|
||||
createAction<any, any, any>({
|
||||
endpoint: '/test/endpoint',
|
||||
method: 'GET',
|
||||
types: ['REQ_TYPE', 'SUCCESS_TYPE', 'FAILURE_TYPE'],
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user