Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong return typing of pipe operator #518

Open
WendtOle opened this issue Jun 24, 2021 · 1 comment
Open

Wrong return typing of pipe operator #518

WendtOle opened this issue Jun 24, 2021 · 1 comment

Comments

@WendtOle
Copy link

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();
@arturjzapater
Copy link
Collaborator

arturjzapater commented Aug 4, 2021

@christianalfoni , I don't know how you handle contributions (I looked but couldn't find a contributing guide anywhere), but I'd be happy to have a look at this issue, if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants