Skip to content

AsyncIterableX.pipe fallback overload is unexpectedly chosen #386

@andreasdamm-shure

Description

@andreasdamm-shure

The most generic AsyncIterableX.pipe overload

pipe(...operations: OperatorAsyncFunction<any, any>[]): AsyncIterableX<any>;
can end up being chosen by the TypeScript compiler in unexpected circumstances leading to type errors being missed due to an AsyncIterableX of any being returned.

The following function exhibits this behavior:

import { of } from 'ix/asynciterable/index.js';
import { map, tap } from 'ix/asynciterable/operators/index.js';

export function subscribe(): AsyncIterable<{ brand: 'X' }> {
   return of(undefined).pipe(
      map(event => ({ brand: 'Y' })),
      tap()
   );
}

The overload should be removed or at the very least should return an AsyncIterableX of unknown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions