Skip to content

Commit

Permalink
fix(Entity): Change type for EntityState to interface (#454)
Browse files Browse the repository at this point in the history
Closes #458
  • Loading branch information
brandonroberts authored and MikeRyanDev committed Oct 10, 2017
1 parent d4f80d7 commit d5640ec
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
1 change: 1 addition & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies:
test:
override:
- yarn run ci
- yarn run example:build:prod
- yarn run example:test -- --watch=false

deployment:
Expand Down
2 changes: 1 addition & 1 deletion modules/entity/src/entity_state.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EntityState, EntityStateStr, EntityStateNum } from './models';
import { EntityState } from './models';

export function getInitialEntityState<V>(): EntityState<V> {
return {
Expand Down
19 changes: 5 additions & 14 deletions modules/entity/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ export type IdSelectorNum<T> = {

export type IdSelector<T> = IdSelectorStr<T> | IdSelectorNum<T>;

export type DictionaryStr<T> = {
[id: string]: T;
};

export type DictionaryNum<T> = {
[id: number]: T;
};

export type Dictionary<T> = DictionaryStr<T> | DictionaryNum<T>;
export abstract class Dictionary<T> implements DictionaryNum<T> {
[id: string]: T;
}

export type UpdateStr<T> = {
id: string;
Expand All @@ -40,18 +38,11 @@ export type UpdateNum<T> = {

export type Update<T> = UpdateStr<T> | UpdateNum<T>;

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

export interface EntityStateNum<T> {
ids: number[];
entities: Dictionary<T>;
}

export type EntityState<T> = EntityStateStr<T> | EntityStateNum<T>;

export interface EntityDefinition<T> {
selectId: IdSelector<T>;
sortComparer: false | Comparer<T>;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"example:start": "yarn run build && yarn run cli -- serve",
"example:start:aot": "yarn run build && yarn run cli -- serve --aot",
"example:test": "jest --watch",
"example:build:prod": "yarn build && yarn cli -- build --aot -prod --base-href \"/platform/example-app/\" --output-path \"./example-dist/example-app\"",
"example:build:prod": "yarn build && yarn cli -- build -prod --base-href \"/platform/example-app/\" --output-path \"./example-dist/example-app\"",
"ci": "yarn run build && yarn run test && nyc report --reporter=text-lcov | coveralls",
"prettier": "prettier --parser typescript --single-quote --trailing-comma es5 --write \"./**/*.ts\"",
"watch:tests": "chokidar 'modules/**/*.ts' --initial -c 'nyc --reporter=text --reporter=html yarn run test:unit'",
Expand Down

0 comments on commit d5640ec

Please sign in to comment.