Typescript Type vs Interface - What to use?

preview_player
Показать описание
Learn the difference between Typescript type vs interface. This two keywords are working in a similar manner so you need to understand when you need to use each of them.

MOST POPULAR COURSES

FOLLOW ME
Рекомендации по теме
Комментарии
Автор

So Types can do everything Interfaces do, and a bit more? (e.g. allowing overriding properties from types they extend?)

alexdeweert
Автор

Thanks so much. Struggling to understand some things in Typescript but you helped explain the difference between types and interfaces. Love your videos ❤

jonathanjohnson
Автор

Types ftw! Worked with both, more and more I find Types more flexible and especially due to ts’s type utilities. I mean the language is called “Type” script 😃
Thanks for making the video!

burningtree
Автор

Bro I've been following for couple years. you're great but isn't time you switched to react/svelte/solid ? :((( New challenges

theasdazx
Автор

Is he just me or he sounds like Gabe Follower a famous data miner in CS2 🧐

dev-patel
Автор

I think the main difference is that interfaces can be declared multiple times, and the contents will be merged. Even consuming projects can extend interfaces with declare 'package' { interface ... }. So use types if you don't need this as it can lead to double declaration mistakes if you don't need to be able to extend a type later.

robertsandiford
Автор

Whoa I didn’t know you could implement regular types, thought that was interface only

sircharlesross
Автор

I recently learned that type unions have performance loss when compared with interface polymorphism.

Skeb
join shbcf.ru