google / google/closure-compiler
Inline return annotation for anonymous functions
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Current long form:
``` javascript
/**
* @return {number}
*/
var myFoo = function foo(x) { return x - 1; }
```
Current inline form:
``` javascript
var myFoo = function /** number */ foo(x) { return x - 1; }
```
**Desired** inline form for anonymous functions:
``` javascript
var myFoo = function /** number */ (x) { return x - 1; }
```
... or equivalent that would fail:
``` javascript
var myFoo = function /** number */ (x) { return "a"; }
```
Would need another example adding here:
https://github.com/google/closure-compiler/wiki/Annotating-Types
As discussed here:
https://github.com/google/closure-compiler/issues/1061#issuecomment-128080193
Contributor guide
Assessment
This issue has not been assessed yet.