Scheduled Task payload types

Does this plugin support adding type for the payload? Tried to just add interface in d.ts as type for that key but that doesn't work. tried to search docs for that but I didn't find anything about that re-read docs and found that they actually mention ability to specify type for payload. but somehow that doesn't work for me. Tried passing just raw type, interface, actual type and still no success the way I declare task & it's payload:
declare module "@sapphire/plugin-scheduled-tasks" {
interface ScheduledTasks {
monthlyClansReset: unknown
removeInvite: RemoveInviteTaskPayload
}
}
declare module "@sapphire/plugin-scheduled-tasks" {
interface ScheduledTasks {
monthlyClansReset: unknown
removeInvite: RemoveInviteTaskPayload
}
}
11 Replies
secre
secreOP3w ago
also small question. if task fails during it's execution does plugin automatically re-run it with some delay or we need to manually execute it after catching error with try catch {} for example :Hmm:
Favna
Favna3w ago
that is all handled by the underlying library that we use bullmq. Not sure how they handle it.
secre
secreOP3w ago
I see :okie:
čamdžić
čamdžić3w ago
@secre hi since you didn't typed it yet you add augmentation to .d.ts file just like you did with type you want
Solution
čamdžić
čamdžić3w ago
čamdžić
čamdžić3w ago
that's how you do it
secre
secreOP3w ago
oh, so you need to specify generic for that to work :WAHHHHHHHHHHHHH:
čamdžić
čamdžić3w ago
yes it should be required that generic is optional idk why
secre
secreOP3w ago
I think thats because you rarely have tasks that require payload
čamdžić
čamdžić3w ago
yeah and default is never
secre
secreOP3w ago
ye

Did you find this page helpful?