Thank you for this! I was so let down by the many misconceptions of the post you mentioned (I ended up writing a response blog post myself), glad you're here to clear them up.
Just one tiny error that I noticed though. in the makeSureIsNumber example, you throw an error in the isNan() check which says Not a string. I think you're meant to say Not a number?
Also, you might want to take a look at the unknown type. It's like any but with some form of type safety, in the way that you need to check the value of said type before passing it anywhere.
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.
Thank you for this! I was so let down by the many misconceptions of the post you mentioned (I ended up writing a response blog post myself), glad you're here to clear them up.
Just one tiny error that I noticed though. in the
makeSureIsNumber
example, you throw an error in theisNan()
check which saysNot a string
. I think you're meant to sayNot a number
?Also, you might want to take a look at the unknown type. It's like any but with some form of type safety, in the way that you need to check the value of said type before passing it anywhere.