Man. You have amazing teaching skills. Every difficult issue becomes absolutely clear after watching you video! I will recommend your channel everybody! Thank you so much
@ilonachan Жыл бұрын
I think with the "amalgamation" property of interfaces at the end, we can sum up this video in a very poetic way: "use types for types, and interfaces for interfaces." if you're defining a shorthand for a commonly used type of thing, that may involve unioning and all kinds of stuff, then use a type alias for that (you might have to anyway). if you're instead defining the structure of an API or class interface, which is supposed to be rigid and have no surprises, then interfaces have the slight advantage. Does this make sense?
@vimux Жыл бұрын
10 mins ago, I'm scratching my head because Idk what to use and I see a bunch of docs or codebase using type and interface but I don't really know the difference. I got a lot of "Aha" moments watching this. Thank you man! Subscribed!
@kbsanders Жыл бұрын
Clear. Concise. Expertly explained. Well done!
@deltaboukensha Жыл бұрын
Man I find it madness that interfaces and types are so interchangeable
@aram56422 жыл бұрын
As always, one darn useful video! And I had a happy moment seeing that you also use a type for things like UserId! For exact same reason! I'd be curious to see a video about abstract classes. I think I know when to use them (esp in Angular) but it would be good to hear your explanation anyway.
@andrew-burgess2 жыл бұрын
Great idea, thanks!
@aram56422 жыл бұрын
@@andrew-burgess It would be super useful to hear your lecture about the 'declare' keyword. It can be confusing. Especially with const or let. After all these are all declarations, so why declare declarations ;) And how is 'declare function' different from specifying a function signature type, as in type PredicateFn = (value: any) => boolean (for example).
@DavidAguileraMoncusi Жыл бұрын
I use them too. But it bug me that they're only aliases and TS doesn't complain when i mix them up. Or should I say it USED to bug me? I discovered Andrew's video on Branded Types and I'm now using those instead (via a package named ts-brand). Totally recommend it!
@kouroshg4621 Жыл бұрын
I personally like to use interfaces for my react component props and type for all other objects used. I come from c# and can’t help but to see resemblance of classes in react components although vastly different after introduction of hooks. Thanks for the in-depth comparison!
@jcollins519 Жыл бұрын
Great video! I'd love to see more on the last topic you mentioned about having a global API interface that each module is capable of extending and the related gotchas that come along with that
@biskitpagla Жыл бұрын
Really just boils down to this: Want union types? -> use type alises. Want extension methods? -> use interfaces.
@ajgubi19 Жыл бұрын
Many thanks. Compared to other of the "popular" channels, your videos are simpler to understand. Please keep making videos. Subscribed. 💯
@producdevity2 жыл бұрын
Your video’s are great! I was wondering why they didn’t pop up in my feed earlier, then I saw that nowhere in the title or description you mention typescript. Might be helpful for youtube algorithm to add it
@andrew-burgess2 жыл бұрын
Good point! 🙈 thanks for watching!
@FirstLast-kv1iq2 жыл бұрын
This was super useful! Thank you so much
@saketc2010 Жыл бұрын
Confused with type:'admin'. Can you pls elaborate
@pgtechmedia56245 ай бұрын
Really helpful. Thanks
@avi36812 жыл бұрын
Very clear video.
@redcrafterlppa303 Жыл бұрын
I don't know about typescript but what you showed really defeats the purpose of the idea of interfaces. Interfaces are in concept types that define the minimal api surface a certain functionality should have. For example: interface List { add(val: T) : boolean get(index: int) : T set(index: int, val: T) } class ArrayList implements List {...} class LinkedList implements List {...}
@kugi7786 Жыл бұрын
That was really helpful, thank you
@matthewlefevre5667 Жыл бұрын
Very helpful. Thank you!
@bubu88134 Жыл бұрын
Amazing
@rahimco-su3sc Жыл бұрын
thanks | defenetly helpfull
@aamirsuleman9815 Жыл бұрын
Adding a key “type” to an extended interface threw me off at 5:00 😂
@windar2390 Жыл бұрын
9:00 - For me thats the only reason to use interfaces.
@adriatic1239 ай бұрын
Problems with once potent javascript ecosystem were started once OOP programmers started to move into js world without respecting its specific strengths. Now we are forced not only to use js in an OOP way which is totally wrong, but they dont stop there but want to mould js js into a total OOP language. This shows not only lack of js knowledge but also a disrespect of all js community. I long for times where there were two independedt words, functional programming js world and OOP world