message: docs(filter): add comments
diff: +/** @prettier */
  import { Subscriber } from '../Subscriber';
  import { Observable } from '../Observable';
  import { OperatorFunction, MonoTypeOperatorFunction } from '../types';
  @@ -5,12 +6,10 @@ import { lift } from '../util/lift';
  import { OperatorSubscriber } from './OperatorSubscriber';
  /* tslint:disable:max-line-length */
  -export function filter<T, S extends T>(predicate: (value: T, index: number) => value is S,
  - thisArg?: any): OperatorFunction<T, S>;
  +export function filter<T, S extends T>(predicate: (value: T, index: number) => value is S, thisArg?: any): OperatorFunction<T, S>;
  // NOTE(benlesh): T|null|undefined solves the issue discussed here: https://github.com/ReactiveX/rxjs/issues/4959#issuecomment-520629091
  export function filter<T>(predicate: BooleanConstructor): OperatorFunction<T | null | undefined, NonNullable<T>>;
  -export function filter<T>(predicate: (value: T, index: number) => boolean,
  - thisArg?: any): MonoTypeOperatorFunction<T>;
  +export function filter<T>(predicate: (value: T, index: number) => boolean, thisArg?: any): MonoTypeOperatorFunction<T>;
  /* tslint:enable:max-line-length */
  /**
  @@ -54,17 +53,24 @@ export function filter<T>(predicate: (value: T, index: number) => boolean,
  * @param thisArg An optional argument to determine the value of `this`
  * in the `predicate` function.
  */
  -export function filter<T>(predicate: (value: T, index: number) => boolean,
  - thisArg?: any): MonoTypeOperatorFunction<T> {
  - return function filterOperatorFunction(source: Observable<T>): Observable<T> {
  - return lift(source, function (this: Subscriber<T>, source: Observable<T>) {
  +export function filter<T>(predicate: (value: T, index: number) => boolean, thisArg?: any): MonoTypeOperatorFunction<T> {
  + return (source: Observable<T>) =>
  + lift(source, function (this: Subscriber<T>, source: Observable<T>) {
  const subscriber = this;
  + // An index passed to our predicate function on each call.
  let index = 0;
  - return source.subscribe(new OperatorSubscriber(subscriber, (value) => {
  +
  + // Subscribe to the source, all errors and completions are
  + // forwarded to the consumer.
  + return source.subscribe(
  + new OperatorSubscriber(subscriber, (value) => {
  + // Call the predicate with the appropriate `this` context,
  + // if the predicate returns `true`, then send the value
  + // to the consumer.
  if (predicate.call(thisArg, value, index++)) {
  subscriber.next(value);
  }
  - }))
  + })
  + );
  });
  - };
  }
  