← 返回首页

readonly 的作用

readonly 用于标记属性或索引签名只读,编译后会被移除(仅编译时检查)。对于数组可用 ReadonlyArray<T> 或 readonly T[]。