Loading
Current section: 7. Interfaces 5 exercises
lesson

Intro to Interfaces

Loading lesson

Transcript

00:00 Hey. Welcome to the interfaces workshop exercise. This one is gonna be interesting because for the first little bit, it's gonna be like, why do we even have interfaces? Well, for one, historical, interfaces came first before types. But also, they have a special feature that you can't do with types.

00:16 So, here's a basic syntax. Looks pretty similar. The only missing bit here is the equal sign. There's no equal sign here. But, yeah, the way you use them, basically the same as types.

00:26 You can also extend using intersection observe or intersection observers. That's a completely different thing. Intersection types the ampersand thing, and also a special extends keyword. But, yeah, they're pretty similar to types. And so, we're gonna talk a little bit about the differences, and we're gonna focus on, declaration merging.

00:49 But, yeah, you can use the extends keyword, so whoop dee doo, with, with interfaces. And, yeah. Classes, the yeah. They typically are gonna use interfaces, as well. But, you know, we'll talk about those later.

01:02 So, yeah. Pretty much the I prefer types everywhere and only use interfaces when I need declaration merging, which is very rarely. So that said, you're gonna see them all over the place, so you need to learn them. Let's get into this.