Skip to content

Commit

Permalink
feat(store): capture the type of a selector projector function (#1920)
Browse files Browse the repository at this point in the history
Closes #1908
  • Loading branch information
jasonhodges authored and brandonroberts committed Jun 6, 2019
1 parent d81ddeb commit 4e39cc1
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions modules/store/src/selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,26 @@ export type MemoizeFn = (t: AnyFn) => MemoizedProjection;

export type ComparatorFn = (a: any, b: any) => boolean;

export interface MemoizedSelector<State, Result>
extends Selector<State, Result> {
export type DefaultProjectorFn<T> = (...args: any[]) => T;

export interface MemoizedSelector<
State,
Result,
ProjectorFn = DefaultProjectorFn<Result>
> extends Selector<State, Result> {
release(): void;
projector: AnyFn;
projector: ProjectorFn;
setResult: (result?: Result) => void;
}

export interface MemoizedSelectorWithProps<State, Props, Result>
extends SelectorWithProps<State, Props, Result> {
export interface MemoizedSelectorWithProps<
State,
Props,
Result,
ProjectorFn = DefaultProjectorFn<Result>
> extends SelectorWithProps<State, Props, Result> {
release(): void;
projector: AnyFn;
projector: ProjectorFn;
setResult: (result?: Result) => void;
}

Expand Down

0 comments on commit 4e39cc1

Please sign in to comment.