React refs keep telling me ref.current.value does not exist on type 'never'
I've sent a few pics of where the error is. The function is responsible for checking whether a field among a set of required input fields is filled in or not. If one of them is not filled it will stop the function.


11 Replies
what is the type of
refs
?
All refs are set to null since they are used with components/elements
you probably need to type the refs
ts isnt inferring them, and its slapping a
never
ah alright, so a type that extends the React.MutableRefObject<null> type?
what are the types of the refs?
basically
the useRef lines
sry for late reply here you go

You probably need to type those useRefs
TypeScript: React useRef Hook
How to use React's useRef Hook with TypeScript for using a ref ...
Like this
That helped me solve the issue, thanks :)