But don't please. Semicolons are not optional. When you don't put your semicolons, they will inserted by the parser and it can introduce some buggy code especially if you are using some formatter.
Furthermore, even if you always write semicolons you are still subject to ASI modifying your code by inserting additional semicolons where you don’t want them. So you need to learn the rules of ASI regardless of whether you use semicolons or not. https://feross.org/never-use-semicolons/
Edit: I was mistaken about strict mode.
No mention of strict mode in the section of ASI. Could have sworn that the ASI issues I’ve ran into in the past was resolved by using strict mode, not sure what I’ve got that from.
return
value
which will get flagged by TS as unreachable code (you can try it in https://www.typescriptlang.org/play)Say, you have
let a = 1
let b = 2
(a + b) <--- b won't be
accessible here.
This will also get flagged by ts. But not everyone uses ts. /shrugsFeross is right, I guess.