Exploring the Contrast Between Readonly Variables and Readonly-Typed Methods in TypeScript
Readonly Variable:
maxLength: Readonly<Number | number | String | string> = 1;
vs
Readonly-Typed Method:
maxLength(length: Number | number | String | string): Readonly<Number | number | String | string> {
var width: Readonly<Number | number | String | string> = length;
return width;
}
- What separates these two concepts?
- Can values be assigned to a Readonly function at runtime?