-
Notifications
You must be signed in to change notification settings - Fork 407
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: add Serialize type #2578
base: master
Are you sure you want to change the base?
feat: add Serialize type #2578
Conversation
This is an interesting PR. I wonder if you have a link with more information regarding the type Serialize, as I guess this has been discussed in some other forums, it is not completely trivial to understand how it works. Also as you mentioned, it will imply a breaking change so we need to plan this change carefully. |
how can we know that the implementation of Serialize is correct? |
The remix team uses a bunch of utilities that will raise a typescript error if something is wrong. I can implement those as well. Check them here. |
Is the remix license incompatible with BullMQ? I wondering in case we could just use that code as is? |
The licensing is not really my best field, but remix.run is under the MIT, so it should be fully compatible with BullMQ.
I truly understand your worries but the version in this PR is a little better to the remix.run, primary on the |
This latest commit fixes a previous typo for the serialization of |
I think that before we can merge this we are going to need a pretty good test coverage to avoid breaking existing codebases if for instance typescript would complain on legitimate types and so on. |
I completely agree, let me know how I can help |
Changelog
Currently BullMQ is lying with the data type workers operate with.
Consider the following code:
This is because the type we use does not correctly reppresent the
data
object we think we operate with. You can imaginedata
declared asdata = JSON.parse(JSON.stringify(...));
.This PR adds the
Serialize
type used by theWorker
class.The
Serialize
type serializes theDataType
we pass to theWorker
. With this the previous example correctly raise a compilation error in ts.Notes
Please note that this is likely to be a breaking change, since some users may just pass around the
data
object without any checking.