BehaviourSubject's distinctUntilChanged() is not a function
<p>I am new to Rxjs
I am trying understand BehaviourSubject
below is my code</p>

<pre><code>export interface State {
    items: Items[]
}

const defaultState = {
    items: []
};

const _store = new BehaviorSubject&lt;State&gt;(defaultState);

@Injectable()
export class Store {
    private _store = _store;
    changes = this._store.distinctUntilChanged()
        .do(() =&gt; console.log('changes'));

    setState(state: State) {
        this._store.next(state);
    }

    getState() : State {
        return this._store.value;
    }

    purge() {
        this._store.next(defaultState);
    }
}
</code></pre>

<p>When i run my project then i get this error in my console</p>

<pre><code>platform-browser.umd.js:1900 EXCEPTION: Error: Uncaught (in promise):
EXCEPTION: Error during instantiation of Store! (StoreHelper -&gt; Store).
ORIGINAL EXCEPTION: TypeError: this._store.distinctUntilChanged is not a function
</code></pre>

<p>Can anyone help me out. Also if I am trying to do is to create a Store for my model objects so if there is any other simpler way feel free to suggest it.</p>

<p>Any help is appreciated.</p>