diff --git a/compat/operator/distinctUntilKeyChanged.ts b/compat/operator/distinctUntilKeyChanged.ts index 59f0787cc89..655e3de7b43 100644 --- a/compat/operator/distinctUntilKeyChanged.ts +++ b/compat/operator/distinctUntilKeyChanged.ts @@ -3,8 +3,8 @@ import { Observable } from 'rxjs'; import { distinctUntilKeyChanged as higherOrder } from 'rxjs/operators'; /* tslint:disable:max-line-length */ -export function distinctUntilKeyChanged(this: Observable, key: string): Observable; -export function distinctUntilKeyChanged(this: Observable, key: string, compare: (x: K, y: K) => boolean): Observable; +export function distinctUntilKeyChanged(this: Observable, key: keyof T): Observable; +export function distinctUntilKeyChanged(this: Observable, key: keyof T, compare: (x: K, y: K) => boolean): Observable; /* tslint:enable:max-line-length */ /** @@ -64,6 +64,6 @@ export function distinctUntilKeyChanged(this: Observable, key: string, com * @method distinctUntilKeyChanged * @owner Observable */ -export function distinctUntilKeyChanged(this: Observable, key: string, compare?: (x: K, y: K) => boolean): Observable { +export function distinctUntilKeyChanged(this: Observable, key: keyof T, compare?: (x: K, y: K) => boolean): Observable { return higherOrder(key, compare)(this); } diff --git a/src/internal/operators/distinctUntilKeyChanged.ts b/src/internal/operators/distinctUntilKeyChanged.ts index b9c6cc2fa63..3e0adb8a242 100644 --- a/src/internal/operators/distinctUntilKeyChanged.ts +++ b/src/internal/operators/distinctUntilKeyChanged.ts @@ -2,8 +2,8 @@ import { distinctUntilChanged } from './distinctUntilChanged'; import { MonoTypeOperatorFunction } from '../types'; /* tslint:disable:max-line-length */ -export function distinctUntilKeyChanged(key: string): MonoTypeOperatorFunction; -export function distinctUntilKeyChanged(key: string, compare: (x: K, y: K) => boolean): MonoTypeOperatorFunction; +export function distinctUntilKeyChanged(key: keyof T): MonoTypeOperatorFunction; +export function distinctUntilKeyChanged(key: keyof T, compare: (x: K, y: K) => boolean): MonoTypeOperatorFunction; /* tslint:enable:max-line-length */ /** @@ -70,6 +70,6 @@ export function distinctUntilKeyChanged(key: string, compare: (x: K, y: K * @method distinctUntilKeyChanged * @owner Observable */ -export function distinctUntilKeyChanged(key: string, compare?: (x: K, y: K) => boolean): MonoTypeOperatorFunction { +export function distinctUntilKeyChanged(key: keyof T, compare?: (x: K, y: K) => boolean): MonoTypeOperatorFunction { return distinctUntilChanged((x: T, y: T) => compare ? compare(x[key], y[key]) : x[key] === y[key]); }