i have this in my codebase:
if (
reproject?.fromProjectToLocalSpace &&
reproject?.fromLocalToProjectSpace &&
reproject?.toElevation &&
lastCorners.current &&
pivotRef.current
) {
......
where the first three can be a function or undefined.
does that actually check if it is udefined or will it always return true (like eslint suggests me: This condition will always return true since this function is always defined. Did you mean to call it instead?ts(2774)
). I know for a fact that these functions can be undefined!
does it make more sense to do something like this:
if (
typeof reproject?.fromProjectToLocalSpace === 'function' &&
typeof reproject?.fromLocalToProjectSpace === 'function' &&
typeof reproject?.toElevation === 'function' &&
lastCorners.current &&
pivotRef.current
) {
what is the right way to handle this?