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

Implement asyncPipe #643

Merged
merged 10 commits into from
Oct 25, 2018
Merged

Implement asyncPipe #643

merged 10 commits into from
Oct 25, 2018

Conversation

kennylavender
Copy link
Contributor

@kennylavender kennylavender commented Oct 25, 2018

PR Process - PR Review Checklist

Release

Semantic release is enabled for this repository. Make sure you follow the right commit message convention.
We're using semantic-release's default — Angular Commit Message Conventions.

Description of Changes

I couldn't find a way to use better types than any. Let me know if you have ideas.

I am using .catch instead of RITEways Try because RITEways Try does not await promises and can still crash the test runner.

@@ -0,0 +1,4 @@
type Func = (v?: any) => any | Promise<any>
Copy link
Member

@lautarodragan lautarodragan Oct 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly TypeScript doesn't have any decent support for the the most important FP functions like curry, compose, pipe... and even some cases of reduce. See this comment by one of the authors of Ramda's type declarations, and the Variadict Kinds Proposal.

You can hack around TS' limitation by providing one function overload per function arity.

It isn't pretty or very maintainable, but I think it still would add a lot of value since we rarely compose/pipe too many functions and it'd give us type safety in our pipes.

Wanna give it a shot?

Feel free to merge as-is though, code looks good and the tests are awesome.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, for some reason I though they had solved it partial in TS 3.0, but when I started looking around it seems they have not.

I think I will merge this as is, then I will go back and add the better typings.

Copy link
Member

@lautarodragan lautarodragan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • [no] Tested changes manually
  • Checked accidental architectural/style changes
  • Reviewed entire diff
  • Unit tests
  • [n/a] Documentation
  • Filenames and locations

@kennylavender kennylavender merged commit 31c2cf3 into master Oct 25, 2018
@kennylavender kennylavender deleted the async-pipe branch October 25, 2018 02:28
@poet-ci
Copy link

poet-ci commented Oct 25, 2018

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants