Skip to content

Wrong return typing of pipe operator #518

Open
@WendtOle

Description

@WendtOle

Hi,

an operator only consisting of a pipe like the following:

export const positiveFeedback = pipe(() => Promise.resolve({ success: true }));

has for some reason NOT a type like: () => Promise<{success: true}>, but INSTEAD following type: () => Promise<Promise<{success: true}>> which isn't really possible.

I created a minimal example in codesandbox demonstrating the problem.
In src/App/App.tsx you can find the following:

const fails: () => Promise<{ success: boolean }> =
   actions.demo.positiveFeedback;

const works: () => Promise<Promise<{ success: boolean }>> =
   actions.demo.positiveFeedback;

const workaround: () => Promise<{ success: boolean }> = async () =>
   await actions.demo.positiveFeedback();

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