esamattis / esamattis/immer-reducer
State with genericity
- Dominant language
- TypeScript
- Stars
- 223
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
Hello, I would like to create standard Reducer like this :
```
import { ImmerReducer } from "immer-reducer";
interface HttpListResult {
query: HttpListQuery;
total?: number;
data?: T[];
}
interface ListViewState extends HttpListResult {
isLoading?: boolean;
}
export abstract class MyReducerBase extends ImmerReducer> {
getAll(query: HttpListQuery) {
this.draftState = {
query,
isLoading: true,
};
}
getAllResult(result: HttpListResult) {
this.draftState = {
...result,
isLoading: false,
};
}
}
```
But in the draftState, data property is typed in Draft\...
What is my error ?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.