Skip to content

Commit

Permalink
Rename to CreateAsyncThunkFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Nov 23, 2024
1 parent 5384159 commit f7d6ad9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/toolkit/src/createAsyncThunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ export type OverrideThunkApiConfigs<OldConfig, NewConfig> = Id<
NewConfig & Omit<OldConfig, keyof NewConfig>
>

export type CreateAsyncThunkWithoutWithTypes<
export type CreateAsyncThunkFunction<
CurriedThunkApiConfig extends AsyncThunkConfig,
> = {
/**
Expand Down Expand Up @@ -486,7 +486,7 @@ export type CreateAsyncThunkWithoutWithTypes<
}

type CreateAsyncThunk<CurriedThunkApiConfig extends AsyncThunkConfig> =
CreateAsyncThunkWithoutWithTypes<CurriedThunkApiConfig> & {
CreateAsyncThunkFunction<CurriedThunkApiConfig> & {
withTypes<ThunkApiConfig extends AsyncThunkConfig>(): CreateAsyncThunk<
OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>
>
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export type {
GetState,
GetThunkAPI,
SerializedError,
CreateAsyncThunkWithoutWithTypes,
CreateAsyncThunkFunction,
} from './createAsyncThunk'

export {
Expand Down
9 changes: 3 additions & 6 deletions packages/toolkit/src/tests/createAsyncThunk.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import type {
CreateAsyncThunkWithoutWithTypes,
UnknownAction,
} from '@reduxjs/toolkit'
import type { CreateAsyncThunkFunction, UnknownAction } from '@reduxjs/toolkit'
import {
configureStore,
createAsyncThunk,
Expand Down Expand Up @@ -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<typeof customSerializeError>
}> = (prefix: string, payloadCreator: any, options: any) =>
createAsyncThunk(prefix, payloadCreator, {
Expand Down

0 comments on commit f7d6ad9

Please sign in to comment.