Missing CronJob type generics in SchedulerRegistry.addCronJob
nerdstep opened this issue · 3 comments
nerdstep commented
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.
Minimum reproduction code
https://github.com/nestjs/schedule/blob/master/lib/scheduler.registry.ts#L50
Steps to reproduce
- Create a new instance of
CronJob
with anonComplete
callback defined. - 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
kamilmysliwiec commented
Would you like to create a PR for this issue?
nerdstep commented
Hey @kamilmysliwiec yeah I can put in a PR for this, no problem.
kamilmysliwiec commented
Let's track this here #1538