questions/00007-easy-readonly/README.ja.md
組み込みの型ユーティリティReadonly<T>を使用せず、T のすべてのプロパティを読み取り専用にする型を実装します。実装された型のプロパティは再割り当てできません。
例えば:
interface Todo {
title: string
description: string
}
const todo: MyReadonly<Todo> = {
title: "Hey",
description: "foobar"
}
todo.title = "Hello" // Error: cannot reassign a readonly property
todo.description = "barFoo" // Error: cannot reassign a readonly property
<a href="../../README.ja.md" target="_blank"></a> <a href="https://tsch.js.org/7/answer/ja" target="_blank"></a> <a href="https://tsch.js.org/7/solutions" target="_blank"></a> <hr><h3>関連する課題</h3><a href="https://github.com/type-challenges/type-challenges/blob/main/questions/00008-medium-readonly-2/README.ja.md" target="_blank"></a> <a href="https://github.com/type-challenges/type-challenges/blob/main/questions/00009-medium-deep-readonly/README.ja.md" target="_blank"></a> <!--info-footer-end-->