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
Which gets its value from this piece of code which always produces "" for object properties:
exportfunctionnodeToValue(node){letkey;letparent;letstr;lettempObject;switch(node.type){// ...snip...caseSyntax.ObjectExpression:
tempObject={};node.properties.forEach((prop)=>{// ExperimentalSpreadProperty have no key// like var hello = {...hi};if(!prop.key){return;}key=prop.key.name;// preserve literal values so that the JSON form shows the correct typeif(prop.value.type===Syntax.Literal){tempObject[key]=prop.value.value;}else{tempObject[key]=nodeToValue(prop);// << bug is here}});
Clearly, this is the correct code for nodeToValue to use for an object property value:
if(prop.value.type===Syntax.Literal){tempObject[key]=prop.value.value;}else{tempObject[key]=nodeToValue(prop.value);// << not "nodeToValue(prop)"}
Input code
Doc comments using
@default
will produce bogusdefaultvalue
values when the value is an object literal:The
config
is a custom tag but the bug will happen not only for@default
but likely many other places since the bug is innodeToValue
.JSDoc configuration
n/a - happens regardless of configuration if you enter
nodeToValue
with an object literalJSDoc debug output
n/a
Expected behavior
The
defaultvalue
should be{"$config":"[\"lazy\"]","value":"[]"}
(and it is with my patch below)Current behavior
The
doclet.defaultvalue
was{ $config: "", value: "" }
This value comes from this code:
Which gets its value from this piece of code which always produces
""
for object properties:Clearly, this is the correct code for
nodeToValue
to use for an object property value:Your environment
This is from
package.json
:The text was updated successfully, but these errors were encountered: