@@ -110,11 +110,11 @@ export interface ForkedTask<T> {
110110 *
111111 * ### Example
112112 * ```ts
113- * const result = await fork(async (forkApi) => Promise.resolve(4)).result
113+ * const result = await fork(async (forkApi) => Promise.resolve(4)).result;
114114 *
115- * if(result.status === 'ok') {
116- * console.log(result.value) // logs 4
117- * }}
115+ * if (result.status === 'ok') {
116+ * console.log(result.value); // logs 4
117+ * }
118118 * ```
119119 */
120120 result : Promise < TaskResult < T > >
@@ -151,17 +151,17 @@ export interface ListenerEffectAPI<
151151 *
152152 * ```ts
153153 * middleware.startListening({
154- * predicate: () => true,
155- * async effect(_, { getOriginalState }) {
156- * getOriginalState(); // sync: OK!
154+ * predicate: () => true,
155+ * async effect(_, { getOriginalState }) {
156+ * getOriginalState(); // sync: OK!
157157 *
158- * setTimeout(getOriginalState, 0); // async: throws Error
158+ * setTimeout(getOriginalState, 0); // async: throws Error
159159 *
160- * await Promise().resolve();
160+ * await Promise().resolve();
161161 *
162- * getOriginalState() // async: throws Error
163- * }
164- * })
162+ * getOriginalState(); // async: throws Error
163+ * },
164+ * });
165165 * ```
166166 */
167167 getOriginalState : ( ) => State
@@ -184,17 +184,19 @@ export interface ListenerEffectAPI<
184184 * ### Example
185185 *
186186 * ```ts
187+ * import { createAction } from '@reduxjs/toolkit';
188+ *
187189 * const updateBy = createAction<number>('counter/updateBy');
188190 *
189191 * middleware.startListening({
190- * actionCreator: updateBy,
191- * async effect(_, { condition }) {
192- * // wait at most 3s for `updateBy` actions.
193- * if (await condition(updateBy.match, 3_000)) {
194- * // `updateBy` has been dispatched twice in less than 3s.
195- * }
196- * }
197- * })
192+ * actionCreator: updateBy,
193+ * async effect(_, { condition }) {
194+ * // wait at most 3s for `updateBy` actions.
195+ * if (await condition(updateBy.match, 3_000)) {
196+ * // `updateBy` has been dispatched twice in less than 3s.
197+ * }
198+ * },
199+ * });
198200 * ```
199201 */
200202 condition : ConditionFunction < State >
@@ -273,8 +275,8 @@ export type ListenerEffect<
273275) => void | Promise < void >
274276
275277/**
276- * @public
277278 * Additional infos regarding the error raised.
279+ * @public
278280 */
279281export interface ListenerErrorInfo {
280282 /**
@@ -284,10 +286,10 @@ export interface ListenerErrorInfo {
284286}
285287
286288/**
287- * @public
288289 * Gets notified with synchronous and asynchronous errors raised by `listeners` or `predicates`.
289290 * @param error The thrown error.
290291 * @param errorInfo Additional information regarding the thrown error.
292+ * @public
291293 */
292294export interface ListenerErrorHandler {
293295 ( error : unknown , errorInfo : ListenerErrorInfo ) : void
@@ -396,8 +398,11 @@ export type UnsubscribeListener = (
396398) => void
397399
398400/**
401+ * The possible overloads and options for defining a listener.
402+ * The return type of each function is specified as a generic arg,
403+ * so the overloads can be reused for multiple different functions.
404+ *
399405 * @public
400- * The possible overloads and options for defining a listener. The return type of each function is specified as a generic arg, so the overloads can be reused for multiple different functions
401406 */
402407export type AddListenerOverloads <
403408 Return ,
@@ -555,9 +560,13 @@ export type TypedAddListener<
555560 *
556561 * @example
557562 * ```ts
558- * import { addListener } from '@reduxjs/toolkit'
563+ * import { addListener } from '@reduxjs/toolkit';
559564 *
560- * export const addAppListener = addListener.withTypes<RootState, AppDispatch, ExtraArguments>()
565+ * export const addAppListener = addListener.withTypes<
566+ * RootState,
567+ * AppDispatch,
568+ * ExtraArguments
569+ * >();
561570 * ```
562571 *
563572 * @template OverrideStateType - The specific type of state the middleware listener operates on.
@@ -667,12 +676,13 @@ export type TypedStartListening<
667676> & {
668677 /**
669678 * Creates a "pre-typed" version of
670- * {@linkcode ListenerMiddlewareInstance.startListening startListening}
679+ * {@linkcode ListenerMiddlewareInstance.startListening | startListening}
671680 * where the `state`, `dispatch` and `extra` types are predefined.
672681 *
673682 * This allows you to set the `state`, `dispatch` and `extra` types once,
674683 * eliminating the need to specify them with every
675- * {@linkcode ListenerMiddlewareInstance.startListening startListening} call.
684+ * {@linkcode ListenerMiddlewareInstance.startListening | startListening}
685+ * call.
676686 *
677687 * @returns A pre-typed `startListening` with the state, dispatch and extra types already defined.
678688 *
@@ -726,12 +736,12 @@ export type TypedStopListening<
726736> = RemoveListenerOverloads < StateType , DispatchType , ExtraArgument > & {
727737 /**
728738 * Creates a "pre-typed" version of
729- * {@linkcode ListenerMiddlewareInstance.stopListening stopListening}
739+ * {@linkcode ListenerMiddlewareInstance.stopListening | stopListening}
730740 * where the `state`, `dispatch` and `extra` types are predefined.
731741 *
732742 * This allows you to set the `state`, `dispatch` and `extra` types once,
733743 * eliminating the need to specify them with every
734- * {@linkcode ListenerMiddlewareInstance.stopListening stopListening} call.
744+ * {@linkcode ListenerMiddlewareInstance.stopListening | stopListening} call.
735745 *
736746 * @returns A pre-typed `stopListening` with the state, dispatch and extra types already defined.
737747 *
@@ -834,7 +844,11 @@ export type TypedCreateListenerEntry<
834844 * Internal Types
835845 */
836846
837- /** @internal An single listener entry */
847+ /**
848+ * An single listener entry
849+ *
850+ * @internal
851+ */
838852export type ListenerEntry <
839853 State = unknown,
840854 DispatchType extends Dispatch = Dispatch ,
@@ -848,8 +862,8 @@ export type ListenerEntry<
848862}
849863
850864/**
851- * @internal
852865 * A shorthand form of the accepted args, solely so that `createListenerEntry` has validly-typed conditional logic when checking the options contents
866+ * @internal
853867 */
854868export type FallbackAddListenerOptions = {
855869 actionCreator ?: TypedActionCreatorWithMatchFunction < string >
0 commit comments