#NumberInput min and max type error

9 messages · Page 1 of 1 (latest)

flat elk
#

Quite confused by this one - I'm trying to set the min and max props for NumberInput with an integer value and seeing the following error:

src/components/Survey/BloodPressureForm.tsx:19:7 - error TS2322: Type 'string | number' is not assignable to type 'number | undefined'.
  Type 'string' is not assignable to type 'number'.

19       min={20}
         ~~~

Clearly 20 is of type number, not string | number. Any thoughts here?

#

if it matters, I'm seeing this error both with version 7.11.2 and 7.14.3. As far as I can tell, Mantine has this typed properly... just not sure why a number is being interpreted as something different.

#

oh, I think this is actually being caused by the field registration with react-hook-form... nevermind!

flat elk
#

Ok so even though it is a react-hook-form issue in principle, I’m unfortunately unable to use the clamp=“strict” option which is really what I want here. The issue is that the min and max props conflict with react-hook-form.

Anyone know of a workaround for this?

#

Oddly, clamp=“blur” does work, but it’s just not the behavior I’d like

candid fulcrum
flat elk
candid fulcrum