What if a property or a property of a property is still optional? E.g., user.address.zipCode. There is a proposal to avoid intermediate checks. user.address?.zipCode. However, zipCode is still nullable. Having null/undefined in any place is code smell and potential hole in the application. That's why it is always better to have a not null result. The problem is persistent not only in OOP but in FP as well, however, FP has a good way to handle it. Instead of working with null it provides you None.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
What if a property or a property of a property is still optional? E.g.,
user.address.zipCode
. There is a proposal to avoid intermediate checks.user.address?.zipCode
. However,zipCode
is still nullable. Having null/undefined in any place is code smell and potential hole in the application. That's why it is always better to have a not null result. The problem is persistent not only in OOP but in FP as well, however, FP has a good way to handle it. Instead of working with null it provides you None.