ReactiveX/rxjs · error · TypeError
Must combine observable instance with an array of observable
Error message
Must combine observable instance with an array of observable values
What it means
When combineLatest is invoked on an Observable instance (this[combineLatest](...)), RxJS Next requires the argument to be an array of observable sources; passing anything else (an object, a single observable, a function) is a type error.
Source
Thrown at packages/rxjs/src/combine-latest.ts:56
};
}
}
Observable[combineLatest] = combineLatestImpl;
Observable.prototype[combineLatest] = combineLatestImpl;
function combineLatestImpl<Sources extends readonly ObservableValue<any>[] | { [key: string]: ObservableValue<any> }>(
this: ObservableCtor | Observable<any>,
sources: Sources,
configOrProject?: { requireAllValues?: boolean } | ((...values: any[]) => any)
): Observable<CombineLatestValues<Sources> | any> {
const project = typeof configOrProject === 'function' ? configOrProject : undefined;
const config = typeof configOrProject === 'object' && configOrProject !== null ? configOrProject : {};
const { requireAllValues = true } = config;
if (isObservableInstance(this)) {
if (!Array.isArray(sources)) {
throw new TypeError('Must combine observable instance with an array of observable values');
}
const combined = this[combine](
sources.map((source) => ({
source,
requireFirstValue: requireAllValues,
}))
);
return project === undefined ? (combined as any) : combined[map]((values) => project(...values));
}
const actualSources: readonly ObservableValue<any>[] | { [key: string]: ObservableValue<any> } = Array.isArray(sources)
? [...sources]
: { ...sources };
if (isSourceArray(actualSources)) {
const combined = this[combine](
actualSources.map((source) => ({
source,View on GitHub (pinned to 54796b38a5)
Solutions
- Pass an array: observable[combineLatest]([other1, other2])
- If you have a dictionary of sources, use the static/standalone combineLatest({a: obsA, b: obsB}) form instead of the instance form
- Wrap dynamic arguments: observable[combineLatest](Array.from(iterableOfSources))
Example fix
// before const combined = a[combineLatest](b); // after const combined = a[combineLatest]([b]);
Defensive patterns
Strategy: type-guard
Validate before calling
if (!Array.isArray(sources)) throw new TypeError('expected array of sources');
obs[combineLatest](sources); Type guard
const isObservableArray = (v: unknown): v is Observable<any>[] => Array.isArray(v) && v.every((s) => typeof (s as any)?.[Symbol.observable] === 'function' || s instanceof Observable);
Prevention
- Always pass a literal array to the instance combineLatest form
- Use the dictionary form only with the standalone combineLatest function
- Type the parameter as Observable<T>[] so the compiler catches misuse
When it happens
Trigger: observable[combineLatest](sourceB) or observable[combineLatest]({a: obsA}) — instance form requires combineLatest([obsB]) with a literal array. Also triggered by spreading a non-array iterable or passing undefined.
Common situations: Migrating RxJS 7 code where combineLatestInstance accepted different shapes, or dynamically building the sources argument and accidentally passing a single observable or an object dictionary to the instance form.
Related errors
- A combineLatest projection requires an array of observable v
- refCount requires a ConnectableObservable
- Unknown mode: ${mode}
- Unknown framework: ${framework}
- Unknown option: ${argument}
AI-assisted analysis of ReactiveX/rxjs@54796b38a5 (2026-08-28).
Data as JSON: /api/errors/be22839d55da0cf7.
Report an issue: GitHub.