import { Subject } from 'rxjs' ; import { distinct , distinctUntilChanged , distinctUntilKeyChanged } from 'rxjs/operators' ; interface Person { name : string ; } const person$ = new Subject < Person > ( ) ; person$ . pipe ( distinctUntilKeyChanged ( 'name' ) ) . subscribe ( { next : item => console . log ( `Distinct Item: ${ item . name }` ) } ) ; person$ . next ( { name : 'Bob' } ) ; person$ . next ( { name : 'Bob' } ) ; person$ . next ( { name : 'Mary' } ) ; person$ . next ( { name : 'Mary' } ) ; person$ . next ( { name : 'Frank' } ) ;