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

Add types for event emitters #147

Closed
moltar opened this issue Mar 2, 2020 · 3 comments
Closed

Add types for event emitters #147

moltar opened this issue Mar 2, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@moltar
Copy link

moltar commented Mar 2, 2020

In this kind of code, the job is not properly typed.

worker.on('completed', job => {
  console.log(job)
})

Would be ideal, if this had at least the Job type, but ideally propagate the type all the way from the worker generic to the job.

May also find the following modules interesting:

@manast manast added the enhancement New feature or request label Mar 2, 2020
@manast
Copy link
Contributor

manast commented Mar 2, 2020

yes, this is a know limitation. Not so trivial to do in practice at least I did not find a really good way to solve it.

@manast
Copy link
Contributor

manast commented Mar 2, 2020

btw, won't add a new dependency only for events, but thanks for the reference to the modules, they can be used for inspiration.

@roggervalf
Copy link
Collaborator

@moltar please try last version, event listener typing was added

manast added a commit that referenced this issue Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants