Skip to content

Commit

Permalink
refactor(selectors) Capture the type of a selectors projector
Browse files Browse the repository at this point in the history
- supply a default projector type to MemoizedSelector
  • Loading branch information
jasonhodges authored and Jason Hodges committed Jun 4, 2019
1 parent 11a9819 commit 9c16e2c
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 9c16e2c

Please sign in to comment.