readonly vs const typescript code example
Example: const vs readonly ts
in TS:
Both cannot be reassigned and effectively achieve the same thing.
However, because readonly is a typescript only thing, it only applies at compile time.
- use const for variables
- use readonly for properties