DEV Community

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

 
macsikora profile image
Pragmatic Maciej • Edited

Yes if you talk about the condition issue exactly. The issue is that optional chaining need to be used with previous bad parts baked into language, and because the whole chain checks null | undefined but the last evaluated value put into if will behave by the falsy | Truthy.

But the second is not fully related. The issue is you cannot execute safetly function on the result, you need to always do additional if before, so again it is error prone.