hunk.code_window: | `asyncScheduler`          | Schedules work with `setInterval`. Use this for time-based operations.                                                                                                         |
   | `animationFrameScheduler` | Schedules task that will happen just before next browser content repaint. Can be used to create smooth browser animations.                                                     |
   ## Using Schedulers
   You may have already used schedulers in your RxJS code without explicitly stating the type of schedulers to be used. This is because all Observable operators that deal with concurrency have optional schedulers. If you do not provide the scheduler, RxJS will pick a default scheduler by using the principle of least concurrency. This means that the scheduler which introduces the least amount of concurrency that satisfies the needs of the operator is chosen. For example, for operators returning an observable with a finite and small number of messages, RxJS uses no Scheduler, i.e. `null` or `undefined`. For operators returning a potentially large or infinite number of messages, `queue` Scheduler is used. For operators which use timers, `async` is used.
   Because RxJS uses the least concurrency scheduler, you can pick a different scheduler if you want to introduce concurrency for performance purpose. To specify a particular scheduler, you can use those operator methods that take a scheduler, e.g., `from([10, 20, 30], asyncScheduler)`.
   **Static creation operators usually take a Scheduler as argument.** For instance, `from(array, scheduler)` lets you specify the Scheduler to use when delivering each notification converted from the `array`. It is usually the last argument to the operator. The following static creation operators take a Scheduler argument:
  
hunk.labels: keep keep keep keep keep replace keep keep keep keep keep
hunk.after_edit: You may have already used schedulers in your RxJS code without explicitly stating the type of schedulers to be used. This is because all Observable operators that deal with concurrency have optional schedulers. If you do not provide the scheduler, RxJS will pick a default scheduler by using the principle of least concurrency. This means that the scheduler which introduces the least amount of concurrency that satisfies the needs of the operator is chosen. For example, for operators returning an observable with a finite and small number of messages, RxJS uses no Scheduler, i.e. `null` or `undefined`. For operators returning a potentially large or infinite number of messages, `queueScheduler` Scheduler is used. For operators which use timers, `async` is used.
  
hunk.file_path: docs_app/content/guide/scheduler.md
hunk.type: replace
file: import { Observable, of } from 'rxjs';
  import { filter, map } from 'rxjs/operators';
  
  it('should support a predicate', () => {
    const o = of(1, 2, 3).pipe(filter(value => value < 3)); // $ExpectType Observable<number>
  });
  
  it('should support a predicate with an index', () => {
    const o = of(1, 2, 3).pipe(filter((value, index) => index < 3)); // $ExpectType Observable<number>
  });
  
  it('should support a predicate and an argument', () => {
    const o = of(1, 2, 3).pipe(filter(value => value < 3, 'bonjour')); // $ExpectType Observable<number>
  });
  
  it('should support a user-defined type guard', () => {
    const o = of(1, 2, 3).pipe(filter((value: number): value is 1 => value < 3)); // $ExpectType Observable<1>
  });
  
  it('should support a user-defined type guard with an index', () => {
    const o = of(1, 2, 3).pipe(filter((value: number, index): value is 1 => index < 3)); // $ExpectType Observable<1>
  });
  
  it('should support a user-defined type guard and an argument', () => {
    const o = of(1, 2, 3).pipe(filter((value: number): value is 1 => value < 3, 'hola')); // $ExpectType Observable<1>
  });
  
  it('should enforce types', () => {
    const o = of(1, 2, 3).pipe(filter()); // $ExpectError
  });
  
  it('should enforce predicate types', () => {
    const o = of(1, 2, 3).pipe(filter(value => value < '3')); // $ExpectError
    const p = of(1, 2, 3).pipe(filter((value, index) => index < '3')); // $ExpectError
  });
  
  it('should enforce user-defined type guard types', () => {
    const o = of(1, 2, 3).pipe(filter((value: string): value is '1' => value < '3')); // $ExpectError
    const p = of(1, 2, 3).pipe(filter((value: number, index): value is 1 => index < '3')); // $ExpectError
  });
  
  it('should support Boolean as a predicate', () => {
    const o = of(1, 2, 3).pipe(filter(Boolean)); // $ExpectType Observable<number>
    const p = of(1, null, undefined).pipe(filter(Boolean)); // $ExpectType Observable<number>
    const q = of(null, undefined).pipe(filter(Boolean)); // $ExpectType Observable<never>
    const r = of(true).pipe(filter(Boolean)); // $ExpectType Observable<true>
    const s = of(false as const).pipe(filter(Boolean)); // $ExpectType Observable<never>
    const t = of(0 as const, -0 as const, 1 as const).pipe(filter(Boolean)); // $ExpectType Observable<1>
    const u = of(0 as const, -0 as const).pipe(filter(Boolean)); // $ExpectType Observable<never>
    const v = of('' as const, "foo" as const, "bar" as const).pipe(filter(Boolean)); // $ExpectType Observable<"foo" | "bar">
    const w = of('' as const).pipe(filter(Boolean)); // $ExpectType Observable<never>
    // Intentionally weird looking test... `false` is `boolean`, which is `true | false`.
    const x = of(false, false, false, false).pipe(filter(Boolean)); // $ExpectType Observable<true>
  });
  
  // I've not been able to effect a failing dtslint test for this situation and a
  // conventional test won't fail because the TypeScript configuration isn't
  // sufficiently strict:
  // https://github.com/ReactiveX/rxjs/issues/4959#issuecomment-520629091
  it('should support inference from a return type with Boolean as a predicate', () => {
    interface I {
      a: string | null;
    }
  
    const i$: Observable<I> = of();
    const s$: Observable<string> = i$.pipe(map(i => i.a), filter(Boolean)); // $ExpectType Observable<string>
  });
  
  it('should support inference from a generic return type of the predicate', () => {
    function isDefined<T>() {
      return (value: T|undefined|null): value is T => {
        return value !== undefined && value !== null;
      };
    }
  
    const o$ = of(1, null, {foo: 'bar'}, true, undefined, 'Nick Cage').pipe(filter(isDefined())); // $ExpectType Observable<string | number | boolean | { foo: string; }>
  });
  
  it('should support inference from a predicate that returns any', () => {
    function isTruthy(value: number): any {
      return !!value;
    }
  
    const o$ = of(1).pipe(filter(isTruthy)); // $ExpectType Observable<number>
  });
  
  it('should support this', () => {
    const thisArg = { limit: 5 };
    const a = of(1, 2, 3).pipe(filter(function (val) {
      const limit = this.limit; // $ExpectType number
      return val < limit;
    }, thisArg));
  });
  
  it('should deprecate thisArg usage', () => {
    const a = of(1, 2, 3).pipe(filter(Boolean)); // $ExpectNoDeprecation
    const b = of(1, 2, 3).pipe(filter(Boolean, {})); // $ExpectDeprecation
    const c = of(1, 2, 3).pipe(filter((value) => Boolean(value))); // $ExpectNoDeprecation
    const d = of(1, 2, 3).pipe(filter((value) => Boolean(value), {})); // $ExpectDeprecation
  });