Skip to main content
Version: Current (v7.0.0-beta.3)

A date element's range and yearsRange are readonly tuples

Detect​

  • Your custom alt-date widget passes a date element's range or options.yearsRange to a parameter typed [number, number], and the type checker rejects the call: error TS4104: The type 'readonly [number, number]' is 'readonly' and cannot be assigned to the mutable type '[number, number]'.

Change​

Mark the parameter readonly, or destructure the range as @rjsf/mantine's AltDateWidget does:

- function yearOptions(range: [number, number]) {
+ function yearOptions(range: readonly [number, number]) {

Verify​

Also read: