diff --git a/spec/helpers/test-helper.ts b/spec/helpers/test-helper.ts index b6cea52885..75477dcd1a 100644 --- a/spec/helpers/test-helper.ts +++ b/spec/helpers/test-helper.ts @@ -17,6 +17,7 @@ global.hot = marbleHelpers.hot; global.time = marbleHelpers.time; global.expectObservable = marbleHelpers.expectObservable; global.expectSubscriptions = marbleHelpers.expectSubscriptions; +global.type = type; //amending type definition of jasmine which seems doesn't have this export interface DoneSignature { @@ -77,6 +78,11 @@ if (!global.asDiagram) { global.asDiagram = asDiagram; } +export function type(assertion: Function): void { + //intentionally does not execute to avoid unexpected side effect occurs by subscription, + //or infinite source. Suffecient to check build time only. +} + export function lowerCaseO(...args): Rx.Observable { const values = [].slice.apply(arguments); @@ -154,4 +160,4 @@ global.__root__ = root; afterEach(function () { global.rxTestScheduler = null; -}); \ No newline at end of file +}); diff --git a/spec/operators/toArray-spec.ts b/spec/operators/toArray-spec.ts index e5ae454c22..1d4baf891d 100644 --- a/spec/operators/toArray-spec.ts +++ b/spec/operators/toArray-spec.ts @@ -1,5 +1,5 @@ import * as Rx from '../../dist/cjs/Rx'; -declare const {hot, cold, asDiagram, expectObservable, expectSubscriptions}; +declare const {hot, cold, asDiagram, expectObservable, expectSubscriptions, type}; const Observable = Rx.Observable; @@ -101,4 +101,12 @@ describe('Observable.prototype.toArray', () => { expectObservable(e1.toArray()).toBe(expected); expectSubscriptions(e1.subscriptions).toBe(e1subs); }); + + type(() => { + const typeValue = { + val: 3 + }; + + Observable.of(typeValue).toArray().subscribe(x => { x[0].val.toString(); }); + }); });