Archived post: posted sometime between 2016 and 2022.

TypeScript class vs interface vs type

This is a brain dump. It is in no way authoritative.

I want multiple objects...

...to have the same shape

...and to support inheritance

...and to have the same behavior

An additional feature of a class is encapsulation: