Skip to content

Commit

Permalink
fix(Entity): EntitySelectors selectIds typing error
Browse files Browse the repository at this point in the history
Closes #525
  • Loading branch information
herkulano committed Oct 29, 2017
1 parent f50690f commit 6d5e2d2
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 6d5e2d2

Please sign in to comment.