{"record":{"id":"68c21ce35156514d","repo":"ReactiveX/rxjs","slug":"rxjs-next-expand-does-not-support-a-scheduler-argu","errorCode":null,"errorMessage":"RxJS Next expand does not support a scheduler argument.","messagePattern":"RxJS Next expand does not support a scheduler argument\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/rxjs/src/expand.ts","lineNumber":22,"sourceCode":"export const expand: unique symbol = Symbol('expand');\n\nexport interface ExpandOptions {\n  concurrent?: number;\n}\n\ndeclare global {\n  interface Observable<T> {\n    [expand]<R>(project: (value: T, index: number) => ObservableValue<R>, options?: ExpandOptions): Observable<T | R>;\n  }\n}\n\nObservable.prototype[expand] = function <T, R>(\n  this: Observable<T>,\n  project: (value: T, index: number) => ObservableValue<R>,\n  options?: ExpandOptions\n): Observable<T | R> {\n  if (arguments.length > 2) {\n    throw new TypeError('RxJS Next expand does not support a scheduler argument.');\n  }\n  if (options !== undefined && (typeof options !== 'object' || options === null)) {\n    throw new TypeError('RxJS Next expand options must be an object.');\n  }\n\n  const configuredConcurrency = options?.concurrent ?? Infinity;\n  const concurrency = configuredConcurrency >= 1 ? configuredConcurrency : Infinity;\n\n  return this[create]((subscriber) => {\n    const queue: Array<T | R> = [];\n    let active = 0;\n    let index = 0;\n    let sourceComplete = false;\n    let draining = false;\n\n    const checkComplete = (): void => {\n      if (sourceComplete && active === 0 && queue.length === 0 && subscriber.active) {\n        subscriber.complete();","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/ReactiveX/rxjs/blob/54796b38a57e6309f9861e174737479bb3f63f61/packages/rxjs/src/expand.ts#L4-L40","documentation":"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.","triggerScenarios":"observable[expand](project, undefined, queueScheduler) or any expand call with arguments.length > 2, including accidentally passing an extra config value positionally.","commonSituations":"Running RxJS 7 application code against RxJS Next without migration; code that used expand(fn, undefined, asyncScheduler) for concurrency/timing control.","solutions":["Remove the scheduler argument; use the options object instead: expand(project, {concurrent: n})","For timing control, apply observeOn/observeOn-like scheduling on the resulting stream instead of inside expand","Run the @rxjs/migrate codemods to strip legacy scheduler arguments"],"exampleFix":"// before\nsource[expand](fn, undefined, queueScheduler);\n// after\nsource[expand](fn, { concurrent: 5 });","handlingStrategy":"validation","validationCode":"if (arguments.length > 2) throw new TypeError('no scheduler support');\n// enforce: expand(project, options?)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass a third argument to expand","Express concurrency via { concurrent: n }","Run scheduler-removal codemods during RxJS Next migration"],"tags":["expand","scheduler","rxjs-next","migration","removed-api"],"backgroundTag":"removed-scheduler-argument","analyzedSha":"54796b38a57e6309f9861e174737479bb3f63f61","analyzedAt":"2026-08-28T10:21:27.410Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}