Having trouble with the RxJs merge interface:
export function merge<A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): Observable<A[number]>;
So, based on this information, I developed the following code
const alpha$ = of('alpha').pipe(delay(1000));
const beta$ = of('beta');
const gamma$ = of('gamma').pipe(delay(10));
const y = merge<string[]>(alpha$, beta$, gamma$) as Observable<string[number]>;
Everything was working fine until I attempted a more complex interface
interface Bar<A = unknown, B = { id: string}> {
input: A;
output?: B;
}
const alpha$ = of({input: 'alpha'}).pipe(delay(1000));
const beta$ = of({input: 'beta'});
const gamma$ = of({input: 'gamma'}).pipe(delay(10));
const x = merge<Bar<string>[]>(alpha$, beta$, gamma$) as Observable<Bar<string>[number]>;
This time, it threw an error about number
Type 'Bar<string, { id: string; }>' has no matching index signature for type 'number'. https://i.sstatic.net/PXxQ1.png
I must be missing something here, any suggestions on what my mistake could be?