Skip to content

Commit 88f672c

Browse files
herkulanobrandonroberts
authored andcommitted
fix(Entity): Fix type error for id selectors (#533)
Closes #525
1 parent f50690f commit 88f672c

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

modules/entity/src/models.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type UpdateNum<T> = {
3939
export type Update<T> = UpdateStr<T> | UpdateNum<T>;
4040

4141
export interface EntityState<T> {
42-
ids: any[];
42+
ids: string[] | number[];
4343
entities: Dictionary<T>;
4444
}
4545

@@ -65,24 +65,13 @@ export interface EntityStateAdapter<T> {
6565
updateMany<S extends EntityState<T>>(updates: Update<T>[], state: S): S;
6666
}
6767

68-
export type EntitySelectorsBase<T, V> = {
68+
export type EntitySelectors<T, V> = {
69+
selectIds: (state: V) => string[] | number[];
6970
selectEntities: (state: V) => Dictionary<T>;
7071
selectAll: (state: V) => T[];
7172
selectTotal: (state: V) => number;
7273
};
7374

74-
export interface EntitySelectorsStr<T, V> extends EntitySelectorsBase<T, V> {
75-
selectIds: (state: V) => string[];
76-
}
77-
78-
export interface EntitySelectorsNum<T, V> extends EntitySelectorsBase<T, V> {
79-
selectIds: (state: V) => number[];
80-
}
81-
82-
export type EntitySelectors<T, V> =
83-
| EntitySelectorsNum<T, V>
84-
| EntitySelectorsStr<T, V>;
85-
8675
export interface EntityAdapter<T> extends EntityStateAdapter<T> {
8776
getInitialState(): EntityState<T>;
8877
getInitialState<S extends object>(state: S): EntityState<T> & S;

0 commit comments

Comments
 (0)