Dany Paredes
Dany Paredes | Javascript / Web

Dany Paredes | Javascript / Web

Difference between 'extends' and 'implements' in TypeScript

Difference between 'extends' and 'implements' in TypeScript

Dany Paredes's photo
Dany Paredes
·Jan 28, 2021·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

Today, a friend ask about the difference between extends and implements.

class Media {
  format: string;
}
class Video extends Media {}
class Image implements Media {}

The short answer for him was:

extends: The class get all these methods and properties from the parent, so you don't have to implement.

implements: The class has to implement methods and properties.

I hope this is can help someone with the same question.

 
Share this