You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/**
* Callback fired when the `input` is blurred.
*
* Notice that the first argument (event) might be undefined.
*/
onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
Even though there is a comment, undefined is not an option for the events.
Expected behavior
I would have expected the behavior of the onBlur to match the type definition and no undefined event to be passed in. Would it be possible to either update the type definition to include undefined or update the onBlur call to pass in an event for InputBase?
Context
We are running with strict null safety and this is causing an issue.
As expected, this would be a breaking change (See #45994 (review)) Won't just the JSDoc already mentioning that the event might be undefined work for you?
@ZeeshanTamboli thank you for trying! Our code is expecting the typing to be honored strictly so the fact that undefined is being passed in when the type says that it never will be is throwing for us so just having a doc comment isn't enough. It's okay though - we will work around it on our end. Would it be possible to consider adding this to the next major?
Hello 👋
Search keywords
undefined event onBlur
Latest version
Steps to reproduce
Steps:
onBlur
is undefined if the InputBase is disabledCurrent behavior
InputBase is calling onBlur with an undefined event in certain cases, but the type definition for
onBlur
does not have a nullable event:Even though there is a comment,
undefined
is not an option for the events.Expected behavior
I would have expected the behavior of the
onBlur
to match the type definition and noundefined
event to be passed in. Would it be possible to either update the type definition to includeundefined
or update theonBlur
call to pass in an event forInputBase
?Context
We are running with strict null safety and this is causing an issue.
Your environment
See sandbox: https://stackblitz.com/edit/react-zufzmfhc?file=Demo.tsx
Thank you!
The text was updated successfully, but these errors were encountered: