From f7d6ad9ce2999aa4e9c1c4e7377520e060e28a48 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Sat, 23 Nov 2024 15:11:03 -0500 Subject: [PATCH] Rename to CreateAsyncThunkFunction --- packages/toolkit/src/createAsyncThunk.ts | 4 ++-- packages/toolkit/src/index.ts | 2 +- packages/toolkit/src/tests/createAsyncThunk.test.ts | 9 +++------ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/toolkit/src/createAsyncThunk.ts b/packages/toolkit/src/createAsyncThunk.ts index 897edf73bd..733003e6d4 100644 --- a/packages/toolkit/src/createAsyncThunk.ts +++ b/packages/toolkit/src/createAsyncThunk.ts @@ -437,7 +437,7 @@ export type OverrideThunkApiConfigs = Id< NewConfig & Omit > -export type CreateAsyncThunkWithoutWithTypes< +export type CreateAsyncThunkFunction< CurriedThunkApiConfig extends AsyncThunkConfig, > = { /** @@ -486,7 +486,7 @@ export type CreateAsyncThunkWithoutWithTypes< } type CreateAsyncThunk = - CreateAsyncThunkWithoutWithTypes & { + CreateAsyncThunkFunction & { withTypes(): CreateAsyncThunk< OverrideThunkApiConfigs > diff --git a/packages/toolkit/src/index.ts b/packages/toolkit/src/index.ts index ef234c3fce..65291ab83b 100644 --- a/packages/toolkit/src/index.ts +++ b/packages/toolkit/src/index.ts @@ -133,7 +133,7 @@ export type { GetState, GetThunkAPI, SerializedError, - CreateAsyncThunkWithoutWithTypes, + CreateAsyncThunkFunction, } from './createAsyncThunk' export { diff --git a/packages/toolkit/src/tests/createAsyncThunk.test.ts b/packages/toolkit/src/tests/createAsyncThunk.test.ts index 64bfe6c773..d36937d9d6 100644 --- a/packages/toolkit/src/tests/createAsyncThunk.test.ts +++ b/packages/toolkit/src/tests/createAsyncThunk.test.ts @@ -1,7 +1,4 @@ -import type { - CreateAsyncThunkWithoutWithTypes, - UnknownAction, -} from '@reduxjs/toolkit' +import type { CreateAsyncThunkFunction, UnknownAction } from '@reduxjs/toolkit' import { configureStore, createAsyncThunk, @@ -993,9 +990,9 @@ describe('meta', () => { expect(thunk.settled).toEqual(expectFunction) expect(thunk.fulfilled.type).toBe('a/fulfilled') }) - test('createAsyncThunkWrapper using CreateAsyncThunkWithoutWithTypes', async () => { + test('createAsyncThunkWrapper using CreateAsyncThunkFunction', async () => { const customSerializeError = () => 'serialized!' - const createAppAsyncThunk: CreateAsyncThunkWithoutWithTypes<{ + const createAppAsyncThunk: CreateAsyncThunkFunction<{ serializedErrorType: ReturnType }> = (prefix: string, payloadCreator: any, options: any) => createAsyncThunk(prefix, payloadCreator, {