On readonly properties, type guards and unions — 1. Readonly properties In TypeScript 2.0, the readonly modifier was added to the language. Properties marked with readonly can only be assigned during initialization or from within a constructor of the same class. All other assignments are disallowed. Example // type definitions
interface Person { readonly name: string; readonly age: number; };
// or
type Person…