diff --git a/modules/store/spec/types/feature_creator.spec.ts b/modules/store/spec/types/feature_creator.spec.ts index 339bb96e78..d76fdc531f 100644 --- a/modules/store/spec/types/feature_creator.spec.ts +++ b/modules/store/spec/types/feature_creator.spec.ts @@ -71,15 +71,15 @@ describe('createFeature()', () => { snippet.toInfer('reducer', 'ActionReducer'); snippet.toInfer( 'selectProductsState', - 'MemoizedSelector, State, DefaultProjectorFn>' + 'MemoizedSelector, State, (featureState: State) => State>' ); snippet.toInfer( 'selectProducts', - 'MemoizedSelector, string[] | null, DefaultProjectorFn>' + 'MemoizedSelector, string[] | null, (featureState: State) => string[] | null>' ); snippet.toInfer( 'selectQuery', - 'MemoizedSelector, string, DefaultProjectorFn>' + 'MemoizedSelector, string, (featureState: State) => string>' ); snippet.toInfer( 'productsFeatureKeys', @@ -107,11 +107,11 @@ describe('createFeature()', () => { snippet.toInfer('reducer', 'ActionReducer<{ count: number; }, Action>'); snippet.toInfer( 'selectCounterState', - 'MemoizedSelector, { count: number; }, DefaultProjectorFn<{ count: number; }>>' + 'MemoizedSelector, { count: number; }, (featureState: { count: number; }) => { count: number; }>' ); snippet.toInfer( 'selectCount', - 'MemoizedSelector, number, DefaultProjectorFn>' + 'MemoizedSelector, number, (featureState: { count: number; }) => number>' ); }); @@ -231,15 +231,15 @@ describe('createFeature()', () => { snippet.toInfer('reducer', 'ActionReducer'); snippet.toInfer( 'selectBooksState', - 'MemoizedSelector>' + 'MemoizedSelector BooksState>' ); snippet.toInfer( 'selectBooks', - 'MemoizedSelector>' + 'MemoizedSelector Book[]>' ); snippet.toInfer( 'selectLoadState', - 'MemoizedSelector>' + 'MemoizedSelector LoadState>' ); snippet.toInfer( 'booksFeatureKeys', @@ -272,11 +272,11 @@ describe('createFeature()', () => { snippet.toInfer('reducer', 'ActionReducer'); snippet.toInfer( 'selectFooState', - 'MemoizedSelector<{ foo: State; }, State, DefaultProjectorFn>' + 'MemoizedSelector<{ foo: State; }, State, (featureState: State) => State>' ); snippet.toInfer( 'selectBar', - 'MemoizedSelector<{ foo: State; }, string, DefaultProjectorFn>' + 'MemoizedSelector<{ foo: State; }, string, (featureState: State) => string>' ); }); @@ -446,11 +446,11 @@ describe('createFeature()', () => { snippet.toInfer('reducer', 'ActionReducer'); snippet.toInfer( 'selectCounterState', - 'MemoizedSelector, State, DefaultProjectorFn>' + 'MemoizedSelector, State, (featureState: State) => State>' ); snippet.toInfer( 'selectCount', - 'MemoizedSelector, number, DefaultProjectorFn>' + 'MemoizedSelector, number, (featureState: State) => number>' ); snippet.toInfer( 'selectCounterState2', @@ -500,11 +500,11 @@ describe('createFeature()', () => { snippet.toInfer('reducer', 'ActionReducer<{ count: number; }, Action>'); snippet.toInfer( 'selectCounterState', - 'MemoizedSelector, { count: number; }, DefaultProjectorFn<{ count: number; }>>' + 'MemoizedSelector, { count: number; }, (featureState: { count: number; }) => { count: number; }>' ); snippet.toInfer( 'selectCount', - 'MemoizedSelector, number, DefaultProjectorFn>' + 'MemoizedSelector, number, (featureState: { count: number; }) => number>' ); snippet.toInfer( 'selectSquaredCount', @@ -551,7 +551,7 @@ describe('createFeature()', () => { ); snippet.toInfer( 'selectCount2', - 'MemoizedSelector, number, DefaultProjectorFn>' + 'MemoizedSelector, number, (featureState: { count1: number; count2: number; }) => number>' ); snippet.toInfer( 'selectCount10', @@ -598,11 +598,11 @@ describe('createFeature()', () => { snippet.toInfer( 'selectCounter1State', - 'MemoizedSelector, number, DefaultProjectorFn>' + 'MemoizedSelector, number, (featureState: number) => number>' ); snippet.toInfer( 'selectCounter2State', - 'MemoizedSelector, number, DefaultProjectorFn>' + 'MemoizedSelector, number, (featureState: number) => number>' ); snippet.toInfer( 'counterFeature1Keys', @@ -628,7 +628,7 @@ describe('createFeature()', () => { snippet.toInfer( 'selectCounterState', - 'MemoizedSelector, number, DefaultProjectorFn>' + 'MemoizedSelector, number, (featureState: number) => number>' ); snippet.toInfer( 'counterFeatureKeys', diff --git a/modules/store/src/feature_creator_models.ts b/modules/store/src/feature_creator_models.ts index 9f3cfee1e2..1f18b5ee77 100644 --- a/modules/store/src/feature_creator_models.ts +++ b/modules/store/src/feature_creator_models.ts @@ -13,7 +13,8 @@ export type FeatureSelector< > = { [K in FeatureName as `select${Capitalize}State`]: MemoizedSelector< AppState, - FeatureState + FeatureState, + (featureState: FeatureState) => FeatureState >; }; @@ -26,6 +27,7 @@ export type NestedSelectors< [K in keyof FeatureState & string as `select${Capitalize}`]: MemoizedSelector< AppState, - FeatureState[K] + FeatureState[K], + (featureState: FeatureState) => FeatureState[K] >; };