ReactiveX/rxjs · error · TypeError

RxJS Next expand does not support a scheduler argument.

Error message

RxJS Next expand does not support a scheduler argument.

What it means

RxJS Next's expand Symbol operator removed scheduler support. Passing a third positional argument (the legacy RxJS 7 scheduler slot) throws immediately, because scheduling is no longer part of the platform contract.

Source

Thrown at packages/rxjs/src/expand.ts:22

export const expand: unique symbol = Symbol('expand');

export interface ExpandOptions {
  concurrent?: number;
}

declare global {
  interface Observable<T> {
    [expand]<R>(project: (value: T, index: number) => ObservableValue<R>, options?: ExpandOptions): Observable<T | R>;
  }
}

Observable.prototype[expand] = function <T, R>(
  this: Observable<T>,
  project: (value: T, index: number) => ObservableValue<R>,
  options?: ExpandOptions
): Observable<T | R> {
  if (arguments.length > 2) {
    throw new TypeError('RxJS Next expand does not support a scheduler argument.');
  }
  if (options !== undefined && (typeof options !== 'object' || options === null)) {
    throw new TypeError('RxJS Next expand options must be an object.');
  }

  const configuredConcurrency = options?.concurrent ?? Infinity;
  const concurrency = configuredConcurrency >= 1 ? configuredConcurrency : Infinity;

  return this[create]((subscriber) => {
    const queue: Array<T | R> = [];
    let active = 0;
    let index = 0;
    let sourceComplete = false;
    let draining = false;

    const checkComplete = (): void => {
      if (sourceComplete && active === 0 && queue.length === 0 && subscriber.active) {
        subscriber.complete();

View on GitHub (pinned to 54796b38a5)

Solutions

  1. Remove the scheduler argument; use the options object instead: expand(project, {concurrent: n})
  2. For timing control, apply observeOn/observeOn-like scheduling on the resulting stream instead of inside expand
  3. Run the @rxjs/migrate codemods to strip legacy scheduler arguments

Example fix

// before
source[expand](fn, undefined, queueScheduler);
// after
source[expand](fn, { concurrent: 5 });
Defensive patterns

Strategy: validation

Validate before calling

if (arguments.length > 2) throw new TypeError('no scheduler support');
// enforce: expand(project, options?)

Prevention

When it happens

Trigger: observable[expand](project, undefined, queueScheduler) or any expand call with arguments.length > 2, including accidentally passing an extra config value positionally.

Common situations: Running RxJS 7 application code against RxJS Next without migration; code that used expand(fn, undefined, asyncScheduler) for concurrency/timing control.

Related errors


AI-assisted analysis of ReactiveX/rxjs@54796b38a5 (2026-08-28). Data as JSON: /api/errors/68c21ce35156514d. Report an issue: GitHub.