-
-
Notifications
You must be signed in to change notification settings - Fork 146
feat: make piscina entrypoint easier for typescript #801
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: make piscina entrypoint easier for typescript #801
Conversation
65fc6db to
eae9a29
Compare
a343e5e to
143d0d3
Compare
metcoder95
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this, but sadly it imposes a breaking change in the current version; can we aim to add a fallback to the current behavior if the generic passed is not an object?
I played around with the code a bit to see if it was possible, unfortunately I think it's not possible (or I don't know enough TS) to make it backwards compatible. |
|
I'm thinking on function overloads, but not sure if they can be applied to classes 🤔 Otherwise, we can point this feature directly to v6, but will take some time to land as it will be aimed to next year. |
I thought the same but couldn't get it to work, seems it's not possible.
I'm fine with this going to v6. If someone later finds a way to backport it without breaking compatibility that would be great. |
|
Perfect, then let's do this. I'll sync If willing, we can give it a try to backport it aftewards, otherwise we can open an Issue for someone that might be interested in contribute |
|
This issue has been marked as stale because it has been opened 45 days without activity. Remove stale label or comment or this will be closed in 10 days. |
143d0d3 to
234d5b9
Compare
|
@metcoder95 rebased to the current branch. Can you approve the workflows run again? |
|
CI failures on Windows are expected; not related to you PR |
217acd4 to
6cf8f01
Compare
|
Test seems to fail :( |
Pushed another commit, this should fix it now. |
|
Seems like it still doesn't like it |
|
|
Thanks for the contribution! |
This is technically a breaking change in the typescript api.
Changed the generics from
to
Also works with multiple exports:
This (imo) improves the typescript usage by reducing the amount of code needed to properly type the worker function.