https://www.typescriptlang.org/docs/handbook/2/objects.html#readonly-properties
名前の前に`readonly`をつける[[TypeScript]]のプロパティ表現。対象のプロパティは読みとり専用になる。
```ts
interface Human {
readonly id: number
name: string
}
const ichiro: Human = {
id: 1,
name: "Ichiro",
}
// OK
ichiro.name = "一朗"
// readonlyのためエラーになる
ichiro.id = 100
```
一方、[[イミュータブル]]になるわけではないため、内部のプロパティは変更できる。
```ts
interface Human {
readonly id: number
name: string
readonly brother?: Human
}
const ichiro: Human = {
id: 1,
name: "Ichiro",
}
const jiro: Human = {
id: 2,
name: "Jiro",
brother: ichiro,
}
// readonlyプロパティ内のwritableなプロパティは変更可能
jiro.brother!.name = "次郎"
```