I've tried to save FormData(Javascript's standard API) using redux toolkit.
const initialState{
myFile: FormData | null
}
const controllerSlice = createSlice({
name: 'controller',
initialState,
reducers: {
test: (state, action) => ({
...state,
}),
//...
It complains
Types of property 'myFile' are incompatible. Type 'WritableDraft<FormData> | null' is not assignable to type 'FormData | null'
I don't know why it complains exactly, but redux toolkit uses immerjs inside of it so seems it wraps FormData with WritableDraft.
The only solution what I've found is changing FormData | null to any
const initialState{
myFile: any
}
But I want to use FormData | null as a type of myFile. Any ideas?