Skip to content

Commit

Permalink
fix(Entity): Fix type error for id selectors (#533)
Browse files Browse the repository at this point in the history
Closes #525
  • Loading branch information
herkulano authored and brandonroberts committed Oct 31, 2017
1 parent f50690f commit 88f672c
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions modules/entity/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type UpdateNum<T> = {
export type Update<T> = UpdateStr<T> | UpdateNum<T>;

export interface EntityState<T> {
ids: any[];
ids: string[] | number[];
entities: Dictionary<T>;
}

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

export type EntitySelectorsBase<T, V> = {
export type EntitySelectors<T, V> = {
selectIds: (state: V) => string[] | number[];
selectEntities: (state: V) => Dictionary<T>;
selectAll: (state: V) => T[];
selectTotal: (state: V) => number;
};

export interface EntitySelectorsStr<T, V> extends EntitySelectorsBase<T, V> {
selectIds: (state: V) => string[];
}

export interface EntitySelectorsNum<T, V> extends EntitySelectorsBase<T, V> {
selectIds: (state: V) => number[];
}

export type EntitySelectors<T, V> =
| EntitySelectorsNum<T, V>
| EntitySelectorsStr<T, V>;

export interface EntityAdapter<T> extends EntityStateAdapter<T> {
getInitialState(): EntityState<T>;
getInitialState<S extends object>(state: S): EntityState<T> & S;
Expand Down

0 comments on commit 88f672c

Please sign in to comment.