Skip to content

Commit e86c5f6

Browse files
timdeschryverbrandonroberts
authored andcommitted
fix(store): deprecate signature for selector with only a projector (#1580)
1 parent 5fbcb3c commit e86c5f6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

modules/store/src/selector.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,27 @@ export function createSelector<
472472
) => Result
473473
): MemoizedSelectorWithProps<State, Props, Result>;
474474

475+
/**
476+
* @deprecated
477+
* Selectors with only a projector function aren't valid anymore and will be removed in version 8.0.0
478+
*
479+
* BEFORE:
480+
*
481+
* ```ts
482+
* const getTodosById = createSelector(
483+
* (state: TodoAppSchema, id: number) => state.todos.find(p => p.id === id)
484+
* );
485+
* ```
486+
*
487+
* AFTER:
488+
*
489+
* ```ts
490+
* const getTodosById = createSelector(
491+
* (state: TodoAppSchema) => state.todos,
492+
* (todos: Todo[], id: number) => todos.find(p => p.id === id)
493+
* );
494+
* ```
495+
*/
475496
export function createSelector<State, Props, Result>(
476497
projector: SelectorWithProps<State, Props, Result>
477498
): MemoizedSelectorWithProps<State, Props, Result>;

0 commit comments

Comments
 (0)