documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Weird Output with Default Value

Open jrhalchak opened this issue 9 years ago • 1 comments

I have a method on a React class like so (a snippet of the full code/comment):

     /** @param {object} answer_sets - The answer sets object either from the state or generated
     * and passed in.
     */
    updateAnswersCache(answer_sets = this.state.answer_sets) {
        const formattedSets = [];
        const keys = Object.keys;

Elsewhere the default values are fine but in this case, it outputs the following in the generated docs:

updateAnswersCache(answer_sets: object?= link ReportModal} thro)

Parameters
answer_sets (object?= link ReportModal} thro) The answer sets object either from the state or generated and passed in.

That "link ReportModal}" is from one of the two methods below this one, but those two methods' output is totally fine. The only other comments in between are // single line comments for disabling an eslint setting and explaining a conditional.

Am I doing something wrong here?

jrhalchak avatar Jan 27 '17 20:01 jrhalchak

This seems to have been my fault. Since it has a default value, that also means it's optional.

/**
 * @param {object} [answer_sets=this.state.answer_sets] 
 */

jrhalchak avatar Jan 27 '17 23:01 jrhalchak