[FIX] web: a few JS docstrings

jsdoc apparently doesn't understand arrow functions to indicate
function-valued attributes. Also add some default values in the
notifications typedefs.

closes odoo/odoo#74003

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
Xavier Morel
2021-07-20 06:50:38 +00:00
parent 02df207a04
commit 3fad7a39ea
5 changed files with 14 additions and 13 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ import { session } from "@web/session";
* the number of digits that should be used, instead of the default digits precision in the field.
* Note: if the currency defines a precision, the currency's one is used.
* The first number is always ignored (legacy constraint)
* @returns The formatted currency
* @returns {string} The formatted currency
*/
export function formatCurrency(value, cid, options = {}) {
if (value === false) {
@@ -34,10 +34,11 @@ class LazyTranslatedString extends String {
* translations are loaded, as class attributes or at the top-level of
* an Odoo Web module
*
* @returns {{toString: () => string}}
* @param {string} term
* @returns {LazyTranslatedString}
*/
export function _lt(str) {
return new LazyTranslatedString(str);
export function _lt(term) {
return new LazyTranslatedString(term);
}
/*
@@ -12,16 +12,16 @@ const AUTOCLOSE_DELAY = 4000;
* @typedef {Object} NotificationButton
* @property {string} name
* @property {string} [icon]
* @property {boolean} [primary]
* @property {() => void} onClick
* @property {boolean} [primary=false]
* @property {function()} onClick
*
* @typedef {Object} NotificationOptions
* @property {string} [title]
* @property {"warning" | "danger" | "success" | "info"} [type]
* @property {boolean} [sticky]
* @property {boolean} [sticky=false]
* @property {string} [className]
* @property {() => void} [onClose]
* @property {NotificationButton} [buttons]
* @property {function()} [onClose]
* @property {NotificationButton[]} [buttons]
*/
export const notificationService = {
@@ -24,10 +24,10 @@ export function usePopover() {
* @param {Object} props
* @param {Object} [options]
* @param {boolean} [options.closeOnClickAway=true]
* @param {() => void} [options.onClose]
* @param {function()} [options.onClose]
* @param {string} [options.popoverClass]
* @param {string} [options.position]
* @returns {() => void}
* @returns {function()}
*/
add(target, Component, props, options = {}) {
const newOptions = Object.create(options);
@@ -23,10 +23,10 @@ export const popoverService = {
* @param {Object} props
* @param {Object} [options]
* @param {boolean} [options.closeOnClickAway=true]
* @param {() => void} [options.onClose]
* @param {function()} [options.onClose]
* @param {string} [options.popoverClass]
* @param {string} [options.position]
* @returns {() => void}
* @returns {function()}
*/
function add(target, Component, props, options = {}) {
const id = ++nextId;