0

I have worked on several projects on react with typescript. On those projects I have seen some of them are using semicolon to mark the EOL, but some of them are not.

All the applications have no difference after building them as javascript (production build).

So are there any benefits of not using the semicolon in terms of the aspects:

  • Use case related to language standard
  • File size
  • Compilation time
  • Readability on IDEs/ Terminals
  • Any other aspects?
  • if you have a linter configured to add/remove them as needed it's a matter of preference and nothing more – Dimava Mar 29 '23 at 12:37
  • There is no upside to skipping semicolons, but there are plenty of downsides: Like this: [ES6 Array destructuring weirdness](https://stackoverflow.com/questions/38050219) and [What does the leading semicolon in JavaScript libraries do?](https://stackoverflow.com/questions/1873983) and plenty other examples mentioned in the linked duplicates – adiga Mar 29 '23 at 12:38
  • This is a JavaScript thing not a Typescript thing. This is developers refusing to end statements with semicolons due to , and relying on [Automatic Semicolon Insertion [ASI](https://brendaneich.com/2012/04/the-infernal-semicolon/) which is a JavaScript _error correction process_. That article behind that link btw was written by Brendan Eich who _wrote_ JavaScript. – Andy Mar 29 '23 at 12:38
  • With typescript there is no real benefit to file size since you are most likely transpiling it into JavaScript. The argument that every person that says they do not like them is typing less. I crack up because add a formatter on your IDE and it auto adds them. – epascarello Mar 29 '23 at 12:49

0 Answers0