Skip to content

Commit

Permalink
Add support for @returns annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
albe committed Jan 21, 2017
1 parent ab7ec9c commit 68470ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function extractJsdoc(comment) {
}).map(jsdocTagToFlowTag);

var returnTags = docAst.tags.filter(function(tag) {
return tag.title === "return";
return tag.title === "return" || tag.title === "returns";
}).map(jsdocTagToFlowTag);

var propTags = docAst.tags.filter(function(tag) {
Expand Down
7 changes: 7 additions & 0 deletions tests/expected_output/03-stand-alone-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@
*/
function foo(bar: Array<Foobar>, baz: Function) : number {
return 42;
}

/**
* @returns {number}
*/
function bar() : number {
return 42;
}
7 changes: 7 additions & 0 deletions tests/input/03-stand-alone-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@
*/
function foo(bar, baz) {
return 42;
}

/**
* @returns {number}
*/
function bar() {
return 42;
}

0 comments on commit 68470ff

Please sign in to comment.