Why does Javascript only type-cast for string concatenation on strings that are already assigned?

I noticed something strange when messing around with strings and numbers in a Javascript console. Doing this: “$99.9” += 0 causes SyntaxError: Invalid left-hand side in assignment. But if I assign the string to a variable, the behavior is different (and more in line with what we’ve come to expect/accept from Javascript) let str = “$99.9” str += 0 // => “$99.90” I’m familiar with what causes the behavior in the second example (and what causes so many other Javascripty things to happen), but the error in the first example surprised me. What is happening in the first example of

How do I add TypeScript types to a JavaScript module without switching to TypeScript?

I guess the title is somewhat confusing, but I wasn’t able to put it in a more concise way in a short title. However, this is what I want to do: I have an npm module that is written in JavaScript, …

Why does TypeScript use “Like” types?

Why does TypeScript have a type and then a “like type”? An example of this is Promise and PromiseLike. What are the differences between these two types? When should I use …