Problem/Motivation
When adding to Drupal.behaviors without a "detach" method, inspection tools that are aware of jsdoc will complain:
Steps to reproduce
Drupal.behaviors.myBehavior = {
attach: function () {},
};
Assigned expression type {attach: Drupal.behaviors.myBehavior.attach} is not assignable to type {detach: Drupal~behaviorDetach, attach: Drupal~behaviorAttach}
Proposed resolution
In all places where we define this property, replace like this:
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the autocomplete behaviors.
- * @prop {Drupal~behaviorDetach} detach
+ * @prop {Drupal~behaviorDetach} [detach]
* Detaches the autocomplete behaviors.
See https://jsdoc.app/tags-property.html, look for "optional property".
Remaining tasks
User interface changes
API changes
none
Data model changes
none