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

[Bug]: job.data does not return the typed object. #2539

Open
1 task done
rcfrias opened this issue Apr 23, 2024 · 2 comments
Open
1 task done

[Bug]: job.data does not return the typed object. #2539

rcfrias opened this issue Apr 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@rcfrias
Copy link

rcfrias commented Apr 23, 2024

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

  • I agree to follow this project's Code of Conduct
@rcfrias rcfrias added the bug Something isn't working label Apr 23, 2024
@rcfrias
Copy link
Author

rcfrias commented Apr 23, 2024

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,
);
}

@manast
Copy link
Contributor

manast commented Apr 23, 2024

I don't think there is an issue here, can you provide specific typescript code so that we can understand what you mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants