diff --git a/compat/operator/distinctUntilKeyChanged.ts b/compat/operator/distinctUntilKeyChanged.ts index e29a3740847..29e869e24cd 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: T[keyof T], y: T[keyof T]) => boolean): Observable; /* tslint:enable:max-line-length */ /** @@ -64,6 +64,6 @@ export function distinctUntilKeyChanged(this: Observable, key: string, * @method distinctUntilKeyChanged * @owner Observable */ -export function distinctUntilKeyChanged(this: Observable, key: string, compare?: (x: T, y: T) => boolean): Observable { - return higherOrder(key, compare)(this); +export function distinctUntilKeyChanged(this: Observable, key: keyof T, compare?: (x: T[keyof T], y: T[keyof T]) => boolean): Observable { + return higherOrder(key, compare)(this); } diff --git a/src/internal/operators/distinctUntilKeyChanged.ts b/src/internal/operators/distinctUntilKeyChanged.ts index 3a8e4bf91f8..6f29a5b2f80 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: T[keyof T], y: T[keyof T]) => 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: T, y: T) => boolean): MonoTypeOperatorFunction { +export function distinctUntilKeyChanged(key: keyof T, compare?: (x: T[keyof T], y: T[keyof T]) => boolean): MonoTypeOperatorFunction { return distinctUntilChanged((x: T, y: T) => compare ? compare(x[key], y[key]) : x[key] === y[key]); }