Skip to content

Commit

Permalink
Add test for nested selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
aikoven committed Mar 30, 2017
1 parent 1d6b934 commit 30bf21a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions typescript_test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,32 @@ function testSelector() {
);
}

function testNestedSelector() {
type State = {foo: string, bar: number, baz: boolean};

const selector = createSelector(
createSelector(
(state: State) => state.foo,
(state: State) => state.bar,
(foo, bar) => ({foo, bar}),
),
(state: State) => state.baz,
({foo, bar}, baz) => {
const foo1: string = foo;
// typings:expect-error
const foo2: number = foo;

const bar1: number = bar;
// typings:expect-error
const bar2: string = bar;

const baz1: boolean = baz;
// typings:expect-error
const baz2: string = baz;
},
)
}

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

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

0 comments on commit 30bf21a

Please sign in to comment.