import { createFeatureSelector , Selector , Store } from '@ngrx/store' ; import { EntityCacheState , ENTITY_CACHE_NAME } from '../reducers' ; export const entityCacheSelector = createFeatureSelector < EntityCacheState > ( ENTITY_CACHE_NAME ) ; interface SelectorMap { [ name ] : Selector < { } , any > ; } export function createSelectors$ < T > ( store , selectors ) { const selectorMap = selectors as any as SelectorMap ; return < T > Object . keys ( selectorMap ) . reduce ( ( selectors$ , name ) => { const name$ = name [ 6 ] . toLowerCase ( ) + name . substr ( 7 ) + '$' ; selectors$ [ name$ ] = store . select ( selectorMap . name ) ; } , { } ) ; }