// 泛型工具类型:Readonly 将 Type 的所有属性都设置为 readonly(只读) interface Props { id: string children: number[] } type ReadonlyProps = Readonly // 所有属性都是只读 let p1: ReadonlyProps = { id: '1', children: [1, 3] } // 属性是只读,不能修改 // p1.id = '2'