- edited description
Include acceptable value hints in inline help for LWC attributes when using JSDoc
Issue #2222
resolved
It would be nice to have acceptable values, documented using JSDoc, for LWC @api properties to be displayed in the inline help and likely validated when utilizing said component from a hosted component.
An example of the JSDoc property:
/** @type {"base"|"error"|"warning"} */
@api variant = 'base';
Currently, when using F1 on that attribute from a parent/host component, the type information is displayed as illustrated in the attached screenshot.
Comments (4)
-
reporter -
repo owner Fix committed for the next build. The following:
import {api, LightningElement} from 'lwc'; export default class Issue2222 extends LightningElement { /** @type {"base"|"error"|"warning"} */ @api unionTypeProperty; /** @type {10|(20|30)} */ @api unionTypeProperty2; /** @type {10|"StringValue"|false} */ @api unionTypeProperty3; /** @type {"First"|"Last"|number|boolean} */ @api unionTypeProperty4; }
behaves as follows:
Documentation
Completion
Validation
-
reporter Looks great! Thanks for working this in.
-
repo owner - changed status to resolved
Delivered in 2.2.4.4.
- Log in to comment