Skip to content

Wrong typescript type for $.ap() #547

@vlinder

Description

@vlinder

ap<B, C>(fs: Stream<(a: A) => B>): Stream<C>;

Not sure how this can have survived for so long, but this type suggests that you should pass a stream of functions to f$.ap() when in fact you should pass a stream of values.

The typings below should be the correct ones.

    ap<
      B = A extends (x: infer B) => any ? B : never,
      C = A extends (x: any) => infer C ? C : never
    >(
      x$: Stream<B>
    ): Stream<C>;

This also works

    ap(
      x$: Stream<A extends (x: infer B) => any ? B : never>
    ): Stream<A extends (x: any) => infer C ? C : never>;

Should I make a PR?

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