Readonly
Constructs a type with all properties of Type set to readonly, meaning the properties of the constructed type cannot be reassigned.
interface Todo { title: string; } const todo: Readonly<Todo> = { title: "Delete inactive users", }; todo.title = "Hello";
Assigning a title to Todo Interface would throw an error .
Released:2.1
Reference: Official typescript docs
Top comments (0)