esamattis / esamattis/immer-reducer

State with genericity

Open
#52 1 comment 0 reactions 0 assignees View on GitHub
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.