前言 日常积累,欢迎指正 ts 中不可变量的实现方法有两种 1、使用 ES6 的 const 关键字声明的值类型 2、引用类型中被 readonly 修饰的属性 示例如下: /** 1、 const 常量 */ const TEST: string = "test1"; TEST = "test2"; // Uncaught TypeError: Assignment to constant variable /** 2、非 readonly 修饰的对象属性 name */ interface Iobj1