DEV Community

Discussion on: What is wrong with optional chaining and how to fix it

Collapse
 
vujevits profile image
Mark Vujevits • Edited

I think your example issue for the bad part has a flaw.
You should only use non-optional boolean values in a condition in JS/TS. If you want to check for existence, do: if (something != null), this will check if it's null or undefined, no need for helpers.
Problem solved :-)