Skip to content

Commit

Permalink
Add test for using output selector as combiner
Browse files Browse the repository at this point in the history
  • Loading branch information
aikoven committed Apr 12, 2017
1 parent 56c1856 commit b0f1565
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions typescript_test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,29 @@ function testNestedSelector() {
)
}

function testSelectorAsCombiner() {
type SubState = {foo: string};
type State = {bar: SubState};

const subSelector = createSelector(
(state: SubState) => state.foo,
foo => foo,
);

const selector = createSelector(
(state: State) => state.bar,
subSelector,
);

// typings:expect-error
selector({foo: ''});

// typings:expect-error
const n: number = selector({bar: {foo: ''}});

const s: string = selector({bar: {foo: ''}});
}

type Component<P> = (props: P) => any;

declare function connect<S, P, R>(selector: ParametricSelector<S, P, R>):
Expand Down

0 comments on commit b0f1565

Please sign in to comment.