Skip to content

Commit

Permalink
fix(docs): fix docs generation for method return values (#3064)
Browse files Browse the repository at this point in the history
The `@returns` tags were ignored in JSDocs. When `@return` was used, 
the tag object wasn't properly converted to a string resulting in the output 
`[object Object]`.

Allow both `@returns` and `@return` to be used, and properly stringify their
contents.
  • Loading branch information
tricki committed Oct 1, 2021
1 parent 39caa8c commit dc2f6fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/compiler/docs/generate-doc-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ const getDocsMethods = (methods: d.ComponentCompilerMethod[]): d.JsonDocsMethod[
name: member.name,
returns: {
type: member.complexType.return,
docs: member.docs.tags.filter((t) => t.name === 'return').join('\n'),
docs: member.docs.tags
.filter((t) => t.name === 'return' || t.name === 'returns')
.map((t) => t.text)
.join('\n'),
},
signature: `${member.name}${member.complexType.signature}`,
parameters: [], // TODO
Expand Down

0 comments on commit dc2f6fb

Please sign in to comment.