When specifying CronItemOptions
, backfillPeriod
is not optional in TypeScript
#495
Labels
good first issue
Good for newcomers
Summary
I'm defining my cronList as an array of
CronItem
s, so that I can later pass them throughparseCronItems
. This has worked great! (Thank you very much for the library!)Today, I wanted to add
maxAttempts: 1
to one of myCronItem
s, and created anoptions
object for that. TypeScript started complaining that the options must have abackfillPeriod
key.Steps to reproduce
Use this code:
Expected results
I'd expect the key to be optional, like the other options in
CronItemOptions
.Actual results
At runtime, this seems to work correctly and I don't see any issues. The problem is only the type error.
Additional context
Possible Solution
I think the problem is that Graphile Worker uses the same interface internally and externally. If I understand correctly, the
backfillPeriod
is defaulted to 0 here:worker/src/crontab.ts
Lines 151 to 153 in 436e299
So it makes sense that internally,
backfillPeriod
is always defined. But since this runtime default exists, I think there should be a slightly different interface to the outside.The text was updated successfully, but these errors were encountered: