saga-toolkit 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +30 -8
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- // generated with chatGTP
1
+ // generated with chatGPT
2
+
3
+ import { ThunkAction } from '@reduxjs/toolkit'
2
4
 
3
5
  declare module 'saga-toolkit' {
4
- import { createAsyncThunk, ThunkAction } from '@reduxjs/toolkit'
5
6
  import { Dispatch } from 'redux'
6
7
  import { SagaIterator } from 'redux-saga'
7
- import { ActionCreatorWithPayload } from '@reduxjs/toolkit/src/createAction'
8
8
  import { AsyncThunkFulfilledActionCreator, AsyncThunkConfig } from '@reduxjs/toolkit/src/createAsyncThunk'
9
9
 
10
10
  type AsyncSagaPayloadCreator<Returned, ThunkArg = void> = (
@@ -18,7 +18,7 @@ declare module 'saga-toolkit' {
18
18
  ThunkApiConfig extends AsyncThunkConfig = {}
19
19
  > = (
20
20
  arg: ThunkArg
21
- ) => ActionCreatorWithPayload<
21
+ ) => ThunkAction<
22
22
  Promise<Returned>,
23
23
  ReturnType<Dispatch>,
24
24
  unknown,
@@ -43,8 +43,30 @@ declare module 'saga-toolkit' {
43
43
  type: string;
44
44
  }
45
45
 
46
- export function takeEveryAsync(pattern: any, saga: any, ...args: any[]): any
47
- export function takeLatestAsync(pattern: any, saga: any, ...args: any[]): any
48
- export function takeAggregateAsync(pattern: any, saga: any, ...args: any[]): any
49
- export function putAsync(action: any): any
46
+ type SagaFunction<Args extends any[]> = (...args: Args) => SagaIterator;
47
+
48
+ export function takeEveryAsync<ActionPattern>(
49
+ pattern: ActionPattern,
50
+ saga: SagaFunction<[...args: any[]]>,
51
+ ...args: any[]
52
+ ): void;
53
+
54
+ export function takeLatestAsync<ActionPattern>(
55
+ pattern: ActionPattern,
56
+ saga: SagaFunction<[...args: any[]]>,
57
+ ...args: any[]
58
+ ): void;
59
+
60
+ export function takeAggregateAsync<ActionPattern>(
61
+ pattern: ActionPattern,
62
+ saga: SagaFunction<[...args: any[]]>,
63
+ ...args: any[]
64
+ ): void;
65
+
66
+ export function putAsync<T>(action: T): T;
67
+
68
+ // export function takeEveryAsync(pattern: any, saga: any, ...args: any[]): any
69
+ // export function takeLatestAsync(pattern: any, saga: any, ...args: any[]): any
70
+ // export function takeAggregateAsync(pattern: any, saga: any, ...args: any[]): any
71
+ // export function putAsync(action: any): any
50
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saga-toolkit",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "An extension for redux-toolkit that allows sagas to resolve async thunk actions.",
5
5
  "main": "index.js",
6
6
  "scripts": {