What does the ‘readonly’ modifier do on a TypeScript interface property?

TypeScript Associate Medium

TypeScript Associate — Medium

What does the ‘readonly’ modifier do on a TypeScript interface property?

Key points

  • 'readonly' ensures the property remains constant after initialization
  • It does not make the property invisible or convert it to a getter
  • 'readonly' does not freeze the entire object, only the specific property

Ready to go further?

Related questions