title: adding debounce to Subject in rxjs/Angular2
body: <p>I am trying to create an events service, with the following code</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Observable } from 'rxjs/Observable';
  import { Subject } from 'rxjs/Subject';
  
  export interface IPosition {
      x:number
      y:number
  }
  
  export interface IPositionEvent {
      id: string
      position: IPosition
  }
  
  @Injectable()
  export class ModelEventsService {
      position$:Subject&lt;IPositionEvent&gt;;
  
      constructor() {
          this.position$ = new Subject().debounce(500);
      }
  
  }
  </code></pre>
  
  <p>however, typescript generates the following error</p>
  
  <blockquote>
    <p>ERROR in /src/model-events.service.ts (20,49): Argument of type '500'
    is not assignable to parameter of type '(value: {}) =>
    SubscribableOrPromise'.)</p>
  </blockquote>
  
  <p>I've googled around, and whilst there are some solutions, most of them seem to apply to http and such, and I just can't understand <em>what exactly</em> the problem is.</p>
  
  <p>Apparently I need to cast <em>something</em>, but I can't find the right syntax to do so</p>
  
  <p>If I remove the <code>.debounce(500)</code> then the service works as expected and emits the events</p>
  
  <p>Would appreciate any thoughts, ideas or help ;)</p>