Skip to content

Commit 8a13bb0

Browse files
committed
Move the listener middleware source into the RTK package
1 parent b96ffe1 commit 8a13bb0

File tree

10 files changed

+40
-16
lines changed

10 files changed

+40
-16
lines changed

packages/toolkit/src/index.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,35 @@ export type {
150150
export { nanoid } from './nanoid'
151151

152152
export { default as isPlainObject } from './isPlainObject'
153+
154+
export type {
155+
ListenerEffect,
156+
ListenerMiddleware,
157+
ListenerEffectAPI,
158+
ListenerMiddlewareInstance,
159+
CreateListenerMiddlewareOptions,
160+
ListenerErrorHandler,
161+
TypedStartListening,
162+
TypedAddListener,
163+
TypedStopListening,
164+
TypedRemoveListener,
165+
Unsubscribe,
166+
ForkedTaskExecutor,
167+
ForkedTask,
168+
ForkedTaskAPI,
169+
AsyncTaskExecutor,
170+
SyncTaskExecutor,
171+
TaskCancelled,
172+
TaskRejected,
173+
TaskResolved,
174+
TaskResult,
175+
} from './listenerMiddleware/index'
176+
177+
export {
178+
createListenerMiddleware,
179+
createListenerEntry,
180+
addListener,
181+
removeListener,
182+
removeAllListeners,
183+
TaskAbortError,
184+
} from './listenerMiddleware/index'

packages/action-listener-middleware/src/index.ts renamed to packages/toolkit/src/listenerMiddleware/index.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
import type {
2-
Middleware,
3-
Dispatch,
4-
AnyAction,
5-
Action,
6-
ThunkDispatch,
7-
MiddlewareAPI,
8-
} from '@reduxjs/toolkit'
9-
import { createAction, nanoid } from '@reduxjs/toolkit'
1+
import type { Dispatch, AnyAction, MiddlewareAPI } from 'redux'
2+
import type { ThunkDispatch } from 'redux-thunk'
3+
import { createAction } from '../createAction'
4+
import { nanoid } from '../nanoid'
105

116
import type {
127
ListenerMiddleware,
138
ListenerMiddlewareInstance,
149
AddListenerOverloads,
1510
AnyListenerPredicate,
1611
CreateListenerMiddlewareOptions,
17-
TypedActionCreator,
18-
TypedStartListening,
1912
TypedAddListener,
2013
TypedCreateListenerEntry,
2114
FallbackAddListenerOptions,
@@ -27,7 +20,6 @@ import type {
2720
ForkedTaskExecutor,
2821
ForkedTask,
2922
TypedRemoveListener,
30-
TypedStopListening,
3123
TaskResult,
3224
} from './types'
3325
import {

packages/action-listener-middleware/src/types.ts renamed to packages/toolkit/src/listenerMiddleware/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import type { PayloadAction } from '../createAction'
12
import type {
2-
PayloadAction,
3-
Middleware,
43
Dispatch,
54
AnyAction,
65
MiddlewareAPI,
6+
Middleware,
77
Action,
8-
ThunkDispatch,
9-
} from '@reduxjs/toolkit'
8+
} from 'redux'
9+
import type { ThunkDispatch } from 'redux-thunk'
1010
import type { TaskAbortError } from './exceptions'
1111

1212
/**

0 commit comments

Comments
 (0)