Skip to content

Commit

Permalink
Merge pull request #3234 from jasonaden/fix_compilation_errors
Browse files Browse the repository at this point in the history
fix: correct compilation warnings from missing types in tests
  • Loading branch information
kwonoj authored Jan 19, 2018
2 parents d7cfb42 + 3aad6bc commit be952c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
21 changes: 11 additions & 10 deletions spec/Observable-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { expect } from 'chai';
import * as sinon from 'sinon';
import * as Rx from '../src/Rx';
import { TeardownLogic } from '../src/Subscription';
import { Observer } from './../src/internal/Observer';
import { TeardownLogic } from '../src/internal/Subscription';
import marbleTestingSignature = require('./helpers/marble-testing'); // tslint:disable-line:no-require-imports
import { map } from '../src/internal/operators/map';
//tslint:disable-next-line
Expand Down Expand Up @@ -77,7 +78,7 @@ describe('Observable', () => {

__root__.Rx = {};
__root__.Rx.config = {};
__root__.Rx.config.Promise = function MyPromise(callback) {
__root__.Rx.config.Promise = function MyPromise(callback: any) {
wasCalled = true;
return new Promise(callback);
};
Expand All @@ -92,7 +93,7 @@ describe('Observable', () => {
});

it('should reject promise if nextHandler throws', (done: MochaDone) => {
const results = [];
const results: number[] = [];

Observable.of(1, 2, 3).forEach((x: number) => {
if (x === 3) {
Expand Down Expand Up @@ -172,8 +173,8 @@ describe('Observable', () => {
describe('subscribe', () => {
it('should be synchronous', () => {
let subscribed = false;
let nexted;
let completed;
let nexted: string;
let completed: boolean;
const source = new Observable((observer: Rx.Observer<string>) => {
subscribed = true;
observer.next('wee');
Expand Down Expand Up @@ -403,7 +404,7 @@ describe('Observable', () => {
//intentionally not using lambda to avoid typescript's this context capture
const o = {
myValue: 'foo',
next: function next(x) {
next: function next(x: number) {
expect(this.myValue).to.equal('foo');
expect(x).to.equal(1);
done();
Expand All @@ -418,7 +419,7 @@ describe('Observable', () => {
//intentionally not using lambda to avoid typescript's this context capture
const o = {
myValue: 'foo',
error: function error(err) {
error: function error(err: string) {
expect(this.myValue).to.equal('foo');
expect(err).to.equal('bad');
done();
Expand Down Expand Up @@ -570,7 +571,7 @@ describe('Observable', () => {
describe('Observable.create', () => {
asDiagram('create(obs => { obs.next(1); })')
('should create a cold observable that emits just 1', () => {
const e1 = Observable.create(obs => { obs.next(1); });
const e1 = Observable.create((obs: Observer<number>) => { obs.next(1); });
const expected = 'x';
expectObservable(e1).toBe(expected, {x: 1});
});
Expand Down Expand Up @@ -598,11 +599,11 @@ describe('Observable.create', () => {
});

it('should send errors thrown in the passed function down the error path', (done) => {
Observable.create((observer) => {
Observable.create((observer: Observer<any>) => {
throw new Error('this should be handled');
})
.subscribe({
error(err) {
error(err: Error) {
expect(err).to.deep.equal(new Error('this should be handled'));
done();
}
Expand Down
4 changes: 2 additions & 2 deletions spec/Subscription-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Subscription = Rx.Subscription;
/** @test {Subscription} */
describe('Subscription', () => {
it('should not leak', (done: MochaDone) => {
const tearDowns = [];
const tearDowns: number[] = [];

const source1 = Observable.create((observer: Rx.Observer<any>) => {
return () => {
Expand Down Expand Up @@ -40,7 +40,7 @@ describe('Subscription', () => {
});

it('should not leak when adding a bad custom subscription to a subscription', (done: MochaDone) => {
const tearDowns = [];
const tearDowns: number[] = [];

const sub = new Subscription();

Expand Down

0 comments on commit be952c0

Please sign in to comment.