Constant vs readonly in typescript
Declaring a variable as readonly
will not allow us to override even if they are public properties.
How const beha
as said in https://www.typescriptlang.org/docs/handbook/interfaces.html#readonly-vs-const
The easiest way to remember whether to use readonly or const is to ask whether you’re using it on a variable or a property. Variables use const whereas properties use readonly.
as it displayed in below image if you declare const in defining a property you will get an error https://i.imgur.com/cJfDqh9.png