Skip to content

I'm trying to pass the dispatch() function of asyncThunk as an argument, but I can't figure out the correct type #4626

Closed

Description

I have a hook like this

image

And i'm trying to pass this function () => dispatch(createAttendanceEvent(eventId)) to createAction argument

image

But i get an error

Type 'Promise<PayloadAction<unknown, string, { arg: number; requestId: string; requestStatus: "fulfilled"; }, never> | PayloadAction<unknown, string, { arg: number; requestId: string; requestStatus: "rejected"; aborted: boolean; condition: boolean; } & ({ ...; } | ({ ...; } & {})), SerializedError>> & { ...; } & { ...; }' is not assignable to type 'Promise<{ payload: void; type: string; }>'

What type of argument should i use to be able to pass this () => dispatch(createAttendanceEvent(eventId))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions