Search code examples
salesforcejsdoccode-documentationlwcsalesforce-development

How to document LWC Salesforce components public variables with JSDoc?


JSDoc skips my public LWC variables. Here is an example:

    /**
     * SomePublicVarName mode - default is false.
     * 
     * @type {boolean}
     */
    @api 
    somePublicVarName = false;

If I convert that to a function or a public getter/setter, then I can see it in the output. Is there a way around that? Can I change JSDoc parsing behavior? I read in the docs I can use a configuration file, but I don't know if this is a use case for it. I also tried to add the @public JSDoc property hopping that would fix the issue, but it didn't help.


Solution

  • My issue was resolved by also adding a js doc on top of the class declaration itself. In this js doc I used @alias.

    See this post: https://salesforce.stackexchange.com/questions/370416/how-to-document-lwc-salesforce-components-public-variables-with-jsdoc