diff --git a/package.json b/package.json index aa9dfa3..1ed85fc 100644 --- a/package.json +++ b/package.json @@ -63,11 +63,11 @@ "most": "^1.0.3", "sinon": "^1.16.0", "strip-comments": "^0.4.4", - "ts-node": "^0.9.0", - "tsify": "^2.0.3", - "tslint": "^3.6.0", - "typescript": "^2.0.3", - "typings": "^1.4.0", + "ts-node": "1.7.2", + "tsify": "2.0.3", + "tslint": "4.0.2", + "typescript": "2.1.4", + "typings": "2.0.0", "uglify-js": "^2.6.2", "validate-commit-msg": "^2.4.0" }, diff --git a/src/core.ts b/src/core.ts index 14ebd32..aac522f 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1,4 +1,3 @@ -import {Promise} from 'es6-promise'; import $$observable from 'symbol-observable'; const NO = {}; @@ -57,28 +56,21 @@ export interface Listener { complete: () => void; } -export interface PartialListener { - next?: (x: T) => void; - error?: (err: any) => void; - complete?: () => void; -} - export type Observable = { subscribe(listener: Listener): { unsubscribe: () => void; } -} +}; export type FromInput = Promise | Stream | Array | Observable; // mutates the input -function internalizeProducer(producer: Producer) { - (producer as InternalProducer & Producer)._start = - function _start(il: InternalListener) { - (il as InternalListener & Listener).next = il._n; - (il as InternalListener & Listener).error = il._e; - (il as InternalListener & Listener).complete = il._c; - this.start(il as InternalListener & Listener); - }; - (producer as InternalProducer & Producer)._stop = producer.stop; +function internalizeProducer(producer: Producer & Partial>) { + producer._start = function _start(il: InternalListener & Partial>) { + il.next = il._n; + il.error = il._e; + il.complete = il._c; + this.start(il); + }; + producer._stop = producer.stop; } function and(f1: (t: T) => boolean, f2: (t: T) => boolean): (t: T) => boolean { @@ -604,7 +596,7 @@ class OtherIL implements InternalListener { this.op = op; } - _n(t: T) { + _n() { this.op.end(); } @@ -1339,11 +1331,11 @@ export class Stream implements InternalListener { * * @param {Listener} listener */ - addListener(listener: PartialListener): void { - (listener as InternalListener & Listener)._n = listener.next || noop; - (listener as InternalListener & Listener)._e = listener.error || noop; - (listener as InternalListener & Listener)._c = listener.complete || noop; - this._add(listener as InternalListener & Listener); + addListener(listener: Partial & InternalListener>): void { + listener._n = listener.next || noop; + listener._e = listener.error || noop; + listener._c = listener.complete || noop; + this._add(listener as InternalListener); } /** @@ -1351,8 +1343,8 @@ export class Stream implements InternalListener { * * @param {Listener} listener */ - removeListener(listener: Listener): void { - this._remove(listener as InternalListener & Listener); + removeListener(listener: Partial & InternalListener>): void { + this._remove(listener as InternalListener); } /** @@ -1385,7 +1377,7 @@ export class Stream implements InternalListener { * start, generate events, and stop the Stream. * @return {Stream} */ - static create(producer?: Producer): Stream { + static create(producer?: Producer & Partial>): Stream { if (producer) { if (typeof producer.start !== 'function' || typeof producer.stop !== 'function') { @@ -1393,7 +1385,7 @@ export class Stream implements InternalListener { } internalizeProducer(producer); // mutates the input } - return new Stream(producer as InternalProducer & Producer); + return new Stream(producer as InternalProducer); } /** @@ -1404,11 +1396,11 @@ export class Stream implements InternalListener { * start, generate events, and stop the Stream. * @return {MemoryStream} */ - static createWithMemory(producer?: Producer): MemoryStream { + static createWithMemory(producer?: Producer & Partial>): MemoryStream { if (producer) { internalizeProducer(producer); // mutates the input } - return new MemoryStream(producer as InternalProducer & Producer); + return new MemoryStream(producer as InternalProducer); } /** @@ -2129,16 +2121,16 @@ export class Stream implements InternalListener { * * @param {Listener} listener */ - setDebugListener(listener: Listener) { + setDebugListener(listener: Partial & InternalListener> | null | undefined) { if (!listener) { this._d = false; this._dl = NO as InternalListener; } else { this._d = true; - (listener as InternalListener & Listener)._n = listener.next; - (listener as InternalListener & Listener)._e = listener.error; - (listener as InternalListener & Listener)._c = listener.complete; - this._dl = listener as InternalListener & Listener; + listener._n = listener.next || noop; + listener._e = listener.error || noop; + listener._c = listener.complete || noop; + this._dl = listener as InternalListener; } } } diff --git a/src/extra/dropRepeats.ts b/src/extra/dropRepeats.ts index 38a33b3..0b4da84 100644 --- a/src/extra/dropRepeats.ts +++ b/src/extra/dropRepeats.ts @@ -112,7 +112,7 @@ export class DropRepeatsOperator implements Operator { * checks if it is equal to previous event, by returning a boolean. * @return {Stream} */ -export default function dropRepeats(isEqual: ((x: T, y: T) => boolean) | undefined = void 0): (ins: Stream) => Stream { +export default function dropRepeats(isEqual: ((x: T, y: T) => boolean) | undefined = void 0): (ins: Stream) => Stream { return function dropRepeatsOperator(ins: Stream): Stream { return new Stream(new DropRepeatsOperator(ins, isEqual)); }; diff --git a/src/extra/tween.ts b/src/extra/tween.ts index 2a89a44..3b44304 100644 --- a/src/extra/tween.ts +++ b/src/extra/tween.ts @@ -6,7 +6,7 @@ export type Easings = { easeIn: Ease; easeOut: Ease; easeInOut: Ease; -} +}; export type NumericFunction = (input: number) => number; diff --git a/src/index.ts b/src/index.ts index cb7423d..1f81322 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,6 @@ import { Stream, MemoryStream, Listener, - PartialListener, Producer, Operator, Observable, @@ -11,7 +10,6 @@ export { Stream, MemoryStream, Listener, - PartialListener, Producer, Operator, Observable, diff --git a/tests/extra/concat.ts b/tests/extra/concat.ts index a64fd90..18d5748 100644 --- a/tests/extra/concat.ts +++ b/tests/extra/concat.ts @@ -5,7 +5,7 @@ import concat from '../../src/extra/concat'; import * as assert from 'assert'; describe('concat (extra)', () => { - it('should concatenate two synchronous short streams together', (done) => { + it('should concatenate two synchronous short streams together', (done: any) => { const stream1 = xs.of(1, 2, 3); const stream2 = xs.of(40, 50, 60, 70); const stream3 = xs.of(8, 9); @@ -24,7 +24,7 @@ describe('concat (extra)', () => { }); }); - it('should concatenate two asynchronous short streams together', (done) => { + it('should concatenate two asynchronous short streams together', (done: any) => { const stream1 = xs.periodic(50).take(3); const stream2 = xs.periodic(100).take(2); const stream = concat(stream1, stream2); @@ -42,7 +42,7 @@ describe('concat (extra)', () => { }); }); - it('should append a synchronous stream after an asynchronous stream', (done) => { + it('should append a synchronous stream after an asynchronous stream', (done: any) => { const stream1 = xs.periodic(50).take(3); const stream2 = xs.of(30, 40, 50, 60); const stream = concat(stream1, stream2); diff --git a/tests/extra/debounce.ts b/tests/extra/debounce.ts index 19d96bb..0075af2 100644 --- a/tests/extra/debounce.ts +++ b/tests/extra/debounce.ts @@ -5,7 +5,7 @@ import debounce from '../../src/extra/debounce'; import * as assert from 'assert'; describe('debounce (extra)', () => { - it('should delay events until a period of silence has passed', (done) => { + it('should delay events until a period of silence has passed', (done: any) => { const producer: Producer = { start(out: Listener) { out.next(1); diff --git a/tests/extra/delay.ts b/tests/extra/delay.ts index f60f5ba..1fbc1e9 100644 --- a/tests/extra/delay.ts +++ b/tests/extra/delay.ts @@ -5,7 +5,7 @@ import delay from '../../src/extra/delay'; import * as assert from 'assert'; describe('delay (extra)', () => { - it('should delay periodic events by a given time period', (done) => { + it('should delay periodic events by a given time period', (done: any) => { const stream = xs.periodic(100).take(3).compose(delay(200)); const expected = [0, 1, 2]; let completeCalled = false; @@ -28,7 +28,7 @@ describe('delay (extra)', () => { }, 550); }); - it('should delay synchronous events by a given time period', (done) => { + it('should delay synchronous events by a given time period', (done: any) => { const stream = xs.of(10, 20, 30).compose(delay(100)); const expected = [10, 20, 30]; let completeCalled = false; diff --git a/tests/extra/dropRepeats.ts b/tests/extra/dropRepeats.ts index 74ba494..6244e53 100644 --- a/tests/extra/dropRepeats.ts +++ b/tests/extra/dropRepeats.ts @@ -6,7 +6,7 @@ import dropRepeats from '../../src/extra/dropRepeats'; import * as assert from 'assert'; describe('dropRepeats (extra)', () => { - it('should drop consecutive duplicate numbers (as events)', (done) => { + it('should drop consecutive duplicate numbers (as events)', (done: any) => { const stream = xs.of(1, 2, 1, 1, 1, 2, 3, 4, 3, 3).compose(dropRepeats()); const expected = [1, 2, 1, 2, 3, 4, 3]; @@ -22,7 +22,7 @@ describe('dropRepeats (extra)', () => { }); }); - it('should drop consecutive \'duplicate\' strings, with a custom isEqual', (done) => { + it('should drop consecutive \'duplicate\' strings, with a custom isEqual', (done: any) => { const stream = xs.of('a', 'b', 'a', 'A', 'B', 'b') .compose(dropRepeats((x: string, y: string) => x.toLowerCase() === y.toLowerCase())); const expected = ['a', 'b', 'a', 'B']; @@ -39,9 +39,9 @@ describe('dropRepeats (extra)', () => { }); }); - it('should drop consecutive duplicate numbers, with a circular stream dependency', (done) => { + it('should drop consecutive duplicate numbers, with a circular stream dependency', (done: any) => { const streamProxy = xs.create(); - const input = xs.of(0, 0, 1, 1, 1) + const input = xs.of(0, 0, 1, 1, 1); const stream = xs.merge(streamProxy, input).compose(dropRepeats()); streamProxy.imitate(stream); const expected = [0, 1]; @@ -64,7 +64,7 @@ describe('dropRepeats (extra)', () => { }); }); - it('should support dropping duplicates of combine arrays', (done) => { + it('should support dropping duplicates of combine arrays', (done: any) => { const A: Stream = fromDiagram('---a---b------b------|'); const B: Stream = fromDiagram('-x---y---y------z--y-|'); const stream = xs.combine(A, B).compose( diff --git a/tests/extra/dropUntil.ts b/tests/extra/dropUntil.ts index 686b182..8b3e9f9 100644 --- a/tests/extra/dropUntil.ts +++ b/tests/extra/dropUntil.ts @@ -6,7 +6,7 @@ import delay from '../../src/extra/delay'; import * as assert from 'assert'; describe('dropUntil (extra)', () => { - it('should start emitting the stream when another stream emits next', (done) => { + it('should start emitting the stream when another stream emits next', (done: any) => { const source = xs.periodic(50).take(6); const other = xs.periodic(220).take(1); const stream = source.compose(dropUntil(other)); @@ -24,7 +24,7 @@ describe('dropUntil (extra)', () => { }); }); - it('should complete the stream when another stream emits complete', (done) => { + it('should complete the stream when another stream emits complete', (done: any) => { const source = xs.periodic(50).take(6); const other = xs.empty().compose(delay(220)); const stream = source.compose(dropUntil(other)); diff --git a/tests/extra/flattenConcurrently.ts b/tests/extra/flattenConcurrently.ts index a0bab46..f0cf7a6 100644 --- a/tests/extra/flattenConcurrently.ts +++ b/tests/extra/flattenConcurrently.ts @@ -6,7 +6,7 @@ import * as assert from 'assert'; describe('flattenConcurrently (extra)', () => { describe('with map', () => { - it('should expand each periodic event with 3 sync events', (done) => { + it('should expand each periodic event with 3 sync events', (done: any) => { const stream = xs.periodic(100).take(3) .map(i => xs.of(1 + i, 2 + i, 3 + i)) .compose(flattenConcurrently); @@ -24,7 +24,7 @@ describe('flattenConcurrently (extra)', () => { }); }); - it('should return a flat stream with correct TypeScript types', (done) => { + it('should return a flat stream with correct TypeScript types', (done: any) => { const streamStrings: Stream = Stream.create({ start: (listener: Listener) => {}, stop: () => {} @@ -41,7 +41,7 @@ describe('flattenConcurrently (extra)', () => { done(); }); - it('should expand 3 sync events as a periodic each', (done) => { + it('should expand 3 sync events as a periodic each', (done: any) => { const stream = xs.of(0, 1, 2) .map(i => xs.periodic(100 * (i + 1) + 10 * i).take(2).map(x => `${i}${x}`)) .compose(flattenConcurrently); @@ -63,7 +63,7 @@ describe('flattenConcurrently (extra)', () => { }); }); - it('should expand 3 async events as a periodic each', (done) => { + it('should expand 3 async events as a periodic each', (done: any) => { const stream = xs.periodic(140).take(3) .map(i => xs.periodic(100 * (i < 2 ? 1 : i)).take(3).map(x => `${i}${x}`) @@ -87,7 +87,7 @@ describe('flattenConcurrently (extra)', () => { }); }); - it('should expand 3 async events as a periodic each, no optimization', (done) => { + it('should expand 3 async events as a periodic each, no optimization', (done: any) => { const stream = xs.periodic(140).take(3) .map(i => xs.periodic(100 * (i < 2 ? 1 : i)).take(3).map(x => `${i}${x}`) @@ -113,7 +113,7 @@ describe('flattenConcurrently (extra)', () => { }); }); - it('should propagate user mistakes in project as errors', (done) => { + it('should propagate user mistakes in project as errors', (done: any) => { const source = xs.periodic(30).take(1); const stream = source.map( x => { @@ -136,7 +136,7 @@ describe('flattenConcurrently (extra)', () => { }); describe('with filter+map fusion', () => { - it('should execute the predicate, the projection, and the flattening', (done) => { + it('should execute the predicate, the projection, and the flattening', (done: any) => { let predicateCallCount = 0; let projectCallCount = 0; diff --git a/tests/extra/flattenSequentially.ts b/tests/extra/flattenSequentially.ts index afb6e66..52a537a 100644 --- a/tests/extra/flattenSequentially.ts +++ b/tests/extra/flattenSequentially.ts @@ -6,7 +6,7 @@ import * as assert from 'assert'; describe('flattenSequentially (extra)', () => { describe('with map', () => { - it('should expand each periodic event with 3 sync events', (done) => { + it('should expand each periodic event with 3 sync events', (done: any) => { const stream = xs.periodic(100).take(3) .map(i => xs.of(1 + i, 2 + i, 3 + i)) .compose(flattenSequentially); @@ -24,7 +24,7 @@ describe('flattenSequentially (extra)', () => { stream.addListener(listener); }); - it('should expand each sync event as a periodic stream and concatenate', (done) => { + it('should expand each sync event as a periodic stream and concatenate', (done: any) => { const stream = xs.of(1, 2, 3) .map(i => xs.periodic(100).take(3).map(x => `${i}${x}`)) .compose(flattenSequentially); @@ -42,7 +42,7 @@ describe('flattenSequentially (extra)', () => { stream.addListener(listener); }); - it('should expand 3 sync events as a periodic each', (done) => { + it('should expand 3 sync events as a periodic each', (done: any) => { const stream = xs.of(1, 2, 3) .map(i => xs.periodic(100 * i).take(2).map(x => `${i}${x}`)) .compose(flattenSequentially); @@ -64,7 +64,7 @@ describe('flattenSequentially (extra)', () => { stream.addListener(listener); }); - it('should expand 3 async events as a periodic each', (done) => { + it('should expand 3 async events as a periodic each', (done: any) => { const stream = xs.periodic(140).take(3) .map(i => xs.periodic(100 * (i < 2 ? 1 : i)).take(3).map(x => `${i}${x}`) @@ -87,7 +87,7 @@ describe('flattenSequentially (extra)', () => { }); }); - it('should expand 3 async events as a periodic each, no optimization', (done) => { + it('should expand 3 async events as a periodic each, no optimization', (done: any) => { const stream = xs.periodic(140).take(3) .map(i => xs.periodic(100 * (i < 2 ? 1 : i)).take(3).map(x => `${i}${x}`) @@ -113,7 +113,7 @@ describe('flattenSequentially (extra)', () => { stream.addListener(listener); }); - it('should propagate user mistakes in project as errors', (done) => { + it('should propagate user mistakes in project as errors', (done: any) => { const source = xs.periodic(30).take(1); const stream = source.map( x => { @@ -134,7 +134,7 @@ describe('flattenSequentially (extra)', () => { }); }); - it('should emit data from inner streams after synchronous outer completes', (done) => { + it('should emit data from inner streams after synchronous outer completes', (done: any) => { const outer = xs.of(42); const stream = outer.map(i => xs.periodic(50).take(2).mapTo(i)) .compose(flattenSequentially); @@ -152,7 +152,7 @@ describe('flattenSequentially (extra)', () => { }); }); - it('should stop inner emissions if result stops', (done) => { + it('should stop inner emissions if result stops', (done: any) => { const expectedInner = [0, 1]; const stream = xs.of(1) diff --git a/tests/extra/fromDiagram.ts b/tests/extra/fromDiagram.ts index 7fd4c7d..79c6988 100644 --- a/tests/extra/fromDiagram.ts +++ b/tests/extra/fromDiagram.ts @@ -5,7 +5,7 @@ import fromDiagram from '../../src/extra/fromDiagram'; import * as assert from 'assert'; describe('fromDiagram (extra)', () => { - it('should create a nice finite stream with string values', (done) => { + it('should create a nice finite stream with string values', (done: any) => { const stream = fromDiagram('--a--b----c----d---|') const expected = ['a', 'b', 'c', 'd']; @@ -21,7 +21,7 @@ describe('fromDiagram (extra)', () => { }); }); - it('should create a stream that emits an error', (done) => { + it('should create a stream that emits an error', (done: any) => { const stream = fromDiagram('--a--b----c----d---#') const expected = ['a', 'b', 'c', 'd']; @@ -37,7 +37,7 @@ describe('fromDiagram (extra)', () => { }); }); - it('should create a stream using strings as keys for values', (done) => { + it('should create a stream using strings as keys for values', (done: any) => { const stream = fromDiagram('--a--b----c--|', { values: {a: 10, b: 20, c: 30} }); @@ -55,7 +55,7 @@ describe('fromDiagram (extra)', () => { }); }); - it('should support 0 as a value behind a key in the values object', (done) => { + it('should support 0 as a value behind a key in the values object', (done: any) => { const stream = fromDiagram('--a--b----c--|', { values: {a: 0, b: 1, c: 2} }); @@ -73,7 +73,7 @@ describe('fromDiagram (extra)', () => { }); }); - it('should support null as a value behind a key in the values object', (done) => { + it('should support null as a value behind a key in the values object', (done: any) => { const stream = fromDiagram('--a--b----c--|', { values: {a: null, b: 1, c: 2} }); @@ -91,7 +91,7 @@ describe('fromDiagram (extra)', () => { }); }); - it('should create a stream with some sense of order', (done) => { + it('should create a stream with some sense of order', (done: any) => { const stream1 = fromDiagram('-a---c--|'); const stream2 = fromDiagram('---b---d|'); const stream = xs.merge(stream1, stream2); @@ -109,7 +109,7 @@ describe('fromDiagram (extra)', () => { }); }); - it('should create an infinite stream some sense of order', (done) => { + it('should create an infinite stream some sense of order', (done: any) => { const stream1 = fromDiagram('-a---c---'); const stream2 = fromDiagram('---b---d-'); const stream = xs.merge(stream1, stream2); diff --git a/tests/extra/fromEvent.ts b/tests/extra/fromEvent.ts index 0251038..73e38e5 100644 --- a/tests/extra/fromEvent.ts +++ b/tests/extra/fromEvent.ts @@ -90,7 +90,7 @@ describe('fromEvent (extra) - DOMEvent', () => { assert.strictEqual(target.capture, false); }); - it('should propagate events', (done) => { + it('should propagate events', (done: any) => { const target = new FakeEventTarget(); const stream = fromEvent(target, 'test').take(3); @@ -113,7 +113,7 @@ describe('fromEvent (extra) - DOMEvent', () => { target.emit(4); }); - it('should call removeEventListener with expected parameters', (done) => { + it('should call removeEventListener with expected parameters', (done: any) => { const target = new FakeEventTarget(); const stream = fromEvent(target, 'test', true); @@ -144,7 +144,7 @@ describe('fromEvent (extra) - EventEmitter', () => { assert.strictEqual(target.event, 'test'); }); - it('should propagate events', (done) => { + it('should propagate events', (done: any) => { const target = new FakeEventEmitter(); const stream = fromEvent(target, 'test').take(3); @@ -167,7 +167,7 @@ describe('fromEvent (extra) - EventEmitter', () => { target.emit( 'test', 4 ); }); - it('should call removeListener with expected parameters', (done) => { + it('should call removeListener with expected parameters', (done: any) => { const target = new FakeEventEmitter(); const stream = fromEvent(target, 'test'); @@ -186,7 +186,7 @@ describe('fromEvent (extra) - EventEmitter', () => { target.emit( 'test', 2 ); }); - it('should aggregate arguments from emitters', (done) => { + it('should aggregate arguments from emitters', (done: any) => { const target = new FakeEventEmitter(); const stream = fromEvent(target, 'test').take(2); diff --git a/tests/extra/pairwise.ts b/tests/extra/pairwise.ts index 8f6879d..389249c 100644 --- a/tests/extra/pairwise.ts +++ b/tests/extra/pairwise.ts @@ -5,7 +5,7 @@ import pairwise from '../../src/extra/pairwise'; import * as assert from 'assert'; describe('pairwise (extra)', () => { - it('should group consecutive pairs as arrays', (done) => { + it('should group consecutive pairs as arrays', (done: any) => { const stream = xs.of(1, 2, 3, 4, 5, 6).compose(pairwise); const expected = [ [1, 2], diff --git a/tests/extra/sampleCombine.ts b/tests/extra/sampleCombine.ts index 338d8c6..4068721 100644 --- a/tests/extra/sampleCombine.ts +++ b/tests/extra/sampleCombine.ts @@ -5,7 +5,7 @@ import sampleCombine from '../../src/extra/sampleCombine'; import * as assert from 'assert'; describe('sampleCombine (extra)', () => { - it('should combine AND-style two streams together', (done) => { + it('should combine AND-style two streams together', (done: any) => { const stream1 = xs.periodic(100).take(3).startWith(-1); const stream2 = xs.periodic(99).take(3); const stream = stream1.compose(sampleCombine(stream2)); @@ -28,7 +28,7 @@ describe('sampleCombine (extra)', () => { }); }); - it('should have correct TypeScript signature', (done) => { + it('should have correct TypeScript signature', (done: any) => { const stream1 = xs.create({ start: listener => {}, stop: () => {} @@ -44,7 +44,7 @@ describe('sampleCombine (extra)', () => { done(); }); - it('should complete only when the sample stream has completed', (done) => { + it('should complete only when the sample stream has completed', (done: any) => { const stream1 = xs.periodic(100).take(4); const stream2 = xs.periodic(99).take(1); const stream = stream1.compose(sampleCombine(stream2)).map(arr => arr.join('')); @@ -61,7 +61,7 @@ describe('sampleCombine (extra)', () => { }); }); - it('should not pick values from sampled streams before they have emitted', (done) => { + it('should not pick values from sampled streams before they have emitted', (done: any) => { const stream1 = xs.periodic(100).take(4); const stream2 = xs.periodic(150).take(1); const stream = stream1.compose(sampleCombine(stream2)).map(arr => arr.join('')); @@ -78,7 +78,7 @@ describe('sampleCombine (extra)', () => { }); }); - it('should just wrap the value if combining one stream', (done) => { + it('should just wrap the value if combining one stream', (done: any) => { const source = xs.periodic(100).take(3); const stream = source.compose(sampleCombine()); let expected = [[0], [1], [2]]; @@ -100,7 +100,7 @@ describe('sampleCombine (extra)', () => { }); }); - it('should not break future listeners when SampleCombineProducer tears down', (done) => { + it('should not break future listeners when SampleCombineProducer tears down', (done: any) => { // --0---1----2-| innerA // ----0-----1--| innerB // ----a-----b--c---| outer @@ -157,7 +157,7 @@ describe('sampleCombine (extra)', () => { }); }); - it('should return a Stream when combining a MemoryStream with a Stream', (done) => { + it('should return a Stream when combining a MemoryStream with a Stream', (done: any) => { const input1 = xs.periodic(80).take(4).remember(); const input2 = xs.periodic(50).take(3); const stream: Stream<[number, number]> = input1.compose(sampleCombine(input2)); @@ -165,7 +165,7 @@ describe('sampleCombine (extra)', () => { done(); }); - it('should return a Stream when combining a MemoryStream with a MemoryStream', (done) => { + it('should return a Stream when combining a MemoryStream with a MemoryStream', (done: any) => { const input1 = xs.periodic(80).take(4).remember(); const input2 = xs.periodic(50).take(3).remember(); const stream: Stream<[number, number]> = input1.compose(sampleCombine(input2)); diff --git a/tests/extra/split.ts b/tests/extra/split.ts index 2b2c59c..45e6046 100644 --- a/tests/extra/split.ts +++ b/tests/extra/split.ts @@ -6,7 +6,7 @@ import concat from '../../src/extra/concat'; import * as assert from 'assert'; describe('split (extra)', () => { - it('should split a stream using a separator stream', (done) => { + it('should split a stream using a separator stream', (done: any) => { const source = xs.periodic(50).take(10); const separator = concat(xs.periodic(167).take(2), xs.never()); const stream = source.compose(split(separator)); @@ -45,7 +45,7 @@ describe('split (extra)', () => { }); }); - it('should be canceled out if flattened immediately after', (done) => { + it('should be canceled out if flattened immediately after', (done: any) => { const source = xs.periodic(50).take(10); const separator = concat(xs.periodic(167).take(2), xs.never()); const stream = source.compose(split(separator)).flatten(); @@ -63,7 +63,7 @@ describe('split (extra)', () => { }); }); - it('should complete when the separator completes', (done) => { + it('should complete when the separator completes', (done: any) => { const source = xs.periodic(50).take(10); const separator = xs.periodic(167).take(2); const stream = source.compose(split(separator)).flatten(); diff --git a/tests/extra/throttle.ts b/tests/extra/throttle.ts index 23e1eb7..85f0957 100644 --- a/tests/extra/throttle.ts +++ b/tests/extra/throttle.ts @@ -5,7 +5,7 @@ import throttle from '../../src/extra/throttle'; import * as assert from 'assert'; describe('throttle (extra)', () => { - it('should emit event and drop subsequent events until a period of silence has passed', (done) => { + it('should emit event and drop subsequent events until a period of silence has passed', (done: any) => { const producer: Producer = { start(out: Listener) { out.next(1); diff --git a/tests/extra/tween.ts b/tests/extra/tween.ts index 8dfb1e8..fe7ebf5 100644 --- a/tests/extra/tween.ts +++ b/tests/extra/tween.ts @@ -75,7 +75,7 @@ function makeAssertPlot(done: MochaDone, assert: any, expected: string) { } describe('tween (extra)', () => { - it('should do linear tweening', (done) => { + it('should do linear tweening', (done: any) => { let position$ = tween({ ease: tween.linear.ease, from: plotTweenConfigs.from, @@ -108,7 +108,7 @@ describe('tween (extra)', () => { +---------------------`)); }); - it('should do power of 2 easing (ease in)', (done) => { + it('should do power of 2 easing (ease in)', (done: any) => { let position$ = tween({ ease: tween.power2.easeIn, from: plotTweenConfigs.from, @@ -141,7 +141,7 @@ describe('tween (extra)', () => { +---------------------`)); }); - it("should do power of 3 easing (ease in)", function (done) { + it("should do power of 3 easing (ease in)", function (done: any) { let position$ = tween({ ease: tween.power3.easeIn, from: plotTweenConfigs.from, @@ -174,7 +174,7 @@ describe('tween (extra)', () => { +---------------------`)); }); - it("should do power of 4 easing (ease in)", function (done) { + it("should do power of 4 easing (ease in)", function (done: any) { let position$ = tween({ ease: tween.power4.easeIn, from: plotTweenConfigs.from, @@ -207,7 +207,7 @@ describe('tween (extra)', () => { +---------------------`)); }); - it("should do exponential easing (ease in)", function (done) { + it("should do exponential easing (ease in)", function (done: any) { let position$ = tween({ ease: tween.exponential.easeIn, from: plotTweenConfigs.from, @@ -240,7 +240,7 @@ describe('tween (extra)', () => { +---------------------`)); }); - it("should do back easing (ease in)", function (done) { + it("should do back easing (ease in)", function (done: any) { let position$ = tween({ ease: tween.back.easeIn, from: plotTweenConfigs.from, @@ -273,7 +273,7 @@ describe('tween (extra)', () => { +---------------------`)); }); - it("should do bounce easing (ease in)", function (done) { + it("should do bounce easing (ease in)", function (done: any) { let position$ = tween({ ease: tween.bounce.easeIn, from: plotTweenConfigs.from, @@ -306,7 +306,7 @@ describe('tween (extra)', () => { +---------------------`)); }); - it("should do circular easing (ease in)", function (done) { + it("should do circular easing (ease in)", function (done: any) { let position$ = tween({ ease: tween.circular.easeIn, from: plotTweenConfigs.from, @@ -339,7 +339,7 @@ describe('tween (extra)', () => { +---------------------`)); }); - it("should do elastic easing (ease in)", function (done) { + it("should do elastic easing (ease in)", function (done: any) { let position$ = tween({ ease: tween.elastic.easeIn, from: plotTweenConfigs.from, @@ -372,7 +372,7 @@ describe('tween (extra)', () => { +---------------------`)); }); - it("should do sine easing (ease in)", function (done) { + it("should do sine easing (ease in)", function (done: any) { let position$ = tween({ ease: tween.sine.easeIn, from: plotTweenConfigs.from, diff --git a/tests/factory/combine.ts b/tests/factory/combine.ts index 25bb1cd..6c83c27 100644 --- a/tests/factory/combine.ts +++ b/tests/factory/combine.ts @@ -4,7 +4,7 @@ import xs, {Stream} from '../../src/index'; import * as assert from 'assert'; describe('xs.combine', () => { - it('should combine AND-style two streams together', (done) => { + it('should combine AND-style two streams together', (done: any) => { const stream1 = xs.periodic(100).take(2); const stream2 = xs.periodic(120).take(2); const stream = xs.combine(stream1, stream2); @@ -27,7 +27,7 @@ describe('xs.combine', () => { }); }); - it('should have correct TypeScript signature', (done) => { + it('should have correct TypeScript signature', (done: any) => { const stream1 = xs.create({ start: listener => {}, stop: () => {} @@ -42,7 +42,7 @@ describe('xs.combine', () => { done(); }); - it('should complete only when all member streams have completed', (done) => { + it('should complete only when all member streams have completed', (done: any) => { const stream1 = xs.periodic(30).take(1); const stream2 = xs.periodic(50).take(4); const stream = xs.combine(stream1, stream2).map(arr => arr.join('')) @@ -59,7 +59,7 @@ describe('xs.combine', () => { }); }); - it('should emit an empty array if combining zero streams', (done) => { + it('should emit an empty array if combining zero streams', (done: any) => { const stream = xs.combine(); stream.addListener({ @@ -74,7 +74,7 @@ describe('xs.combine', () => { }); }); - it('should just wrap the value if combining one stream', (done) => { + it('should just wrap the value if combining one stream', (done: any) => { const source = xs.periodic(100).take(3); const stream = xs.combine(source); let expected = [[0], [1], [2]]; @@ -96,7 +96,7 @@ describe('xs.combine', () => { }); }); - it('should not break future listeners when CombineProducer tears down', (done) => { + it('should not break future listeners when CombineProducer tears down', (done: any) => { // --0--1-2--| innerA // ---0---1--| innerB // ----0----1-2--| outer @@ -150,7 +150,7 @@ describe('xs.combine', () => { }); }); - it('should return a Stream when combining a MemoryStream with a Stream', (done) => { + it('should return a Stream when combining a MemoryStream with a Stream', (done: any) => { const input1 = xs.periodic(50).take(4).remember(); const input2 = xs.periodic(80).take(3); const stream: Stream<[number, number]> = xs.combine(input1, input2); @@ -158,7 +158,7 @@ describe('xs.combine', () => { done(); }); - it('should return a Stream when combining a MemoryStream with a MemoryStream', (done) => { + it('should return a Stream when combining a MemoryStream with a MemoryStream', (done: any) => { const input1 = xs.periodic(50).take(4).remember(); const input2 = xs.periodic(80).take(3).remember(); const stream: Stream<[number, number]> = xs.combine(input1, input2); diff --git a/tests/factory/empty.ts b/tests/factory/empty.ts index 5046d58..2416581 100644 --- a/tests/factory/empty.ts +++ b/tests/factory/empty.ts @@ -3,7 +3,7 @@ import xs from '../../src/index'; describe('xs.empty()', function() { - it('should create a stream with 0 events that has already completed', (done) => { + it('should create a stream with 0 events that has already completed', (done: any) => { const stream = xs.empty(); stream.addListener({ diff --git a/tests/factory/from.ts b/tests/factory/from.ts index 0964c29..1dcb1dd 100644 --- a/tests/factory/from.ts +++ b/tests/factory/from.ts @@ -6,7 +6,7 @@ import * as assert from 'assert'; import * as most from 'most'; describe('xs.from', () => { - it('should convert a resolved promise to a stream', (done) => { + it('should convert a resolved promise to a stream', (done: any) => { const stream = xs.from(Promise.resolve('yes')); let nextSent = false; @@ -23,7 +23,7 @@ describe('xs.from', () => { }); }); - it('should convert a rejected promise to a stream', (done) => { + it('should convert a rejected promise to a stream', (done: any) => { const stream = xs.from(Promise.reject('no')); stream.addListener({ @@ -36,7 +36,7 @@ describe('xs.from', () => { }); }); - it('should convert an array to a stream', (done) => { + it('should convert an array to a stream', (done: any) => { const stream = xs.from([10, 20, 30, 40, 50]) .map(i => String(i)); let expected = ['10', '20', '30', '40', '50']; @@ -53,7 +53,7 @@ describe('xs.from', () => { }); }); - it('should convert an observable to a stream', (done) => { + it('should convert an observable to a stream', (done: any) => { const observable = most.from([10, 20, 30, 40, 50]); const stream = xs.from(observable as Observable) .map(i => String(i)); diff --git a/tests/factory/fromArray.ts b/tests/factory/fromArray.ts index ea9c737..ee65cb3 100644 --- a/tests/factory/fromArray.ts +++ b/tests/factory/fromArray.ts @@ -4,7 +4,7 @@ import xs from '../../src/index'; import * as assert from 'assert'; describe('xs.fromArray', () => { - it('should convert an array to a stream', (done) => { + it('should convert an array to a stream', (done: any) => { const stream = xs.fromArray([10, 20, 30, 40, 50]) .map(i => String(i)); let expected = ['10', '20', '30', '40', '50']; diff --git a/tests/factory/fromObservable.ts b/tests/factory/fromObservable.ts index 0ae0fd1..30d2289 100644 --- a/tests/factory/fromObservable.ts +++ b/tests/factory/fromObservable.ts @@ -6,7 +6,7 @@ import * as assert from 'assert'; import * as most from 'most'; describe('xs.fromObservable', () => { - it('should convert an observable to a stream', (done) => { + it('should convert an observable to a stream', (done: any) => { const observable = most.from([10, 20, 30, 40, 50]); const stream = xs.fromObservable(observable) .map(i => String(i)); diff --git a/tests/factory/fromPromise.ts b/tests/factory/fromPromise.ts index 2e7298d..144f69f 100644 --- a/tests/factory/fromPromise.ts +++ b/tests/factory/fromPromise.ts @@ -5,7 +5,7 @@ import xs from '../../src/index'; import * as assert from 'assert'; describe('xs.fromPromise', () => { - it('should convert a resolved promise to a stream', (done) => { + it('should convert a resolved promise to a stream', (done: any) => { const stream = xs.fromPromise(Promise.resolve('yes')); let nextSent = false; @@ -22,7 +22,7 @@ describe('xs.fromPromise', () => { }); }); - it('should convert a rejected promise to a stream', (done) => { + it('should convert a rejected promise to a stream', (done: any) => { const stream = xs.fromPromise(Promise.reject('no')); stream.addListener({ diff --git a/tests/factory/merge.ts b/tests/factory/merge.ts index 11f6e99..dca8606 100644 --- a/tests/factory/merge.ts +++ b/tests/factory/merge.ts @@ -4,7 +4,7 @@ import xs, {Stream} from '../../src/index'; import * as assert from 'assert'; describe('xs.merge', () => { - it('should merge OR-style two streams together', (done) => { + it('should merge OR-style two streams together', (done: any) => { const stream = xs.merge( xs.periodic(100).take(2), xs.periodic(120).take(2) @@ -22,7 +22,7 @@ describe('xs.merge', () => { }); }); - it('should complete only when all member streams have completed', (done) => { + it('should complete only when all member streams have completed', (done: any) => { const stream1 = xs.periodic(30).take(1); const stream2 = xs.periodic(50).take(4); const stream = xs.merge(stream1, stream2); @@ -39,7 +39,7 @@ describe('xs.merge', () => { }); }); - it('should complete properly when stopped asynchronously and restarted synchronously', (done) => { + it('should complete properly when stopped asynchronously and restarted synchronously', (done: any) => { const initial = xs.of('foo'); const stream = xs.merge(initial); @@ -59,7 +59,7 @@ describe('xs.merge', () => { }); }); - it('should return a Stream when merging a MemoryStream with a Stream', (done) => { + it('should return a Stream when merging a MemoryStream with a Stream', (done: any) => { const input1 = xs.periodic(50).take(4).remember(); const input2 = xs.periodic(80).take(3); const stream: Stream = xs.merge(input1, input2); @@ -67,7 +67,7 @@ describe('xs.merge', () => { done(); }); - it('should return a Stream when merging a MemoryStream with a MemoryStream', (done) => { + it('should return a Stream when merging a MemoryStream with a MemoryStream', (done: any) => { const input1 = xs.periodic(50).take(4).remember(); const input2 = xs.periodic(80).take(3).remember(); const stream: Stream = xs.merge(input1, input2); diff --git a/tests/factory/never.ts b/tests/factory/never.ts index 8b233c3..3e06e73 100644 --- a/tests/factory/never.ts +++ b/tests/factory/never.ts @@ -3,7 +3,7 @@ import xs from '../../src/index'; describe('xs.never()', () => { - it('should create a stream with 0 events never ends', (done) => { + it('should create a stream with 0 events never ends', (done: any) => { const stream = xs.never(); const listener = { diff --git a/tests/factory/of.ts b/tests/factory/of.ts index e819100..c8ac8cf 100644 --- a/tests/factory/of.ts +++ b/tests/factory/of.ts @@ -4,7 +4,7 @@ import xs from '../../src/index'; import * as assert from 'assert'; describe('xs.of', () => { - it('should convert multiple items to a stream', (done) => { + it('should convert multiple items to a stream', (done: any) => { const stream = xs.of(10, 20, 30, 40, 50) .map(i => String(i)); let expected = ['10', '20', '30', '40', '50']; diff --git a/tests/factory/throw.ts b/tests/factory/throw.ts index c652a09..b1f9118 100644 --- a/tests/factory/throw.ts +++ b/tests/factory/throw.ts @@ -4,7 +4,7 @@ import xs from '../../src/index'; import * as assert from 'assert'; describe('xs.throw()', function() { - it('should create a stream with just one error emission', (done) => { + it('should create a stream with just one error emission', (done: any) => { const stream = xs.throw(new Error('not nice')); stream.addListener({ diff --git a/tests/memoryStream.ts b/tests/memoryStream.ts index e5602ca..edaa2d3 100644 --- a/tests/memoryStream.ts +++ b/tests/memoryStream.ts @@ -1,12 +1,10 @@ /// /// -import xs, {Producer, Listener, Stream} from '../src/index'; +import xs, {Listener} from '../src/index'; import * as assert from 'assert'; -const noop = () => {}; - describe('MemoryStream', () => { - it('should allow use like a subject, from xs.createWithMemory()', (done) => { + it('should allow use like a subject, from xs.createWithMemory()', (done: any) => { const stream = xs.createWithMemory(); stream.shamefullySendNext(1); @@ -22,7 +20,7 @@ describe('MemoryStream', () => { stream.shamefullySendComplete(); }); - it('should be createable giving a custom producer object', (done) => { + it('should be createable giving a custom producer object', (done: any) => { const expected = [10, 20, 30]; let producerStopped: boolean = false; @@ -53,7 +51,7 @@ describe('MemoryStream', () => { }); }); - it('should broadcast the producer to multiple listeners', (done) => { + it('should broadcast the producer to multiple listeners', (done: any) => { const stream = xs.createWithMemory({ start(listener: Listener) { setTimeout(() => listener.next(0), 100); @@ -95,7 +93,7 @@ describe('MemoryStream', () => { }, 400); }); - it('should reset completely after it has completed', (done) => { + it('should reset completely after it has completed', (done: any) => { const stream = xs.createWithMemory({ start(listener: Listener) { listener.next(1); @@ -135,7 +133,7 @@ describe('MemoryStream', () => { }); }); - it('should teardown upstream MemoryStream memory on late async stop', (done) => { + it('should teardown upstream MemoryStream memory on late async stop', (done: any) => { const stream = xs.periodic(500).mapTo('world').startWith('hello').take(2); const expected1 = ['hello', 'world']; @@ -171,7 +169,7 @@ describe('MemoryStream', () => { * create leaky executions of the stream. This was reported as bug #53 in * GitHub. */ - it('should not allow an operator listener to be indefinitely attached', (done) => { + it('should not allow an operator listener to be indefinitely attached', (done: any) => { let debugCalled = 0; const debugExpected = [42, 0]; const source$ = xs.periodic(100).startWith(42) @@ -215,7 +213,7 @@ describe('MemoryStream', () => { }, 500); }); - it('should emit remembered value also when cancelling a stop', (done) => { + it('should emit remembered value also when cancelling a stop', (done: any) => { const expectedA = [1]; const expectedB = [1, 2]; let completeCalled = 0; diff --git a/tests/operator/debug.ts b/tests/operator/debug.ts index abebe60..2a90e1d 100644 --- a/tests/operator/debug.ts +++ b/tests/operator/debug.ts @@ -14,7 +14,7 @@ describe('Stream.prototype.debug', () => { sandbox.restore(); }); - it('should allow inspecting the operator chain', (done) => { + it('should allow inspecting the operator chain', (done: any) => { const expected = [0, 1, 2]; const stream = xs.periodic(50).take(3).debug(x => { assert.equal(x, expected.shift()); @@ -33,7 +33,7 @@ describe('Stream.prototype.debug', () => { stream.addListener(listener); }); - it('should use console.log if no argument given', (done) => { + it('should use console.log if no argument given', (done: any) => { let stub = sandbox.stub(console, 'log'); const expected = [0, 1, 2]; @@ -56,7 +56,7 @@ describe('Stream.prototype.debug', () => { }); }); - it('should return a Stream if input stream is a Stream', (done) => { + it('should return a Stream if input stream is a Stream', (done: any) => { const input = xs.of(1, 2, 3); assert.strictEqual(input instanceof Stream, true); const stream: Stream = input.debug('stream'); @@ -64,7 +64,7 @@ describe('Stream.prototype.debug', () => { done(); }); - it('should return a MemoryStream if input stream is a MemoryStream', (done) => { + it('should return a MemoryStream if input stream is a MemoryStream', (done: any) => { const input = xs.of(1, 2, 3).remember(); assert.strictEqual(input instanceof MemoryStream, true); const stream: MemoryStream = input.debug('stream'); @@ -72,7 +72,7 @@ describe('Stream.prototype.debug', () => { done(); }); - it('should propagate user mistakes in spy as errors', (done) => { + it('should propagate user mistakes in spy as errors', (done: any) => { const source = xs.periodic(30).take(1); const stream = source.debug( x => ( x).toLowerCase() diff --git a/tests/operator/drop.ts b/tests/operator/drop.ts index 1cdd7ec..d4053a0 100644 --- a/tests/operator/drop.ts +++ b/tests/operator/drop.ts @@ -4,7 +4,7 @@ import xs, {Stream, MemoryStream} from '../../src/index'; import * as assert from 'assert'; describe('Stream.prototype.drop', () => { - it('should allow specifying max amount to drop from input stream', (done) => { + it('should allow specifying max amount to drop from input stream', (done: any) => { const stream = xs.periodic(50).drop(4); const expected = [4, 5, 6]; let listener = { @@ -21,7 +21,7 @@ describe('Stream.prototype.drop', () => { stream.addListener(listener); }); - it('should return a Stream if input stream is a Stream', (done) => { + it('should return a Stream if input stream is a Stream', (done: any) => { const input = xs.of(1, 2, 3); assert.strictEqual(input instanceof Stream, true); const stream: Stream = input.drop(1); @@ -29,7 +29,7 @@ describe('Stream.prototype.drop', () => { done(); }); - it('should return a Stream if input stream is a MemoryStream', (done) => { + it('should return a Stream if input stream is a MemoryStream', (done: any) => { const input = xs.of(1, 2, 3).remember(); assert.strictEqual(input instanceof MemoryStream, true); const stream: Stream = input.drop(1); diff --git a/tests/operator/endWhen.ts b/tests/operator/endWhen.ts index 09c46eb..f4d7794 100644 --- a/tests/operator/endWhen.ts +++ b/tests/operator/endWhen.ts @@ -5,7 +5,7 @@ import delay from '../../src/extra/delay'; import * as assert from 'assert'; describe('Stream.prototype.endWhen', () => { - it('should complete the stream when another stream emits next', (done) => { + it('should complete the stream when another stream emits next', (done: any) => { const source = xs.periodic(50); const other = xs.periodic(220).take(1); const stream = source.endWhen(other); @@ -23,7 +23,7 @@ describe('Stream.prototype.endWhen', () => { }); }); - it('should complete the stream when another stream emits complete', (done) => { + it('should complete the stream when another stream emits complete', (done: any) => { const source = xs.periodic(50); const other = xs.empty().compose(delay(220)); const stream = source.endWhen(other); @@ -41,7 +41,7 @@ describe('Stream.prototype.endWhen', () => { }); }); - it('should return a Stream if input stream is a Stream', (done) => { + it('should return a Stream if input stream is a Stream', (done: any) => { const input = xs.of(1, 2, 3); assert.strictEqual(input instanceof Stream, true); const stream: Stream = input.endWhen(xs.never()); @@ -49,7 +49,7 @@ describe('Stream.prototype.endWhen', () => { done(); }); - it('should return a MemoryStream if input stream is a MemoryStream', (done) => { + it('should return a MemoryStream if input stream is a MemoryStream', (done: any) => { const input = xs.of(1, 2, 3).remember(); assert.strictEqual(input instanceof MemoryStream, true); const stream: MemoryStream = input.endWhen(xs.never()); diff --git a/tests/operator/filter.ts b/tests/operator/filter.ts index 333cb85..674d9db 100644 --- a/tests/operator/filter.ts +++ b/tests/operator/filter.ts @@ -4,7 +4,7 @@ import xs, {Stream, MemoryStream} from '../../src/index'; import * as assert from 'assert'; describe('Stream.prototype.filter', () => { - it('should filter in only even numbers from an input stream', (done) => { + it('should filter in only even numbers from an input stream', (done: any) => { const stream = xs.periodic(50).filter(i => i % 2 === 0); const expected = [0, 2, 4, 6]; let listener = { @@ -21,7 +21,7 @@ describe('Stream.prototype.filter', () => { stream.addListener(listener); }); - it('should propagate user mistakes in predicate as errors', (done) => { + it('should propagate user mistakes in predicate as errors', (done: any) => { const source = xs.periodic(30).take(1); const stream = source.filter( x => ( x).toLowerCase() === 'a' @@ -38,7 +38,7 @@ describe('Stream.prototype.filter', () => { }); }); - it('should clean up Operator producer when complete', (done) => { + it('should clean up Operator producer when complete', (done: any) => { const stream = xs.of(1, 2, 3).filter(i => i !== 2); const expected = [1, 3]; let completeCalled = false; @@ -59,7 +59,7 @@ describe('Stream.prototype.filter', () => { done(); }); - it('should allow multiple filters to be fused', (done) => { + it('should allow multiple filters to be fused', (done: any) => { const isEven = (x: number) => x % 2 === 0; const isGreaterThan5 = (x: number) => x > 5; @@ -81,7 +81,7 @@ describe('Stream.prototype.filter', () => { }); }); - it('should should have filter+map fusion metadata', (done) => { + it('should should have filter+map fusion metadata', (done: any) => { const isEven = (x: number) => x % 2 === 0; const stream = xs.of(1, 2, 3, 4, 5, 6, 7, 8) .filter(isEven) @@ -91,7 +91,7 @@ describe('Stream.prototype.filter', () => { done(); }); - it('should should have filter+mapTo fusion metadata', (done) => { + it('should should have filter+mapTo fusion metadata', (done: any) => { const isEven = (x: number) => x % 2 === 0; const stream = xs.of(1, 2, 3, 4, 5, 6, 7, 8) .filter(isEven) @@ -101,7 +101,7 @@ describe('Stream.prototype.filter', () => { done(); }); - it('should call functions in correct order for filter+filter fusion', (done) => { + it('should call functions in correct order for filter+filter fusion', (done: any) => { const object$ = xs.of( { foo: { a: 10 } }, { foo: { bar: { b: 20 } } }, @@ -128,7 +128,7 @@ describe('Stream.prototype.filter', () => { }); }); - it('should return a Stream if input stream is a Stream', (done) => { + it('should return a Stream if input stream is a Stream', (done: any) => { const input = xs.of(1, 2, 3); assert.strictEqual(input instanceof Stream, true); const stream: Stream = input.filter(x => x % 2 === 0); @@ -136,7 +136,7 @@ describe('Stream.prototype.filter', () => { done(); }); - it('should return a Stream if input stream is a MemoryStream', (done) => { + it('should return a Stream if input stream is a MemoryStream', (done: any) => { const input = xs.of(1, 2, 3).remember(); assert.strictEqual(input instanceof MemoryStream, true); const stream: Stream = input.filter(x => x % 2 === 0); @@ -144,7 +144,7 @@ describe('Stream.prototype.filter', () => { done(); }); - it('should return stream of constrained type if predicate is type guard', (done) => { + it('should return stream of constrained type if predicate is type guard', (done: any) => { class Animal { } class Dog extends Animal { thisIsADog: boolean; diff --git a/tests/operator/flatten.ts b/tests/operator/flatten.ts index ac696de..17cae67 100644 --- a/tests/operator/flatten.ts +++ b/tests/operator/flatten.ts @@ -6,7 +6,7 @@ import * as assert from 'assert'; describe('Stream.prototype.flatten', () => { describe('with map+debug to break the fusion', () => { - it('should not restart inner stream if switching to the same inner stream', (done) => { + it('should not restart inner stream if switching to the same inner stream', (done: any) => { const outer = fromDiagram('-A---------B----------C--------|'); const nums = fromDiagram( '-a-b-c-----------------------|', { values: {a: 1, b: 2, c: 3} @@ -31,7 +31,7 @@ describe('Stream.prototype.flatten', () => { }); describe('with map', () => { - it('should expand each periodic event with 3 sync events', (done) => { + it('should expand each periodic event with 3 sync events', (done: any) => { const source: Stream> = xs.periodic(100).take(3) .map((i: number) => xs.of(1 + i, 2 + i, 3 + i)); const stream: Stream = source.flatten(); @@ -49,7 +49,7 @@ describe('Stream.prototype.flatten', () => { }); }); - it('should have an ins field as metadata', (done) => { + it('should have an ins field as metadata', (done: any) => { const source: Stream = xs.periodic(100).take(3); const stream: Stream = source .map((i: number) => xs.of(1 + i, 2 + i, 3 + i)) @@ -58,7 +58,7 @@ describe('Stream.prototype.flatten', () => { done(); }); - it('should return a flat stream with correct TypeScript types', (done) => { + it('should return a flat stream with correct TypeScript types', (done: any) => { const streamStrings: Stream = Stream.create({ start: (listener: Listener) => {}, stop: () => {} @@ -74,7 +74,7 @@ describe('Stream.prototype.flatten', () => { done(); }); - it('should expand 3 sync events as a periodic, only last one passes', (done) => { + it('should expand 3 sync events as a periodic, only last one passes', (done: any) => { const stream = xs.fromArray([1, 2, 3]) .map(i => xs.periodic(100 * i).take(2).map(x => `${i}${x}`)) .flatten(); @@ -96,7 +96,7 @@ describe('Stream.prototype.flatten', () => { }); }); - it('should expand 3 async events as a periodic each', (done) => { + it('should expand 3 async events as a periodic each', (done: any) => { const stream = xs.periodic(140).take(3) .map(i => xs.periodic(100 * (i < 2 ? 1 : i)).take(3).map(x => `${i}${x}`) @@ -120,7 +120,7 @@ describe('Stream.prototype.flatten', () => { }); }); - it('should expand 3 async events as a periodic each, no optimization', (done) => { + it('should expand 3 async events as a periodic each, no optimization', (done: any) => { const stream = xs.periodic(140).take(3) .map(i => xs.periodic(100 * (i < 2 ? 1 : i)).take(3).map(x => `${i}${x}`) @@ -146,7 +146,7 @@ describe('Stream.prototype.flatten', () => { }); }); - it('should propagate user mistakes in project as errors', (done) => { + it('should propagate user mistakes in project as errors', (done: any) => { const source = xs.periodic(30).take(1); const stream = source.map( x => { @@ -167,7 +167,7 @@ describe('Stream.prototype.flatten', () => { }); }); - it('should not leak when used in a withLatestFrom-like case', (done) => { + it('should not leak when used in a withLatestFrom-like case', (done: any) => { const a$ = xs.periodic(100); const b$ = xs.periodic(220); @@ -196,7 +196,7 @@ describe('Stream.prototype.flatten', () => { }, 800); }); - it('should not error when stopping, and outer stream was empty', (done) => { + it('should not error when stopping, and outer stream was empty', (done: any) => { const outer = xs.never(); const stream = outer.map(x => xs.of(1, 2, 3)).flatten(); const listener = { @@ -213,7 +213,7 @@ describe('Stream.prototype.flatten', () => { setTimeout(() => done(), 500); }); - it('should allow switching inners asynchronously without restarting source', (done) => { + it('should allow switching inners asynchronously without restarting source', (done: any) => { const outer = fromDiagram( '-A---------B----------C------|'); const periodic = fromDiagram('---a-b--c----d--e--f----g--h-|', { values: { a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8 } @@ -243,7 +243,7 @@ describe('Stream.prototype.flatten', () => { }); }); - it('should not restart inner stream if switching to the same inner stream', (done) => { + it('should not restart inner stream if switching to the same inner stream', (done: any) => { const outer = fromDiagram('-A---------B----------C--------|'); const nums = fromDiagram( '-a-b-c-----------------------|', { values: {a: 1, b: 2, c: 3} @@ -266,7 +266,7 @@ describe('Stream.prototype.flatten', () => { }); }); - it('should not run multiple executions of the inner', (done) => { + it('should not run multiple executions of the inner', (done: any) => { const inner = xs.periodic(350).take(2).map(i => i * 100); const outer = xs.periodic(200).take(4); const stream = outer.map(() => inner).flatten(); @@ -286,7 +286,7 @@ describe('Stream.prototype.flatten', () => { }); describe('with filter+map fusion', () => { - it('should execute the predicate, the projection, and the flattening', (done) => { + it('should execute the predicate, the projection, and the flattening', (done: any) => { let predicateCallCount = 0; let projectCallCount = 0; @@ -321,7 +321,7 @@ describe('Stream.prototype.flatten', () => { }); describe('with mapTo', () => { - it('should have the correct \'type\' metadata on the operator producer', (done) => { + it('should have the correct \'type\' metadata on the operator producer', (done: any) => { const source: Stream> = xs.periodic(100).take(3) .mapTo(xs.of(1, 2, 3)); const stream: Stream = source.flatten(); @@ -329,7 +329,7 @@ describe('Stream.prototype.flatten', () => { done(); }); - it('should not restart inner stream if switching to the same inner stream', (done) => { + it('should not restart inner stream if switching to the same inner stream', (done: any) => { const outer = fromDiagram('-A---------B----------C--------|'); const nums = fromDiagram( '-a-b-c-----------------------|', { values: {a: 1, b: 2, c: 3} diff --git a/tests/operator/fold.ts b/tests/operator/fold.ts index 2b529dc..a190287 100644 --- a/tests/operator/fold.ts +++ b/tests/operator/fold.ts @@ -4,7 +4,7 @@ import xs, {Stream, MemoryStream} from '../../src/index'; import * as assert from 'assert'; describe('Stream.prototype.fold', () => { - it('should accumulating a value over time', (done) => { + it('should accumulating a value over time', (done: any) => { const stream = xs.periodic(50).take(4).fold((x: number, y: number) => x + y, 0); const expected = [0, 0, 1, 3, 6]; let listener = { @@ -21,7 +21,7 @@ describe('Stream.prototype.fold', () => { stream.addListener(listener); }); - it('should propagate user mistakes in accumulate as errors', (done) => { + it('should propagate user mistakes in accumulate as errors', (done: any) => { const source = xs.periodic(30).take(1); const stream = source.fold( (x, y) => ( x).toLowerCase(), @@ -44,7 +44,7 @@ describe('Stream.prototype.fold', () => { }); }); - it('should return a MemoryStream if input stream is a Stream', (done) => { + it('should return a MemoryStream if input stream is a Stream', (done: any) => { const input = xs.of(1, 2, 3); assert.strictEqual(input instanceof Stream, true); const stream: MemoryStream = input.fold((acc, x) => acc + x, 0); @@ -52,7 +52,7 @@ describe('Stream.prototype.fold', () => { done(); }); - it('should return a MemoryStream if input stream is a MemoryStream', (done) => { + it('should return a MemoryStream if input stream is a MemoryStream', (done: any) => { const input = xs.of(1, 2, 3).remember(); assert.strictEqual(input instanceof MemoryStream, true); const stream: MemoryStream = input.fold((acc, x) => acc + x, 0); diff --git a/tests/operator/imitate.ts b/tests/operator/imitate.ts index 0eb95f9..f71c47e 100644 --- a/tests/operator/imitate.ts +++ b/tests/operator/imitate.ts @@ -5,7 +5,7 @@ import delay from '../../src/extra/delay'; import * as assert from 'assert'; describe('Stream.prototype.imitate', () => { - it('should be able to model a circular dependency in the stream graph', (done) => { + it('should be able to model a circular dependency in the stream graph', (done: any) => { const secondMimic = xs.create(); const first = secondMimic.map(x => x * 10).take(3); const second = first.map(x => x + 1).startWith(1).compose(delay(1)); @@ -24,7 +24,7 @@ describe('Stream.prototype.imitate', () => { }); }); - it('should be able to model a circular dependency, mimic subscribed', (done) => { + it('should be able to model a circular dependency, mimic subscribed', (done: any) => { const secondMimic = xs.create(); const first = secondMimic.map(x => x * 10).take(3); const second = first.map(x => x + 1).startWith(1).compose(delay(1)); @@ -43,7 +43,7 @@ describe('Stream.prototype.imitate', () => { }); }); - it('should broadcast the source stream to multiple listeners', (done) => { + it('should broadcast the source stream to multiple listeners', (done: any) => { const fakeSecond = xs.create(); const first = fakeSecond.map(x => x * 10).take(3); const second = first.map(x => x + 1).startWith(1).compose(delay(100)); @@ -90,7 +90,7 @@ describe('Stream.prototype.imitate', () => { }, 600); }); - it('should not cause leaked cyclic executions (1)', (done) => { + it('should not cause leaked cyclic executions (1)', (done: any) => { const expectedProxy = [2, 4, 8, 16, 32 /* inertia due to stopping on next tick */]; const expectedResult = [2, 4, 8, 16]; @@ -123,7 +123,7 @@ describe('Stream.prototype.imitate', () => { }); }); - it('should not cause leaked cyclic executions (2)', (done) => { + it('should not cause leaked cyclic executions (2)', (done: any) => { const expectedProxy = [2, 4, 8, 16, 32 /* inertia due to stopping on next tick */]; const expectedResult = [2, 4, 8, 16]; @@ -156,7 +156,7 @@ describe('Stream.prototype.imitate', () => { }); }); - it('should not cause stack overflow while detecting cycles', (done) => { + it('should not cause stack overflow while detecting cycles', (done: any) => { const outside = xs.periodic(150); const secondMimic = xs.create(); const first = xs.merge(outside, secondMimic.map(x => x * 10)); @@ -210,7 +210,7 @@ describe('Stream.prototype.imitate', () => { }, 1000); }); - it('should not propagate errors in a cycle', (done) => { + it('should not propagate errors in a cycle', (done: any) => { const proxyAction$ = xs.create(); const state$ = proxyAction$.fold((state, action) => state + action, 0); const action$ = state$.map(state => { @@ -242,7 +242,7 @@ describe('Stream.prototype.imitate', () => { }, 150); }); - it('should not by itself start the target stream execution', (done) => { + it('should not by itself start the target stream execution', (done: any) => { let nextDelivered = false; const stream = xs.periodic(50).take(3).debug(() => { nextDelivered = true; @@ -257,7 +257,7 @@ describe('Stream.prototype.imitate', () => { proxyStream.imitate(stream); }); - it('should throw an error when given a MemoryStream', (done) => { + it('should throw an error when given a MemoryStream', (done: any) => { const stream = xs.periodic(50).take(3).remember(); assert.strictEqual(stream instanceof MemoryStream, true); const proxyStream = xs.create(); @@ -267,7 +267,7 @@ describe('Stream.prototype.imitate', () => { done(); }); - it('should transfer existing listeners to imitation target', (done) => { + it('should transfer existing listeners to imitation target', (done: any) => { const mimic = xs.create(); const expected = [0, 1, 2]; diff --git a/tests/operator/last.ts b/tests/operator/last.ts index 1cd096c..416e20b 100644 --- a/tests/operator/last.ts +++ b/tests/operator/last.ts @@ -4,7 +4,7 @@ import xs, {Stream, MemoryStream} from '../../src/index'; import * as assert from 'assert'; describe('Stream.prototype.last', () => { - it('should emit only the last value from a stream', (done) => { + it('should emit only the last value from a stream', (done: any) => { const expected = [50]; const stream = xs.of(10, 20, 30, 40, 50).last(); let listener = { @@ -21,7 +21,7 @@ describe('Stream.prototype.last', () => { stream.addListener(listener); }); - it('should return a Stream if input stream is a Stream', (done) => { + it('should return a Stream if input stream is a Stream', (done: any) => { const input = xs.of(1, 2, 3); assert.strictEqual(input instanceof Stream, true); const stream: Stream = input.last(); @@ -29,7 +29,7 @@ describe('Stream.prototype.last', () => { done(); }); - it('should return a Stream if input stream is a MemoryStream', (done) => { + it('should return a Stream if input stream is a MemoryStream', (done: any) => { const input = xs.of(1, 2, 3).remember(); assert.strictEqual(input instanceof MemoryStream, true); const stream: Stream = input.last(); diff --git a/tests/operator/map.ts b/tests/operator/map.ts index a2a89e1..599d0f2 100644 --- a/tests/operator/map.ts +++ b/tests/operator/map.ts @@ -4,7 +4,7 @@ import xs, {Stream, MemoryStream} from '../../src/index'; import * as assert from 'assert'; describe('Stream.prototype.map', () => { - it('should transform values from input stream to output stream', (done) => { + it('should transform values from input stream to output stream', (done: any) => { const stream = xs.periodic(100).map(i => 10 * i).take(3); const expected = [0, 10, 20]; @@ -20,7 +20,7 @@ describe('Stream.prototype.map', () => { }); }); - it('should propagate user mistakes in project as errors', (done) => { + it('should propagate user mistakes in project as errors', (done: any) => { const source = xs.periodic(30).take(1); const stream = source.map( x => ( x).toLowerCase() @@ -38,7 +38,7 @@ describe('Stream.prototype.map', () => { }); }); - it('should clean up Operator producer when complete', (done) => { + it('should clean up Operator producer when complete', (done: any) => { const stream = xs.of(1, 2, 3).map(i => i * 10); const expected = [10, 20, 30]; let completeCalled = false; @@ -59,7 +59,7 @@ describe('Stream.prototype.map', () => { done(); }); - it('should return a Stream if input stream is a Stream', (done) => { + it('should return a Stream if input stream is a Stream', (done: any) => { const input = xs.of(1, 2, 3); assert.strictEqual(input instanceof Stream, true); const stream: Stream = input.map(x => x * 10); @@ -67,7 +67,7 @@ describe('Stream.prototype.map', () => { done(); }); - it('should return a MemoryStream if input stream is a MemoryStream', (done) => { + it('should return a MemoryStream if input stream is a MemoryStream', (done: any) => { const input = xs.of(1, 2, 3).remember(); assert.strictEqual(input instanceof MemoryStream, true); const stream = input.map(x => x * 10); @@ -75,7 +75,7 @@ describe('Stream.prototype.map', () => { done(); }); - it('should clean up Operator producer when failed', (done) => { + it('should clean up Operator producer when failed', (done: any) => { const stream = xs.of('a', 'b', 3).map(i => i.toUpperCase()); const expected = ['A', 'B']; let errorCalled = false; @@ -99,7 +99,7 @@ describe('Stream.prototype.map', () => { done(); }); - it('should not repeat the map project function (e.g. no map+map fusion)', (done) => { + it('should not repeat the map project function (e.g. no map+map fusion)', (done: any) => { const stream = xs.create(); let firstMapCalled = 0; @@ -131,7 +131,7 @@ describe('Stream.prototype.map', () => { }); }); - it('should not repeat the map project function (e.g. no filter+map+map fusion)', (done) => { + it('should not repeat the map project function (e.g. no filter+map+map fusion)', (done: any) => { const stream = xs.create(); let firstMapCalled = 0; diff --git a/tests/operator/mapTo.ts b/tests/operator/mapTo.ts index 10c2b3a..5cf2f4c 100644 --- a/tests/operator/mapTo.ts +++ b/tests/operator/mapTo.ts @@ -4,7 +4,7 @@ import xs, {Stream, MemoryStream} from '../../src/index'; import * as assert from 'assert'; describe('Stream.prototype.mapTo', () => { - it('should transform events to a constant value', (done) => { + it('should transform events to a constant value', (done: any) => { const stream = xs.periodic(100).mapTo(10); const expected = [10, 10, 10]; let listener = { @@ -20,8 +20,8 @@ describe('Stream.prototype.mapTo', () => { }; stream.addListener(listener); }); - - it('should return a Stream if input stream is a Stream', (done) => { + + it('should return a Stream if input stream is a Stream', (done: any) => { const input = xs.of(1, 2, 3); assert.strictEqual(input instanceof Stream, true); const stream: Stream = input.mapTo(10); @@ -29,7 +29,7 @@ describe('Stream.prototype.mapTo', () => { done(); }); - it('should return a MemoryStream if input stream is a MemoryStream', (done) => { + it('should return a MemoryStream if input stream is a MemoryStream', (done: any) => { const input = xs.of(1, 2, 3).remember(); assert.strictEqual(input instanceof MemoryStream, true); const stream: MemoryStream = input.mapTo(10); @@ -37,7 +37,7 @@ describe('Stream.prototype.mapTo', () => { done(); }); - it('should have \'type\' metadata on the operator producer', (done) => { + it('should have \'type\' metadata on the operator producer', (done: any) => { const stream = xs.periodic(100).mapTo(10); assert.strictEqual(stream['_prod']['type'], 'mapTo'); done(); diff --git a/tests/operator/remember.ts b/tests/operator/remember.ts index 49abe33..17367a3 100644 --- a/tests/operator/remember.ts +++ b/tests/operator/remember.ts @@ -5,7 +5,7 @@ import * as assert from 'assert'; function noop() {}; describe('Stream.prototype.remember', () => { - it('should replay the second event to a new listener', (done) => { + it('should replay the second event to a new listener', (done: any) => { const stream = xs.periodic(50).take(4).remember(); stream.addListener({next: noop, error: noop, complete: noop}); @@ -25,7 +25,7 @@ describe('Stream.prototype.remember', () => { }, 125); }); - it('should not be ruined by map+map fusion optimizations', (done) => { + it('should not be ruined by map+map fusion optimizations', (done: any) => { let expectedA = [10]; let expectedB = [10]; @@ -62,7 +62,7 @@ describe('Stream.prototype.remember', () => { }, 100); }); - it('should reset completely after it has completed', (done) => { + it('should reset completely after it has completed', (done: any) => { const stream = xs.of(1, 2, 3).remember(); const expected1 = [1, 2, 3]; @@ -94,7 +94,7 @@ describe('Stream.prototype.remember', () => { }); }); - it('should return a MemoryStream if input stream is a Stream', (done) => { + it('should return a MemoryStream if input stream is a Stream', (done: any) => { const input = xs.of(1, 2, 3); assert.strictEqual(input instanceof Stream, true); const stream: MemoryStream = input.remember(); @@ -102,7 +102,7 @@ describe('Stream.prototype.remember', () => { done(); }) - it('should not fail if original stream has no producer, and start is called', (done) => { + it('should not fail if original stream has no producer, and start is called', (done: any) => { const input = xs.create(); assert.strictEqual(input instanceof Stream, true); const stream: MemoryStream = input.remember(); @@ -113,7 +113,7 @@ describe('Stream.prototype.remember', () => { done(); }); - it('should return a MemoryStream if input stream is a MemoryStream', (done) => { + it('should return a MemoryStream if input stream is a MemoryStream', (done: any) => { const input = xs.createWithMemory(); assert.strictEqual(input instanceof MemoryStream, true); const stream: MemoryStream = input.remember(); @@ -121,14 +121,14 @@ describe('Stream.prototype.remember', () => { done(); }); - it('should be a true bypass if input stream is a MemoryStream', (done) => { + it('should be a true bypass if input stream is a MemoryStream', (done: any) => { const input = xs.createWithMemory(); const stream: MemoryStream = input.remember(); assert.strictEqual(stream, input); done(); }); - it('should not fail if original memorystream has no producer, and start is called', (done) => { + it('should not fail if original memorystream has no producer, and start is called', (done: any) => { const input = xs.createWithMemory(); assert.strictEqual(input instanceof MemoryStream, true); const stream: MemoryStream = input.remember(); @@ -139,7 +139,7 @@ describe('Stream.prototype.remember', () => { done(); }); - it('should pass last value to second listener, even if it\'s "shameful"', (done) => { + it('should pass last value to second listener, even if it\'s "shameful"', (done: any) => { const subject = xs.create(); const remembered = subject.remember(); @@ -161,7 +161,7 @@ describe('Stream.prototype.remember', () => { subject.shamefullySendComplete(); }); - it('should work properly with "shameful" values after subscription', (done) => { + it('should work properly with "shameful" values after subscription', (done: any) => { const subject = xs.create(); const remembered = subject.remember(); diff --git a/tests/operator/replaceError.ts b/tests/operator/replaceError.ts index aa4a437..b26a939 100644 --- a/tests/operator/replaceError.ts +++ b/tests/operator/replaceError.ts @@ -4,7 +4,7 @@ import xs, {Stream, MemoryStream, Producer} from '../../src/index'; import * as assert from 'assert'; describe('Stream.prototype.replaceError', () => { - it('should replace a single error with an array stream', (done) => { + it('should replace a single error with an array stream', (done: any) => { const source = xs.of('a', 'b', 'c', 2, 'd').map(i => i.toLowerCase()); const other = xs.of(10, 20, 30); const stream = source.replaceError(err => other); @@ -22,7 +22,7 @@ describe('Stream.prototype.replaceError', () => { }); }); - it('should allow retrying on a hot producer', (done) => { + it('should allow retrying on a hot producer', (done: any) => { const events: Array<{type: string, value?: any}> = [ {type: 'next', value: 10}, {type: 'next', value: 20}, @@ -69,7 +69,7 @@ describe('Stream.prototype.replaceError', () => { }); }); - it('should repeat a cold producer if retrying', (done) => { + it('should repeat a cold producer if retrying', (done: any) => { const events: Array<{type: string, value?: any}> = [ {type: 'next', value: 10}, {type: 'next', value: 20}, @@ -116,7 +116,7 @@ describe('Stream.prototype.replaceError', () => { }); }); - it('should propagate user mistakes in replace() as errors', (done) => { + it('should propagate user mistakes in replace() as errors', (done: any) => { const source = xs.throw({message: 'oops'}); const stream = source.replaceError( err => xs.of(( err).toLowerCase()) @@ -134,7 +134,7 @@ describe('Stream.prototype.replaceError', () => { }); }); - it('should return a Stream if input stream is a Stream', (done) => { + it('should return a Stream if input stream is a Stream', (done: any) => { const input = xs.of(1, 2, 3); assert.strictEqual(input instanceof Stream, true); const stream: Stream = input.replaceError(err => xs.never()); @@ -142,7 +142,7 @@ describe('Stream.prototype.replaceError', () => { done(); }); - it('should return a MemoryStream if input stream is a MemoryStream', (done) => { + it('should return a MemoryStream if input stream is a MemoryStream', (done: any) => { const input = xs.of(1, 2, 3).remember(); assert.strictEqual(input instanceof MemoryStream, true); const stream: MemoryStream = input.replaceError(err => xs.never()); diff --git a/tests/operator/startWith.ts b/tests/operator/startWith.ts index 484f3d0..c1b1e2e 100644 --- a/tests/operator/startWith.ts +++ b/tests/operator/startWith.ts @@ -4,7 +4,7 @@ import xs, {MemoryStream} from '../../src/index'; import * as assert from 'assert'; describe('Stream.prototype.startWith', () => { - it('should allow starting with a value', (done) => { + it('should allow starting with a value', (done: any) => { const stream = xs.of(100); stream.startWith(1).take(1).addListener({ @@ -16,7 +16,7 @@ describe('Stream.prototype.startWith', () => { }); }); - it('should return a MemoryStream', (done) => { + it('should return a MemoryStream', (done: any) => { const stream = xs.of(100).startWith(1); assert.strictEqual(stream instanceof MemoryStream, true); done(); diff --git a/tests/operator/take.ts b/tests/operator/take.ts index 70041e9..5f2b9c5 100644 --- a/tests/operator/take.ts +++ b/tests/operator/take.ts @@ -4,7 +4,7 @@ import xs, {Stream, MemoryStream} from '../../src/index'; import * as assert from 'assert'; describe('Stream.prototype.take', () => { - it('should allow specifying max amount to take from input stream', (done) => { + it('should allow specifying max amount to take from input stream', (done: any) => { const stream = xs.periodic(50).take(4); const expected = [0, 1, 2, 3]; let listener = { @@ -21,7 +21,7 @@ describe('Stream.prototype.take', () => { stream.addListener(listener); }); - it('should return a Stream if input stream is a tream', (done) => { + it('should return a Stream if input stream is a tream', (done: any) => { const input = xs.of(1, 2, 3); assert.strictEqual(input instanceof Stream, true); const stream: Stream = input.take(2); @@ -29,7 +29,7 @@ describe('Stream.prototype.take', () => { done(); }); - it('should return a MemoryStream if input stream is a MemoryStream', (done) => { + it('should return a MemoryStream if input stream is a MemoryStream', (done: any) => { const input = xs.of(1, 2, 3).remember(); assert.strictEqual(input instanceof MemoryStream, true); const stream: MemoryStream = input.take(2); @@ -37,7 +37,7 @@ describe('Stream.prototype.take', () => { done(); }); - it('should not break sibling listeners when TakeOperator tears down', (done) => { + it('should not break sibling listeners when TakeOperator tears down', (done: any) => { const source = xs.periodic(50); const streamA = source.take(3); const streamB = source.take(6); @@ -66,7 +66,7 @@ describe('Stream.prototype.take', () => { }); }); - it('should just complete if given max=0', (done) => { + it('should just complete if given max=0', (done: any) => { const stream = xs.periodic(50).take(0); stream.addListener({ diff --git a/tests/stream.ts b/tests/stream.ts index c160185..c58b32c 100644 --- a/tests/stream.ts +++ b/tests/stream.ts @@ -42,7 +42,7 @@ describe('Stream', () => { assert.equal(typeof stream.imitate, 'function'); }); - it('should be createable giving a custom producer object', (done) => { + it('should be createable giving a custom producer object', (done: any) => { const expected = [10, 20, 30]; let producerStopped: boolean = false; @@ -74,7 +74,7 @@ describe('Stream', () => { }); }); - it('should allow using shamefullySend* methods', (done) => { + it('should allow using shamefullySend* methods', (done: any) => { const expected = [10, 20, 30]; let listenerGotEnd: boolean = false; @@ -100,7 +100,7 @@ describe('Stream', () => { done(); }); - it('should be possible to addListener and removeListener with 1 listener', (done) => { + it('should be possible to addListener and removeListener with 1 listener', (done: any) => { const stream = xs.periodic(100); const expected = [0, 1, 2]; let listener = { @@ -117,7 +117,7 @@ describe('Stream', () => { stream.addListener(listener); }); - it('should broadcast events to two listeners', (done) => { + it('should broadcast events to two listeners', (done: any) => { const stream = xs.periodic(100); const expected1 = [0, 1, 2]; const expected2 = [1, 2]; @@ -151,7 +151,7 @@ describe('Stream', () => { }, 350); }); - it('should not stop if listener is synchronously removed and re-added', (done) => { + it('should not stop if listener is synchronously removed and re-added', (done: any) => { const stream = xs.periodic(100); const expected = [0, 1, 2]; let listener = { @@ -173,7 +173,7 @@ describe('Stream', () => { }, 150); }); - it('should restart if listener is asynchronously removed and re-added', (done) => { + it('should restart if listener is asynchronously removed and re-added', (done: any) => { const stream = xs.periodic(100); let expected = [0, 1, 2]; let listener = { @@ -199,7 +199,7 @@ describe('Stream', () => { }, 180); }); - it('should synchronously stop producer when completed', (done) => { + it('should synchronously stop producer when completed', (done: any) => { let on = false; const stream = xs.create({ start: (listener) => { @@ -246,7 +246,7 @@ describe('Stream', () => { done(); }); - it('should synchronously stop producer when error thrown', (done) => { + it('should synchronously stop producer when error thrown', (done: any) => { let on = false; const stream = xs.create({ start: (listener) => { @@ -300,7 +300,7 @@ describe('Stream', () => { }); describe('create', () => { - it('throws a helpful error if you pass an incomplete producer', (done) => { + it('throws a helpful error if you pass an incomplete producer', (done: any) => { try { const incompleteProducer = > { start: () => {}, @@ -316,7 +316,7 @@ describe('Stream', () => { }); describe('setDebugListener', () => { - it('should not trigger a stream execution', (done) => { + it('should not trigger a stream execution', (done: any) => { const stream = xs.of(1, 2, 3); const listener: Listener = { next: () => done('should not be called'), @@ -328,7 +328,7 @@ describe('Stream', () => { setTimeout(() => done(), 200); }); - it('should spy an existing stream execution', (done) => { + it('should spy an existing stream execution', (done: any) => { const stream = xs.periodic(200).take(8); const listener = { next: () => { }, error: () => { }, complete: () => { } }; const expected = [0, 1, 2]; @@ -353,7 +353,7 @@ describe('Stream', () => { }); describe('addListener', () => { - it('should accept a partial listener with just next', (done) => { + it('should accept a partial listener with just next', (done: any) => { const stream = fromDiagram('--a--b----c----d---|'); const expected = ['a', 'b', 'c', 'd']; @@ -370,7 +370,7 @@ describe('Stream', () => { stream.addListener(listener as any); }); - it('should accept a partial listener with just error', (done) => { + it('should accept a partial listener with just error', (done: any) => { const stream = fromDiagram('--a--b----c----d---#', {errorValue: 'oops'}); let listener = { @@ -383,7 +383,7 @@ describe('Stream', () => { stream.addListener(listener as any); }); - it('should accept a partial listener with just complete', (done) => { + it('should accept a partial listener with just complete', (done: any) => { const stream = fromDiagram('--a--b----c----d---|'); let listener = { @@ -397,7 +397,7 @@ describe('Stream', () => { }); describe('subscribe', () => { - it('should return a subscription', (done) => { + it('should return a subscription', (done: any) => { const stream = xs.empty(); const noop = (): void => void 0; const listener = { diff --git a/tslint.json b/tslint.json index f630085..99d77c8 100644 --- a/tslint.json +++ b/tslint.json @@ -8,13 +8,10 @@ "max-line-length": [true, 150], "no-consecutive-blank-lines": true, "no-trailing-whitespace": true, - "no-duplicate-key": true, "no-duplicate-variable": true, - "no-unreachable": true, "no-var-keyword": true, "no-empty": false, "no-unused-expression": true, - "no-unused-variable": true, "no-use-before-declare": false, "no-var-requires": true, "no-require-imports": true,