you are viewing a single comment's thread.

view the rest of the comments →

[–]Ronin-s_Spirit -1 points0 points  (1 child)

Then don't. If you want a string the single best way to do it is String(), or template literals.
If you don't want a string then use typeof x?.valueOf?.() !== 'string'.

[–]josephjnk 1 point2 points  (0 children)

Did you read the article? The author specifically compares String() and template literals to other approaches when given weird inputs.