Values & References6 / 18
Up next

readonly properties

interface Point {
  readonly x: number;
  readonly y: number;
}

const p: Point = { x: 1, y: 2 };
// p.x = 9 would be a type error
console.log(p.x, p.y);
What you're solving

a readonly field cannot be reassigned