From d5640eceaed541381986544e9284aef33b4290b9 Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 10 Oct 2017 11:58:46 -0500 Subject: [PATCH] fix(Entity): Change type for EntityState to interface (#454) Closes #458 --- circle.yml | 1 + modules/entity/src/entity_state.ts | 2 +- modules/entity/src/models.ts | 19 +++++-------------- package.json | 2 +- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/circle.yml b/circle.yml index 146a171107..3877f51be8 100644 --- a/circle.yml +++ b/circle.yml @@ -16,6 +16,7 @@ dependencies: test: override: - yarn run ci + - yarn run example:build:prod - yarn run example:test -- --watch=false deployment: diff --git a/modules/entity/src/entity_state.ts b/modules/entity/src/entity_state.ts index 2f86ed2b62..aab8653b49 100644 --- a/modules/entity/src/entity_state.ts +++ b/modules/entity/src/entity_state.ts @@ -1,4 +1,4 @@ -import { EntityState, EntityStateStr, EntityStateNum } from './models'; +import { EntityState } from './models'; export function getInitialEntityState(): EntityState { return { diff --git a/modules/entity/src/models.ts b/modules/entity/src/models.ts index c9656b41fa..d1ba0692b9 100644 --- a/modules/entity/src/models.ts +++ b/modules/entity/src/models.ts @@ -18,15 +18,13 @@ export type IdSelectorNum = { export type IdSelector = IdSelectorStr | IdSelectorNum; -export type DictionaryStr = { - [id: string]: T; -}; - export type DictionaryNum = { [id: number]: T; }; -export type Dictionary = DictionaryStr | DictionaryNum; +export abstract class Dictionary implements DictionaryNum { + [id: string]: T; +} export type UpdateStr = { id: string; @@ -40,18 +38,11 @@ export type UpdateNum = { export type Update = UpdateStr | UpdateNum; -export interface EntityStateStr { - ids: string[]; +export interface EntityState { + ids: any[]; entities: Dictionary; } -export interface EntityStateNum { - ids: number[]; - entities: Dictionary; -} - -export type EntityState = EntityStateStr | EntityStateNum; - export interface EntityDefinition { selectId: IdSelector; sortComparer: false | Comparer; diff --git a/package.json b/package.json index d453d147a6..9e0cbd9390 100644 --- a/package.json +++ b/package.json @@ -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'",