From 7bb171a9eae6b9857f8b6f23400678a0103fd65c Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 6 Aug 2024 14:22:18 +0200 Subject: [PATCH] [Glitch] Remove usage of non-public RTK types Port 57a1f86626ad00f12ccf055c4f0e0ade506b8fba to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/store/typed_functions.ts | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/app/javascript/flavours/glitch/store/typed_functions.ts b/app/javascript/flavours/glitch/store/typed_functions.ts index 98d0d31fa3..cd0f95cef9 100644 --- a/app/javascript/flavours/glitch/store/typed_functions.ts +++ b/app/javascript/flavours/glitch/store/typed_functions.ts @@ -1,9 +1,8 @@ +import type { GetThunkAPI } from '@reduxjs/toolkit'; import { createAsyncThunk } from '@reduxjs/toolkit'; // eslint-disable-next-line @typescript-eslint/no-restricted-imports import { useDispatch, useSelector } from 'react-redux'; -import type { BaseThunkAPI } from '@reduxjs/toolkit/src/createAsyncThunk'; - import type { AppDispatch, RootState } from './store'; export const useAppDispatch = useDispatch.withTypes(); @@ -25,29 +24,20 @@ export const createAppAsyncThunk = createAsyncThunk.withTypes<{ rejectValue: AsyncThunkRejectValue; }>(); -type AppThunkApi = Pick< - BaseThunkAPI< - RootState, - unknown, - AppDispatch, - AsyncThunkRejectValue, - AppMeta, - AppMeta - >, - 'getState' | 'dispatch' ->; - -interface AppThunkOptions { - skipLoading?: boolean; -} - -const createBaseAsyncThunk = createAsyncThunk.withTypes<{ +interface AppThunkConfig { state: RootState; dispatch: AppDispatch; rejectValue: AsyncThunkRejectValue; fulfilledMeta: AppMeta; rejectedMeta: AppMeta; -}>(); +} +type AppThunkApi = Pick, 'getState' | 'dispatch'>; + +interface AppThunkOptions { + skipLoading?: boolean; +} + +const createBaseAsyncThunk = createAsyncThunk.withTypes(); export function createThunk( name: string,