You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * @mixes Mixin */classMyClass{constructor(){}}/** * @mixin */constMixin={/** * A field */field: 'value'};
Additional observations:
From some debugging, I've traced the issue down to the fact that there are duplicate "doclets" for MyClass. One for the class itself, and one for the undocumented constructor. The logic that adds the mixin fields adds the fields once for each instance.
Based on the above, one workaround for this is to use a simple function constructor (e.g. function MyClass() {} instead of the class declaration.
I played around with the code a bit, and changing if (mixes) with if (mixes && !doclet.undocumented)here also fixes the issue, because the doclet instance for the constructor has undocumented: true in my case. I'm not sure if that would be a reasonable fix for this, though, because the duplication may still cause issues elsewhere and in other similar cases.
I actually also use @hideconstructor for the MyClass equivalent, but that doesn't change the behavior and isn't necessary for reproducing this issue.
Input code
Additional observations:
MyClass
. One for the class itself, and one for the undocumentedconstructor
. The logic that adds the mixin fields adds the fields once for each instance.function MyClass() {}
instead of the class declaration.if (mixes)
withif (mixes && !doclet.undocumented)
here also fixes the issue, because the doclet instance for theconstructor
hasundocumented: true
in my case. I'm not sure if that would be a reasonable fix for this, though, because the duplication may still cause issues elsewhere and in other similar cases.@hideconstructor
for theMyClass
equivalent, but that doesn't change the behavior and isn't necessary for reproducing this issue.JSDoc configuration
Reproduces without any configuration.
JSDoc debug output
Expected behavior
MyClass#field
should only be documented once.Current behavior
MyClass#field
is documented twice.Your environment
The text was updated successfully, but these errors were encountered: