Allow typeless tags when types can be inferred
rjbailey opened this issue · 3 comments
rjbailey commented
I'd like to be able to describe return values and object properties using JSDoc tags, but without repeating type information from Flow annotations:
/**
* Add five to `x`.
*
* @param x The number to add five to.
* @returns `x` plus five.
*/
function addFive(x: number): number {
return x + 5;
}
/**
* A 2D point.
*
* @property x The x coordinate of the point.
* @property y The y coordinate of the point.
*/
type Point = { x: number, y: number };
The @returns
and @property
tags are not reflected in the output at all (maybe because the {type}
declaration is required by JSDoc, so they aren't recognized?).
Is it possible to parse these descriptions and combine them with inferred types?
tmcw commented
Yep; I don't think that doctrine, our underlying JSDoc parser, allows omitted types - I'll confirm this and bring it up with them.
tmcw commented
Rolling a patch for params now, upstream for returns at eslint/doctrine#136
rjbailey commented
👍 Thanks!