And that is it for interfaces and classes in this module we had a detailed look at classes and what
we can do there.
Classes in typescript in the end just build up on classes for JavaScript and I already summarized those
a little bit earlier in this module.
Interfaces are a different thing.
They only exist in typescript very pure types with feature helping you to write clear clearly structured
and very explicit code they can help you to force classes to have certain features or objects in general
to have a certain structure.
They can be used as a function type as you learned.
They allow for optional properties and all the four optional methods by the way.
If you add a question mark after the method name so that is something you can use.
And as you just saw when being compiled after fulfilling their role of allowing typescript to check
your code nothing is emitted for these interfaces.
The code is simply dumped.
Interfaces nonetheless are a powerful feature to force your classes or your objects to have a certain
structure and to clearly describe your idea of how an object should look like.
Now as you learned you mostly can replace them with custom types if you wanted to.
You can also implement custom types but it simply is more common to use an interface for Dad to use
an interface if you want to describe an object and if you want to implement it all div for historic
reasons.
Because in the early days of typescript custom types couldn't be implemented or used like interfaces.
Now there is more flexibility but it's still recommended to go for interfaces.
If you work with objects and if you want to describe their structure will also see them throughout this
course.
Over and over again.