diff --git a/apps/example-app/src/app/examples/product-shop-page/components/product-basket-tab/product-basket-tab.component.ts b/apps/example-app/src/app/examples/product-shop-page/components/product-basket-tab/product-basket-tab.component.ts index 79764b6c..8ec05db2 100644 --- a/apps/example-app/src/app/examples/product-shop-page/components/product-basket-tab/product-basket-tab.component.ts +++ b/apps/example-app/src/app/examples/product-shop-page/components/product-basket-tab/product-basket-tab.component.ts @@ -117,11 +117,7 @@ export class ProductBasketTabComponent { } sortBasket(sort: Sort) { - this.store.dispatch( - // TODO fix here no errors on worng name - // ProductBasketActions.FIXTTHISNOTREDsortProductOrders(sort) - ProductBasketActions.sortProductOrders(sort) - ); + this.store.dispatch(ProductBasketActions.sortProductOrders(sort)); } remove() { diff --git a/apps/example-app/src/app/examples/product-shop-page/components/product-shop-tab/product-shop-tab.component.ts b/apps/example-app/src/app/examples/product-shop-page/components/product-shop-tab/product-shop-tab.component.ts index 3cdea683..8f284a17 100644 --- a/apps/example-app/src/app/examples/product-shop-page/components/product-shop-tab/product-shop-tab.component.ts +++ b/apps/example-app/src/app/examples/product-shop-page/components/product-shop-tab/product-shop-tab.component.ts @@ -96,10 +96,6 @@ export class ProductShopTabComponent implements OnInit { this.store.dispatch(ProductActions.loadProductDetail({ id })); } - checkout() { - this.store.dispatch(ProductActions.checkout()); - } - filter(filters: ProductFilter) { this.store.dispatch(ProductActions.filterProducts({ filters })); } diff --git a/libs/ngrx-traits/src/lib/create-entity-feature.ts b/libs/ngrx-traits/src/lib/create-entity-feature.ts index b689dc09..6780c1c3 100644 --- a/libs/ngrx-traits/src/lib/create-entity-feature.ts +++ b/libs/ngrx-traits/src/lib/create-entity-feature.ts @@ -11,9 +11,14 @@ import { TraitActionsFactoryConfig, TraitFactory, TraitSelectors, - TraitSelectorsFactoryConfig, TraitStateMutators, UnionToIntersection, + TraitActionsFactory, + TraitSelectorsFactory, + TraitInitialStateFactory, + TraitStateMutatorsFactory, + TraitReducerFactory, + TraitEffectsFactory, } from './model'; import { Action, @@ -30,14 +35,24 @@ import { capitalize } from './util'; export function createTraitFactory< State = {}, - A extends TraitActions = TraitActions, - S extends TraitSelectors = TraitSelectors, - M extends TraitStateMutators = TraitStateMutators, + A extends TraitActions = {}, + S extends TraitSelectors = {}, + M extends TraitStateMutators = {}, KEY extends string = string, C = unknown, KC = KeyedConfig ->(f: TraitFactory) { - return f; +>(f: { + key: KEY; + config?: C; + depends?: string[]; + actions?: TraitActionsFactory; + selectors?: TraitSelectorsFactory; + initialState?: TraitInitialStateFactory; + mutators?: TraitStateMutatorsFactory; + reducer?: TraitReducerFactory; + effects?: TraitEffectsFactory; +}): TraitFactory { + return f as TraitFactory; } export function createEntityFeatureFactory< diff --git a/libs/ngrx-traits/src/lib/model.ts b/libs/ngrx-traits/src/lib/model.ts index d477a293..575c5a2a 100644 --- a/libs/ngrx-traits/src/lib/model.ts +++ b/libs/ngrx-traits/src/lib/model.ts @@ -181,10 +181,10 @@ export interface TraitFactory< key: KEY; config?: C; depends?: string[]; - actions?: TraitActionsFactory; - selectors?: TraitSelectorsFactory; - initialState?: TraitInitialStateFactory; - mutators?: TraitStateMutatorsFactory; + actions: TraitActionsFactory; + selectors: TraitSelectorsFactory; + initialState: TraitInitialStateFactory; + mutators: TraitStateMutatorsFactory; reducer?: TraitReducerFactory; effects?: TraitEffectsFactory; }