-
Notifications
You must be signed in to change notification settings - Fork 628
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
type issue in CronJob #869
Comments
Hey @pratikkajare, sorry for the delay. This error is usually because of a mismatch between the Given the error message, I'd say you're using v3 while using an older |
Regarding the typing of This behavior was changed in v3.0.0 by PR #519. |
We had to work around this too. https://github.com/backstage/backstage/pull/24061/files The reason is that you're depending on You may want to release a version that has an updated type dependency range. |
Thanks for the heads up, will look into that tonight! |
@freben just merged #831 and released v3.1.7, that should solve your issue 😃 @pratikkajare I still think your issue is related to a version mismatch, so probably stick to my first comment in the first time 😉 Let me know if there's anything more I can do! |
Nice, thanks! |
thank you so much |
Description
There is an issue with this line of code:
// here is package issue with Argument of type 'CronJob<any, any> from 'cron'. This is causing an error and needs to be fixed. This can be resolved by modifying the code to ensure the correct argument type is passed.
-- this.schedulerRegistry.addCronJob(name, job);
Expected Behavior
.
Actual Behavior
.
Possible Fix
By changing the return type of the
nextDates()
function toDateTime | DateTime[]
, we can enhance the flexibility and efficiency of the code. Therefore, I recommend making this change. Thank you.like... public nextDates(): DateTime | DateTime[];
Steps to Reproduce
just call this function using ts.
addCronJob(name: string, seconds: string) {
const job = new CronJob(
${seconds} * * * * *
, () => {this.logger.warn(
time (${seconds}) for job ${name} to run!
);});
this.schedulerRegistry.addCronJob(name, job); // here will get the type error
job.start();
this.logger.warn(
job ${name} added for each minute at ${seconds} seconds!
,);
}
Context
giving type error in typescript code
Your Environment
cron
version: 3.1.6The text was updated successfully, but these errors were encountered: