-
-
Notifications
You must be signed in to change notification settings - Fork 258
Conversation
Codecov Report
@@ Coverage Diff @@
## master #485 +/- ##
======================================
Coverage 98.2% 98.2%
======================================
Files 21 21
Lines 3519 3519
Branches 974 974
======================================
Hits 3456 3456
Misses 24 24
Partials 39 39
Continue to review full report at Codecov.
|
Thanks again! |
return this.eat(tt.semi) || this.canInsertSemicolon(); | ||
} | ||
|
||
// Consume a semicolon, or, failing that, see if we are allowed to | ||
// pretend that there is a semicolon at this position. | ||
|
||
semicolon() { | ||
semicolon(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to explicitly write void
for the returned type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the return type, you should still get errors if there are errors, but they will be more confusing: If you have function f() { return g(); }
and call f().toUpperCase()
, and there's an error, is it in f
, g
, or .toUpperCase()
?
I was thinking it will infer the void type since It returns nothing, doesn't it? |
Yes, in the case of 100% correct code everything will be inferred with no problem. But there are also some functions in the code that should be void but contain unnecessary return statements -- can't catch that without an annotation. |
Ok, thanks |
Enables type-checking in
util.js
and annotates every method.