bullmq
bullmq copied to clipboard
[Bug]: job.data does not return the typed object.
Version
v.5.7.4
Platform
NodeJS
What happened?
After setting up the handlers, I realize the job.data arrives untyped. This objects are instantiated from classes, so private members become public and functions undefined.
How to reproduce.
add a job with a custom object.
Relevant log output
job.data.getTimestamp is not a function
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
I solved it temporally with a static variable to re-instantiate the object, although this misses the entire point of using . *I really wish there would be a workaround for this. (nothing to find at the docs) TypeScript: static serializeMessage(unserializedMessage: any): Message { return new Message( unserializedMessage.token, unserializedMessage.emitter_name, unserializedMessage.msg, unserializedMessage.delay, unserializedMessage.timestamp, unserializedMessage.attachments, ); }
I don't think there is an issue here, can you provide specific typescript code so that we can understand what you mean?