In the video it was recommended to use ! for type assertion since we know better. But in real-world when multiple people are working on a project, mistakes can happen. Last thing we want is our UI to crash because of it. There is a better way to handle this.
In the video it was recommended to use
!
for type assertion since we know better. But in real-world when multiple people are working on a project, mistakes can happen. Last thing we want is our UI to crash because of it. There is a better way to handle this.Recommended in the video
A better approach is to use
?
and use|| ""
for better error handling. Also, badgeLetter can be written much more simply.