概述
@readonly 标签表示符号旨在为只读。请注意,这仅用于文档目的 - JSDoc 不会检查您是否实际上在代码中将符号视为只读。
示例
/**
* A constant.
* @readonly
* @const {number}
*/
const FOO = 1;
/**
* Options for ordering a delicious slice of pie.
* @namespace
*/
var pieOptions = {
/**
* Plain.
*/
plain: 'pie',
/**
* A la mode.
* @readonly
*/
get aLaMode() {
return this.plain + ' with ice cream';
}
};