Как исправить ошибку?
TS2322: Type '(state: any, action: PayloadAction<{ email: string; token: string;}>) => void' is not assignable to type 'ValidateSliceCaseReducers>'.
Type '(state: any, action: PayloadAction<{ email: string; token: string;}>) => void' is not assignable to type 'SliceCaseReducers'.
Index signature for type 'string' is missing in type '(state: any, action: { payload: { email: string; token: string; }; type: string; }) => void'.
import {createSlice, PayloadAction} from "@reduxjs/toolkit";
export interface AuthState {
token: string | null
}
const initialState: AuthState = {
token: null
}
export const AuthSlice = createSlice({
name: "auth",
initialState,
reducers: (state: any, action: PayloadAction<{email: string, token: string}>) => {
setUser: {
localStorage.setItem("token", action.payload.token)
}
}
})
export const {setUser} = AuthSlice.actions
export default AuthSlice.reducer