//readonly 只读属性 (()=>{ class Person{ readonly name: string = 'abc' constructor(name:string){ this.name = name } } let john = new Person('john') console.log(john) // john.name = 'peter' //因为是只读属性 所以会进行报错 //但是转化为js之后还是可以编译 并且修改的 })()