Skip to content

Commit

Permalink
fix(combine): fix CombineFactorySignature
Browse files Browse the repository at this point in the history
Was lacking some important pieces.

For issue #28.
  • Loading branch information
staltz committed Apr 30, 2016
1 parent ff76cf9 commit c65bd0b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,22 @@ export interface CombineProjectFunction {
export interface CombineFactorySignature {
<T1, T2, R>(
project: (t1: T1, t2: T2) => R,
stream1: Stream<T1>,
stream2: Stream<T2>): Stream<R>;
<T1, T2, T3, R>(
project: (t1: T1, t2: T2, t3: T3) => R,
stream1: Stream<T1>,
stream2: Stream<T2>,
stream3: Stream<T3>): Stream<R>;
<T1, T2, T3, T4, R>(
project: (t1: T1, t2: T2, t3: T3, t4: T4) => R,
stream1: Stream<T1>,
stream2: Stream<T2>,
stream3: Stream<T3>,
stream4: Stream<T4>): Stream<R>;
<T1, T2, T3, T4, T5, R>(
project: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R,
stream1: Stream<T1>,
stream2: Stream<T2>,
stream3: Stream<T3>,
stream4: Stream<T4>,
Expand Down
18 changes: 18 additions & 0 deletions tests/factory/combine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ describe('xs.combine', () => {
});
});

it('should have correct TypeScript signature', (done) => {
const stream1 = xs.create<string>({
start: listener => {},
stop: () => {}
});

const stream2 = xs.create<string>({
start: listener => {},
stop: () => {}
});

const combined = xs.combine(
(a, b) => a.slice(2) + b.slice(2),
stream1, stream2
);
done();
});

it('should complete only when all member streams have completed', (done) => {
const stream1 = xs.periodic(30).take(1);
const stream2 = xs.periodic(50).take(4);
Expand Down

0 comments on commit c65bd0b

Please sign in to comment.