概述
🌐 Overview
@readonly 标签表示一个符号是只读的。请注意,这仅用于文档目的 —— JSDoc 不会检查你在代码中是否_实际上_将该符号视为只读。
🌐 The @readonly tag indicates that a symbol is intended to be read-only. Note this is for the purpose of documentation only - JSDoc won't check whether you've actually treated the symbol as read-only in your code.
示例
🌐 Examples
/**
* 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';
}
};