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

Missing CronJob type generics in SchedulerRegistry.addCronJob #1537

Closed
2 of 4 tasks
nerdstep opened this issue Jan 4, 2024 · 3 comments
Closed
2 of 4 tasks

Missing CronJob type generics in SchedulerRegistry.addCronJob #1537

nerdstep opened this issue Jan 4, 2024 · 3 comments
Labels
bug Something isn't working needs triage

Comments

@nerdstep
Copy link

nerdstep commented Jan 4, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

The SchedulerRegistry.addCronJob method should implement the CronJob type generics:

addCronJob<T = null, C = null>(name: string, job: CronJob<T, C>): void;

Otherwise a type error occurs when the onComplete function is defined.

image

Minimum reproduction code

https://github.com/nestjs/schedule/blob/master/lib/scheduler.registry.ts#L50

Steps to reproduce

  1. Create a new instance of CronJob with an onComplete callback defined.
  2. Call schedulerRegistry.addCronJob with the job instance

Expected behavior

Expected not to receive a type error when onComplete callback is defined.

Package version

4.0.0

NestJS version

10.3.0

Node.js version

18.18.2

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@nerdstep nerdstep added bug Something isn't working needs triage labels Jan 4, 2024
@kamilmysliwiec
Copy link
Member

Would you like to create a PR for this issue?

@nerdstep
Copy link
Author

nerdstep commented Jan 5, 2024

Hey @kamilmysliwiec yeah I can put in a PR for this, no problem.

@kamilmysliwiec
Copy link
Member

Let's track this here #1538

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

No branches or pull requests

2 participants