When to use interfaces and when to use classes in TypeScript?

Technology CommunityCategory: TypeScriptWhen to use interfaces and when to use classes in TypeScript?
VietMX Staff asked 3 years ago

If you need/wish to create an instance of perhaps a custom object, whilst getting the benefits of type-checking things such as arguments, return types or generics – a class makes sense.

If you’re not creating instances – we have interfaces at our disposal, and their benefit comes from not generating any source code, yet allowing us to somewhat “virtually” type-check our code.