quirrel-dev / quirrel

The Task Queueing Solution for Serverless.
https://quirrel.dev
MIT License
885 stars 67 forks source link

EnqueueJobOptions retry type wrong #1167

Open wiese opened 9 months ago

wiese commented 9 months ago

Bug Report

Current Behavior EnqueueJobOptions's retry is configured (using zod) to take 1 to 10 options – that is, it does not allow an empty array. This is correctly enforced at runtime and leads to an error message "body/retry must NOT have fewer than 1 items" if violated. However, the type of retry does not reflect that retry needs to contain at least one option.

Expected behavior/code The type of EnqueueJobOptions retry indicates that at least one option needs to be provided.

Environment

Possible Solution

The zod documentation clearly indicates for .min/.max that

Unlike .nonempty() these methods do not change the inferred type.

so we could use the .nonempty() modifier in addition or instead of of the .min.