Reputation: 540
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?
Upvotes: 4
Views: 9051
Reputation: 671
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 .
Upvotes: 4
Reputation:
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.
Upvotes: 9