From 24dd079404a315416c274016eeaca3ed35786da5 Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Thu, 8 Apr 2021 17:52:02 +1000 Subject: [PATCH 1/2] test(merge): add failing single-array test --- spec/observables/merge-spec.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/observables/merge-spec.ts b/spec/observables/merge-spec.ts index 249b0325a9..1fce9107b7 100644 --- a/spec/observables/merge-spec.ts +++ b/spec/observables/merge-spec.ts @@ -282,4 +282,10 @@ describe('merge(...observables, Scheduler, number)', () => { expect(e1Subscribed).to.be.false; }); + + it('should deem a single array argument to be an ObservableInput', () => { + const array = ['foo', 'bar']; + const expected = '(fb|)'; + expectObservable(merge(array)).toBe(expected, { f: 'foo', b: 'bar' }); + }); }); From 24cb05523727b35fdca2e84bf3f150fc75d65ba2 Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Thu, 8 Apr 2021 17:53:09 +1000 Subject: [PATCH 2/2] fix(merge): single array is not an array of sources --- src/internal/observable/merge.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/internal/observable/merge.ts b/src/internal/observable/merge.ts index 5291388779..830f27a3fd 100644 --- a/src/internal/observable/merge.ts +++ b/src/internal/observable/merge.ts @@ -2,7 +2,6 @@ import { Observable } from '../Observable'; import { ObservableInput, ObservableInputTuple, SchedulerLike } from '../types'; import { mergeAll } from '../operators/mergeAll'; import { internalFromArray } from './fromArray'; -import { argsOrArgArray } from '../util/argsOrArgArray'; import { innerFrom } from './from'; import { EMPTY } from './empty'; import { popNumber, popScheduler } from '../util/args'; @@ -84,7 +83,7 @@ export function merge(...args: [...ObservableInput export function merge(...args: (ObservableInput | number | SchedulerLike)[]): Observable { const scheduler = popScheduler(args); const concurrent = popNumber(args, Infinity); - const sources = argsOrArgArray(args) as ObservableInput[]; + const sources = args as ObservableInput[]; return !sources.length ? // No source provided EMPTY