ReactiveX/rxjs · error · Error
Scheduler-backed generate is not supported by this Symbol co
Error message
Scheduler-backed generate is not supported by this Symbol contract.
What it means
generate() in RxJS Next has no scheduler support. When called with a single options object, presence of a 'scheduler' property with a non-undefined value throws, because scheduler-backed timing is outside the Symbol contract.
Source
Thrown at packages/rxjs/src/generate.ts:43
}
}
Observable[generate] = function generateImpl<T, S>(
this: ObservableCtor,
initialStateOrOptions: S | GenerateOptions<T, S>,
condition?: (state: S) => boolean,
iterate?: (state: S) => S,
resultSelector?: (state: S) => T
): Observable<T | S> {
let initialState: S;
let selectedCondition: ((state: S) => boolean) | undefined;
let selectedIterate: (state: S) => S;
let selectedResult: (state: S) => T | S;
if (arguments.length === 1) {
const options = initialStateOrOptions as GenerateOptions<T, S>;
if ('scheduler' in (options as object) && (options as GenerateOptions<T, S> & { scheduler?: unknown }).scheduler !== undefined) {
throw new Error('Scheduler-backed generate is not supported by this Symbol contract.');
}
initialState = options.initialState;
selectedCondition = options.condition;
selectedIterate = options.iterate;
selectedResult = options.resultSelector ?? ((state) => state);
} else {
if (arguments.length > 4) {
throw new Error('Scheduler-backed generate is not supported by this Symbol contract.');
}
initialState = initialStateOrOptions as S;
selectedCondition = condition;
selectedIterate = iterate as (state: S) => S;
selectedResult = resultSelector ?? ((state) => state);
}
return this[create]((subscriber) => {
let state = initialState;
View on GitHub (pinned to 54796b38a5)
Solutions
- Delete the scheduler property from the options object
- Apply scheduling after generation: generate({...}).pipe(observeOn-like operator) or in the testing layer use the TestScheduler marble harness
Example fix
// before
generate({ initialState: 0, iterate: s => s + 1, scheduler: asyncScheduler });
// after
generate({ initialState: 0, iterate: s => s + 1 }); Defensive patterns
Strategy: validation
Validate before calling
const { scheduler: _ignored, ...opts } = options; // strip legacy key
obs ?? generate(opts); Type guard
const hasScheduler = (o: object) => 'scheduler' in o && (o as any).scheduler !== undefined;
Prevention
- Destructure out scheduler when reusing legacy option objects
- Move timing to the pipeline or the test scheduler
When it happens
Trigger: generate({ initialState: 0, condition: s => s < 5, iterate: s => s + 1, scheduler: asyncScheduler }).
Common situations: RxJS 7 code that used generate with a scheduler (common in tests and polling) running unchanged against RxJS Next, or copy-pasted options including scheduler: null from docs.
Related errors
- RxJS Next expand does not support a scheduler argument.
- Scheduler-backed publishReplay is not supported by this Symb
- Scheduler-backed shareReplay is not supported by this Symbol
- A combineLatest projection requires an array of observable v
- RxJS Next expand options must be an object.
AI-assisted analysis of ReactiveX/rxjs@54796b38a5 (2026-08-28).
Data as JSON: /api/errors/c7a4d55f7c1525fd.
Report an issue: GitHub.