diff --git a/packages/common/src/location/location.ts b/packages/common/src/location/location.ts index ed895260e4..d3997e4f90 100644 --- a/packages/common/src/location/location.ts +++ b/packages/common/src/location/location.ts @@ -7,6 +7,7 @@ */ import {EventEmitter, Injectable} from '@angular/core'; +import {ISubscription} from 'rxjs/Subscription'; import {LocationStrategy} from './location_strategy'; @@ -129,7 +130,7 @@ export class Location { */ subscribe( onNext: (value: PopStateEvent) => void, onThrow?: ((exception: any) => void)|null, - onReturn?: (() => void)|null): Object { + onReturn?: (() => void)|null): ISubscription { return this._subject.subscribe({next: onNext, error: onThrow, complete: onReturn}); } diff --git a/packages/common/testing/rollup.config.js b/packages/common/testing/rollup.config.js index 335ba39609..cad6638ff5 100644 --- a/packages/common/testing/rollup.config.js +++ b/packages/common/testing/rollup.config.js @@ -13,7 +13,8 @@ const globals = { '@angular/core': 'ng.core', '@angular/common': 'ng.common', 'rxjs/Observable': 'Rx', - 'rxjs/Subject': 'Rx' + 'rxjs/Subject': 'Rx', + 'rxjs/Subscription': 'Rx' }; module.exports = { diff --git a/packages/common/testing/src/location_mock.ts b/packages/common/testing/src/location_mock.ts index b2acc613ca..55b71a7e08 100644 --- a/packages/common/testing/src/location_mock.ts +++ b/packages/common/testing/src/location_mock.ts @@ -8,6 +8,7 @@ import {Location, LocationStrategy} from '@angular/common'; import {EventEmitter, Injectable} from '@angular/core'; +import {ISubscription} from 'rxjs/Subscription'; /** @@ -109,7 +110,7 @@ export class SpyLocation implements Location { subscribe( onNext: (value: any) => void, onThrow?: ((error: any) => void)|null, - onReturn?: (() => void)|null): Object { + onReturn?: (() => void)|null): ISubscription { return this._subject.subscribe({next: onNext, error: onThrow, complete: onReturn}); } diff --git a/tools/public_api_guard/common/common.d.ts b/tools/public_api_guard/common/common.d.ts index 9652694d09..afaa89eaaf 100644 --- a/tools/public_api_guard/common/common.d.ts +++ b/tools/public_api_guard/common/common.d.ts @@ -190,7 +190,7 @@ export declare class Location { path(includeHash?: boolean): string; prepareExternalUrl(url: string): string; replaceState(path: string, query?: string): void; - subscribe(onNext: (value: PopStateEvent) => void, onThrow?: ((exception: any) => void) | null, onReturn?: (() => void) | null): Object; + subscribe(onNext: (value: PopStateEvent) => void, onThrow?: ((exception: any) => void) | null, onReturn?: (() => void) | null): ISubscription; static joinWithSlash(start: string, end: string): string; static normalizeQueryParams(params: string): string; static stripTrailingSlash(url: string): string; diff --git a/tools/public_api_guard/common/testing.d.ts b/tools/public_api_guard/common/testing.d.ts index 7270e3a544..edac756fc1 100644 --- a/tools/public_api_guard/common/testing.d.ts +++ b/tools/public_api_guard/common/testing.d.ts @@ -31,5 +31,5 @@ export declare class SpyLocation implements Location { setInitialPath(url: string): void; simulateHashChange(pathname: string): void; simulateUrlPop(pathname: string): void; - subscribe(onNext: (value: any) => void, onThrow?: ((error: any) => void) | null, onReturn?: (() => void) | null): Object; + subscribe(onNext: (value: any) => void, onThrow?: ((error: any) => void) | null, onReturn?: (() => void) | null): ISubscription; }