@@ -87,6 +87,14 @@ export function createFeature<
87
87
* @returns An object that contains a feature name, a feature reducer,
88
88
* a feature selector, and a selector for each feature state property.
89
89
*/
90
+ export function createFeature < FeatureName extends string , FeatureState > (
91
+ featureConfig : FeatureConfig < FeatureName , FeatureState > &
92
+ NotAllowedFeatureStateCheck < FeatureState >
93
+ ) : Feature < Record < string , any > , FeatureName , FeatureState > ;
94
+ /**
95
+ * @deprecated Use the `createFeature` signature without root state instead.
96
+ * For more info see: https://github.com/ngrx/platform/issues/3737
97
+ */
90
98
export function createFeature <
91
99
AppState extends Record < string , any > ,
92
100
FeatureName extends keyof AppState & string = keyof AppState & string ,
@@ -110,13 +118,7 @@ export function createFeature<
110
118
*
111
119
* @usageNotes
112
120
*
113
- * **With Application State**
114
- *
115
121
* ```ts
116
- * interface AppState {
117
- * products: ProductsState;
118
- * }
119
- *
120
122
* interface ProductsState {
121
123
* products: Product[];
122
124
* selectedId: string | null;
@@ -127,8 +129,7 @@ export function createFeature<
127
129
* selectedId: null,
128
130
* };
129
131
*
130
- * // AppState is passed as a generic argument
131
- * const productsFeature = createFeature<AppState>({
132
+ * const productsFeature = createFeature({
132
133
* name: 'products',
133
134
* reducer: createReducer(
134
135
* initialState,
@@ -140,24 +141,13 @@ export function createFeature<
140
141
* });
141
142
*
142
143
* const {
143
- * selectProductsState, // type: MemoizedSelector<AppState, ProductsState>
144
- * selectProducts, // type: MemoizedSelector<AppState, Product[]>
145
- * selectSelectedId, // type: MemoizedSelector<AppState, string | null>
146
- * } = productsFeature;
147
- * ```
148
- *
149
- * **Without Application State**
150
- *
151
- * ```ts
152
- * const productsFeature = createFeature({
153
- * name: 'products',
154
- * reducer: createReducer(initialState),
155
- * });
156
- *
157
- * const {
144
+ * name,
145
+ * reducer,
146
+ * // feature selector
158
147
* selectProductsState, // type: MemoizedSelector<Record<string, any>, ProductsState>
148
+ * // feature state properties selectors
159
149
* selectProducts, // type: MemoizedSelector<Record<string, any>, Product[]>
160
- * selectSelectedId, // type: MemoizedSelector<Record<string, any, string | null>
150
+ * selectSelectedId, // type: MemoizedSelector<Record<string, any> , string | null>
161
151
* } = productsFeature;
162
152
* ```
163
153
*
0 commit comments