TypeScript Mixin Classes - JavaScript Multiple Class Inheritance // Advanced TypeScript

preview_player
Показать описание
TypeScript and JavaScript classes only support single class inheritance.
In this tutorial, we will look at a general pattern for mixins that allows multiple #class inheritance for TypeScript and JavaScript.

🚥 Professional Courses

Additional Resources:

#basarat #TypeScript #Tutorial #JavaScript

👇 SUBSCRIBE for MORE 👇

**Feel Free To Read This Lot**

I'm Basarat, That TypeScript Guy and I love helping developers. More about me:

Microsoft MVP for TypeScript
Lead Frontend Practice at Australia Post
150K contributions on Stackoverflow. Top Contributor for TypeScript.
Book Author : Beginning NodeJS
Book Author : TypeScript Deep Dive
Creator of multiple hot ✨ed Github Open Source projects

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

Really good one! It gets tricky sometimes to understand mixins and this clarifies a lot

orbai
Автор

I hope one day I will be as good in typescript as this. Good job @Basarat

PeterNgerere
Автор

There is a very tricky issue with mixins in TS. You cannot use them as type for another method/function, e.g. you cannot write like this:

const SendDataPayload = SomeMixin(class { f1: number })


But instead you should write a bit more code and use some utility types:

const SendDataPayload = SomeMixin(class { f1: number })
SendDataPayload>>({})

kasir-barati
Автор

Really Appreciate your hard work and teaching skill. Thanks.

sourishdutta
Автор

That's kind of content i was looking for! really appreciate that bro, thx a lot. 💡

ricardofagmer_
Автор

Why is there an error at 3:34? I could understand what you meant by type vs variable

anonymoussloth
Автор

thanks for this series. very informative

fgngejw
Автор

I think I will use this in my ever going project trying to create the elusive Maybelists Class

Luxcium
Автор

May I know how to annotate mixins with JSDOC?

ankitanand