I occasionally run into problems with JS weird parsing rules. My favorite is:
return
x
Which does not return. It returns undefined.Typescript helps a lot with that. A linter will probably flag it as well. Still, JS went way out of its way to accept just about anything, whether it makes sense or not.