Reputation: 42417
If I make a constructor with a parameter property declaration like this:
constructor(public someProperty) { }
I would like to be able to apply JSDoc to someProperty
:
/** @param someProperty Example property documentation */
And have this documentation apply to both the parameter and the corresponding property.
However, in Visual Studio, the documentation only seems to apply to the parameter. I don't know if this is a flaw in the Visual Studio integration or the language specification. Which is it? Or is it neither?
How can I achieve this without explicitly declaring the property?
Upvotes: 2
Views: 272
Reputation: 100381
You need to do this.
class Foo
{
/** @param someProperty Example property documentation */
constructor(
/**
* The documentation needs to go here
*/
public someProperty
)
{
}
}
new Foo("").someProperty;
It is understandable that it could be the same documentation for @param
and the property, but not necessarily.
In the @param
you will only have text, while in the other block of documentation you can create a much more complex explanation of the property.
However, if you think it could be a feature you can suggest it here.
If the property documentation is not present but the @param
is, it could attach the documentation. Otherwise, if the property documentation is present, then it would override the @param
. That would be nice.
Upvotes: 2