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
Hello guys. I'm using the Typedoc API to generate a custom library documentation website. Apparently default values of destructured object parameters are not being recognized by Typedoc. Here is a brief of the component i'm extracting:
/** * Checkbox, casilla de valor binario * * @category Components * * @param { object } props * @param { any } props.value Valor del Checkbox. * @param { any } [props.trueValue = true] Valor cuando la casilla está activa. * @param { any } [props.falseValue = false] Valor customizado cuando la casilla está desactivada. */constCheckbox=({
value,
trueValue =true,
falseValue =false,
...
})=>{...}
This is the only SignatureReflection for a Checkbox component, where the defaultValue should be the pointed either in JSDoc or in the destructured object.
Actual Behavior
None of JSDoc or in the destructured object is giving a default value, setting DeclarationReflection.defaultValue as undefined.
Steps to reproduce the bug
The bug is produced documenting in JSDoc and giving default values to destructured objects as parameters of a function.
Environment
Typedoc version: 0.25.1
TypeScript version: 5.2.2 (Even though, i'm documenting with just JSDoc
Node.js version: 20.5.1
OS: Windows 11
Extra
Would be nice if i could solve it myself and do a pull request but i'm not sure where to dig in.
The text was updated successfully, but these errors were encountered:
I don't think this is fixable without reaching into internal TS properties. Destructured objects are horrible to work with in the API, they're a close second to mixins in my opinion of the worst code to try to generate docs for...
If you click on ObjectBindingPattern, you'll get a type object, which is what TS is converting from, drilling down into the properties (turn on show internals), you can see that the symbols there do not have any declarations. To get the declarations, we'd have to use the internal links property and check the bindingElement property on that.
(This is looking at it with source language set to TS, if you paste the original code in and set the language to JS, there's a similar story, but we do have a declaration... it's just pointing at the @param, which doesn't have a .initializer, so we don't get any default value there either.)
If you want to investigate this, I'd recommend setting up a TS project with only that function, and starting typedoc in a debugger, I recommend breakpoints in convertProperty in src/lib/converter/symbols.ts and for the conversion functions of the typeLiteralConverter in src/lib/converter/types.ts
Search Terms
JSDoc, destrucutred object, function
Expected Behavior
Hello guys. I'm using the Typedoc API to generate a custom library documentation website. Apparently default values of destructured object parameters are not being recognized by Typedoc. Here is a brief of the component i'm extracting:
This is the only
SignatureReflection
for aCheckbox
component, where thedefaultValue
should be the pointed either in JSDoc or in the destructured object.Actual Behavior
None of JSDoc or in the destructured object is giving a default value, setting
DeclarationReflection.defaultValue
asundefined
.Steps to reproduce the bug
The bug is produced documenting in JSDoc and giving default values to destructured objects as parameters of a function.
Environment
Extra
Would be nice if i could solve it myself and do a pull request but i'm not sure where to dig in.
The text was updated successfully, but these errors were encountered: