#Getting an error while trying to destructure onBlur from form.getInputProps

4 messages ยท Page 1 of 1 (latest)

vivid quarry
#

Hi ๐Ÿ™‚
I'm getting an error from my IDE (TS2339: Property 'onBlur' does not exist on type '{ value: any; onChange: any; checked?: any; error?: any; onFocus?: any; }'. when I'm trying to destructure onBlur from a form.getInputProps("some.form.item")
If i try console.logging it, I can see the onBlur function there, so I guess something weird is happening on the Typescript side.. any guess?

  // full guilty line :)
  const { onBlur: nativeOnBlur, ...formProps } = form.getInputProps(`someArray.${index}.duration`);
modern folio
vivid quarry
#

Thanks ๐Ÿ˜‰ so for now I'll guess I'll be using the good old unknown trick

[...] as unknown as typeof form.getInputProps & {
    onBlur: (e: FocusEvent<HTMLInputElement>) => void;
  };
#

any better alternative? ๐Ÿ˜‰