Open ThomasMerant opened 4 years ago
Hello, I would like to create standard Reducer like this :
import { ImmerReducer } from "immer-reducer"; interface HttpListResult<T> { query: HttpListQuery; total?: number; data?: T[]; } interface ListViewState<T> extends HttpListResult<T> { isLoading?: boolean; } export abstract class MyReducerBase<T> extends ImmerReducer<ListViewState<T>> { getAll(query: HttpListQuery) { this.draftState = { query, isLoading: true, }; } getAllResult(result: HttpListResult<T>) { this.draftState = { ...result, isLoading: false, }; } }
But in the draftState, data property is typed in Draft\<T>...
What is my error ?
With typescript 3.8 I see no type errors with your code, but I don't know what your type definition is for HttpListQuery.
Hello, I would like to create standard Reducer like this :
But in the draftState, data property is typed in Draft\<T>...
What is my error ?