For example, if I use following statements, I see no compiler error.
public SomeFunction() {
this.privateFunction() (no semi colon here)
}
or
public SomeFunction() {
this.privateFunction();
}
I am wondering if semicolon at the end of every statement is really required?
Semicolons are optional in JavaScript - TypeScript is a superset of JavaScript, ergo, semicolons are optional in TypeScript. That said, you will still run into issues with ASI like you would with JavaScript if you don't know where semicolons will be automatically placed.
Typescript, as a superset of JS, utilises the latter's Automatic Semicolon Insertion. If you want to learn more about where it will be implicitly put, read here -> http://inimino.org/~inimino/blog/javascript_semicolons .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With