diff --git a/src/Umbraco.Web.UI.Client/src/libs/observable-api/basic-state.ts b/src/Umbraco.Web.UI.Client/src/libs/observable-api/basic-state.ts index e2874710c9..2172afa7fd 100644 --- a/src/Umbraco.Web.UI.Client/src/libs/observable-api/basic-state.ts +++ b/src/Umbraco.Web.UI.Client/src/libs/observable-api/basic-state.ts @@ -11,9 +11,6 @@ export class UmbBasicState { constructor(initialData: T) { this._subject = new BehaviorSubject(initialData); - this.asObservable = this._subject.asObservable.bind(this._subject); - this.getValue = this._subject.getValue.bind(this._subject); - this.destroy = this._subject.complete.bind(this._subject); } @@ -26,7 +23,9 @@ export class UmbBasicState { * * this.observe(myState, (latestStateValue) => console.log("Value is: ", latestStateValue)); */ - public asObservable: BehaviorSubject['asObservable']; + public asObservable(): ReturnType['asObservable']> { + return this._subject.asObservable(); + } /** * @property value @@ -47,13 +46,17 @@ export class UmbBasicState { * const myState = new UmbArrayState('Hello world'); * console.log("Value is: ", myState.value); */ - public getValue: BehaviorSubject['getValue']; + public getValue(): ReturnType['getValue']> { + return this._subject.getValue(); + } /** * @method destroy * @description - Destroys this state and completes all observations made to it. */ - public destroy: BehaviorSubject['complete']; + public destroy(): void { + this._subject.complete(); + } /** * @method next