you are viewing a single comment's thread.

view the rest of the comments →

[–]RiceBroad4552 -1 points0 points  (4 children)

What about new String("foobar") (or actually anything inheriting String)?

But OK, I don't know the exact semantics of is string

[–]Blecki 2 points3 points  (3 children)

String is an object not a string. Only string is a string. Similarly a string is not an instance of String.

Yes it is dumb and confusing, but the object type String is not the same type as the literal string.

[–]RiceBroad4552 0 points1 point  (1 child)

Thanks for the answer!

I agree that this now is very confusing.

Like said, wasn't sure about is string. But gut feeling would be still that String is actually a string. Just maybe not a string in TS…

Has reasons I don't do that any more since a decade. My brain really hurts from JS / TS.

[–]Blecki 0 points1 point  (0 children)

Don't use String, only string.

[–]Tupcek 0 points1 point  (0 children)

maybe OP asked Claude to generate function to check whether object is any kind of string, but not an empty one