From 21024462a8c9d75ec9208c12fdedc3d93acf432c Mon Sep 17 00:00:00 2001 From: Brandon Roberts Date: Thu, 5 Oct 2017 12:36:05 -0500 Subject: [PATCH 1/2] fix(Entity): Change type for EntityState to interface --- circle.yml | 1 + modules/entity/src/entity_state.ts | 2 +- modules/entity/src/models.ts | 11 ++--------- package.json | 2 +- 4 files changed, 5 insertions(+), 11 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..c235c87460 100644 --- a/modules/entity/src/models.ts +++ b/modules/entity/src/models.ts @@ -40,18 +40,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'", From 1118753ab927959ebe5167a3c50ae5e00bee89ce Mon Sep 17 00:00:00 2001 From: Brandon Roberts Date: Thu, 5 Oct 2017 13:38:02 -0500 Subject: [PATCH 2/2] Change Dictionary to abstract class to provide index signature --- modules/entity/src/models.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/entity/src/models.ts b/modules/entity/src/models.ts index c235c87460..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;