Skip to content

Instantly share code, notes, and snippets.

@pedroblandim
Created February 27, 2024 23:53
Show Gist options
  • Save pedroblandim/9454d2a947dce25bf771e569693d1b02 to your computer and use it in GitHub Desktop.
Save pedroblandim/9454d2a947dce25bf771e569693d1b02 to your computer and use it in GitHub Desktop.
import { AsyncThunk, AsyncThunkAction } from "@reduxjs/toolkit";
type AsyncThunkReturnType<C extends AsyncThunkAction<any, any, any>> = C extends AsyncThunkAction<infer T, any, any> ? T : unknown;
export type GetAsyncThunkReturnType<T extends AsyncThunk<any, any, any>> = AsyncThunkReturnType<ReturnType<T>>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment