Classes support access modifiers (public, private, protected), readonly fields, and implemented interfaces.
vs structural types
Classes create nominal-ish behavior at runtime (prototype chain) while TypeScript still compares instance shapes structurally when assigning to interfaces.
Self-check
- Implement a small class that satisfies an interface with
read(): number.
Parameter properties in constructors (constructor(private id: string)) reduce boilerplate in service classes.
Practice: Apply classes-in-ts in the playground, then explain classes in ts in one sentence without looking at notes.