1 | import type { EntityState } from './models'
|
2 |
|
3 | export function getInitialEntityState<V>(): EntityState<V> {
|
4 | return {
|
5 | ids: [],
|
6 | entities: {},
|
7 | }
|
8 | }
|
9 |
|
10 | export function createInitialStateFactory<V>() {
|
11 | function getInitialState(): EntityState<V>
|
12 | function getInitialState<S extends object>(
|
13 | additionalState: S
|
14 | ): EntityState<V> & S
|
15 | function getInitialState(additionalState: any = {}): any {
|
16 | return Object.assign(getInitialEntityState(), additionalState)
|
17 | }
|
18 |
|
19 | return { getInitialState }
|
20 | }
|
21 |
|
\ | No newline at end of file |