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

feat: preserves overloads for non-async functions #22

Conversation

ahrjarrett
Copy link
Contributor

Partially addresses #17

For the async functions you're going to need to do something else (you could probably figure something out by combining the overloads type in the linked TS issue, followed by UnionToIntersection?).

@rexfordessilfie rexfordessilfie self-requested a review December 18, 2023 20:46
Copy link
Owner

@rexfordessilfie rexfordessilfie left a comment

Choose a reason for hiding this comment

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

Thanks for working on this. This works well 🙌 ! Left a couple comments we could look into. We can also circle back to address them on subsequent PRs. Thank you again 💯.

@rexfordessilfie
Copy link
Owner

Partially addresses #17

For the async functions you're going to need to do something else (you could probably figure something out by combining the overloads type in the linked TS issue, followed by UnionToIntersection?).

Thanks again for working on this! For regular and async functions I think types are preserved on wrapped functions if we use an explicit return type on the wrapper or type cast the returned wrapped function (newFn)? The limitation is when we want to modify any of the parameter or return types. Do you see this as the case too?

@rexfordessilfie
Copy link
Owner

Thanks for work on this @ahrjarrett. I made a few changes to simplify things and will merge in now! I will rollout the changes to other wrappers next.

@rexfordessilfie rexfordessilfie merged commit 9b0f4b9 into rexfordessilfie:main Feb 14, 2024
0 of 2 checks passed
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