google / google/closure-compiler
Validate returned value usage for functions not annotated with @return
Open
enhancement
P3
Types
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Here's the case:
```
function foo()
{
// do something
// do not return any value
}
function bar()
{
console.log(1 + foo());
}
```
In this case, the `foo()` function has no `@return` annotation, since it does not return anything. However, it used to `@return {number}`, and `bar()` contains code relying on this. Now that `foo()` has been modified to not return anything, the compiler considers its return type as `?` (unchecked), and hence does not detect the error in `bar()`.
Contributor guide
Assessment
This issue has not been assessed yet.