title: How to attach function that uses `this` to instance-object
body: <p>I'm trying to modify and instance-object's behaviour for testing. If you need to know <em>exactly</em> what I'm trying to achive, it's this:</p>
  <pre class="lang-js prettyprint-override"><code>const fakeWebSocket$$: WebSocketSubject&lt;any&gt; = new Subject&lt;any&gt;() as WebSocketSubject&lt;any&gt;;
  fakeWebSocket$$.multiplex = (x: any, y: any, filterFn: (z: any) =&gt; boolean) =&gt; 
      fakeWebSocket$$.pipe(filter(filterFn));
  </code></pre>
  <p>which is attaching a fake <code>multiplex</code>-method to an RxJS-<code>Subject</code> to be able to emulate a <code>WebSocketSubject</code>.</p>
  <p>This works fine, but notice how I have to refer to the <code>fakeWebSocket$$</code> twice:</p>
  <pre class="lang-js prettyprint-override"><code>// simplified for readability
  fakeWebSocket$$.multiplex = (x, y, filterFn) =&gt; fakeWebSocket$$.pipe(filter(filterFn));
  </code></pre>
  <p>I'd hope there is a way to replace the second explicit call to <code>fakeWebSocket$$</code> with <code>this</code>, somehow?</p>