这是indexloc提供的服务,不要输入任何密码
Skip to content

feature(f.promisify): Add F.Promisify type #72

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

Merged
merged 3 commits into from
Nov 21, 2019

Conversation

Andarist
Copy link
Contributor

@Andarist Andarist commented Nov 18, 2019

🎁 Pull Request

  • Used a clear / meaningful title for this pull request
  • Tested the changes in your own code (on your projects)
  • Added / Edited tests to reflect changes (tst folder)
  • Have read the Contributing part of the Readme
  • Passed npm test

Gonna add tests once you give me a green light on this one - I've created this PR rather quickly, but looks that understanding how tests are actually written might take a little bit more time, so I've postponed it for now.

Why have you made changes?

It was a useful type that I have used in my project and thought it might find its home here as well.

Is there any breaking changes?

  • Yes, I changed the public API & documented it
  • Yes, I changed existing tests
  • No, I added to the public API & documented it
  • No, I added to the existing tests
  • I don't know

@Andarist Andarist requested a review from millsp as a code owner November 18, 2019 14:02
Copy link
Owner

@millsp millsp left a comment

Choose a reason for hiding this comment

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

Hey, would you mind adding a few simple tests? Then I'll merge your PR :)

@Andarist
Copy link
Contributor Author

Cool, I'll add tests - might take me a few days as I'm pretty busy at the moment, gonna ping you when I'm done. Cheers!

@Andarist
Copy link
Contributor Author

@pirix-gh I've added test + changed the implementation to handle promise flattening, which kinda should be handled by TS on its own, but unfortunately it is not and the issue about it is in their tracker

@@ -12,4 +12,6 @@ import {Return} from './Return'
* type test0 = F.Promisify<(a: number) => number> // (a: number) => Promise<number>
* ```
*/
export type Promisify<F extends Function> = (...args: Parameters<F>) => Promise<Return<F>>
export type Promisify<F extends Function> = Return<F> extends Promise<any>
Copy link
Owner

Choose a reason for hiding this comment

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

Nice

@millsp millsp merged commit bbc6d11 into millsp:master Nov 21, 2019
@millsp
Copy link
Owner

millsp commented Nov 21, 2019

🎉

Thanks for your contribution!

@Andarist Andarist deleted the pr/f-promisify branch December 10, 2019 21:27
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

Successfully merging this pull request may close these issues.

2 participants