Skip to content

Commit

Permalink
fix(store): deprecate signature for selector with only a projector (n…
Browse files Browse the repository at this point in the history
  • Loading branch information
timdeschryver authored and tja4472 committed Mar 20, 2019
1 parent a4dfbbe commit ab16a15
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions modules/store/src/selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,27 @@ export function createSelector<
) => Result
): MemoizedSelectorWithProps<State, Props, Result>;

/**
* @deprecated
* Selectors with only a projector function aren't valid anymore and will be removed in version 8.0.0
*
* BEFORE:
*
* ```ts
* const getTodosById = createSelector(
* (state: TodoAppSchema, id: number) => state.todos.find(p => p.id === id)
* );
* ```
*
* AFTER:
*
* ```ts
* const getTodosById = createSelector(
* (state: TodoAppSchema) => state.todos,
* (todos: Todo[], id: number) => todos.find(p => p.id === id)
* );
* ```
*/
export function createSelector<State, Props, Result>(
projector: SelectorWithProps<State, Props, Result>
): MemoizedSelectorWithProps<State, Props, Result>;
Expand Down

0 comments on commit ab16a15

Please sign in to comment.