I have yet to come across a use case for Mixins in my daily work, but I love the concept👍 It is really cool to see new stuff like this and I am a big fan of your No BS TS series so far. I am really looking forward to all the content that you will create
Love the use of generics to constrain the mixable source. This actually does not mutate the source but creates a new class that is a mixin of functionality. Wow, I did not know you could do this.
Btw, your videos simply superb. Even as developer very familiar and comfortable with TypeScript, I learn something from EVER one of your videos. Some I have watched multiple times. Your pace and tersity is wonderful. Keep up the great work!
typescript is beautiful suggar syntax everywhere. i spent like 30 min figuring out all those types and got it right. And then you explained everything very simple. i should have watched the last part befoure pausing it hehe
this is really interesting byt as others pointed I don't see directly use cases for it (I might be wrong). Nonetheless, the video was really nice and worth watching for the knowledge itself. Thanks, Jack!
It's not complicated, but requires too much work to get it working. In dart you just use the "with" keyword in the class definition. Would be incredible if MS implemented this into TS, but I doubt it, since they follow ES too closely.
You are correct. Typescript is never going to whole sale add new language features. An underlying tenet of TS is that you can remove all the type annotation and have code that runs as JS. Personally I'm ok with that. I like that TS is just "JS with types". There are lots of languages out there that compile to JS and have an entirely different syntax (e.g. Elm). And if that's what people want they can do that. But it's nice to have TS in this space of tracking to JS.
@@jherr it seems v8 is very fast that "compilers developers" never wants to replace the JS interpreter iteself do you is it worth to have an enitrely independet engine for typescript ? beacause it's something higher than a just superset lang ... it's perfect i think .
Wow. I know how to do composition in JS, but have really been scratching my head over the Typescript way for the past week or so. I click on your video and suddenly everything "clicks" for me and I wonder how come I did not find that video the first time I was researching this. Turns out it was uploaded today :D Instantly subscribed! What is your opinion on using applyMixins as described in the TS docs here? I can't really work out the benefits of using either approach over the other. They mention in the docs that applyMixins rely on your codebase over the compiler to keep the build- and runtime type-system in sync. But I'm not really sure what the implication of this is in practice?
You both look and sound like another person I like and listen to a lot, Sean Carroll. Sorry I just had to say it. 😄 Thanks a bunch for all your great content! 🙏🏻
Thank you for your amazing videos Jack ! I am learning concepts from your videos indeed. I tested your initial class return from the function but I get an error that "Property 'completeLog' of exported class expression may not be private or protected." So basically it should be marked as public. But I wonder how in your video it does not show any errors. The code that I am referring to is : function myLoggerClass() { return class Logger { private completeLog: string = ""; log(str: string) { console.log(str); this.completeLog += `${str} `; } dumpLog() { return this.completeLog; } } }
I have yet to come across a use case for Mixins in my daily work, but I love the concept👍
It is really cool to see new stuff like this and I am a big fan of your No BS TS series so far.
I am really looking forward to all the content that you will create
This one completely blew my brain up, especially the use of it with generics
Thank you Sir, i had difficulty dealing with Mixins with Class type currently. I'll be using your fantastic approach for my case. Thank you again.
This video literally goes above my head at the end
Love the use of generics to constrain the mixable source. This actually does not mutate the source but creates a new class that is a mixin of functionality. Wow, I did not know you could do this.
Btw, your videos simply superb. Even as developer very familiar and comfortable with TypeScript, I learn something from EVER one of your videos. Some I have watched multiple times. Your pace and tersity is wonderful. Keep up the great work!
typescript is beautiful suggar syntax everywhere. i spent like 30 min figuring out all those types and got it right. And then you explained everything very simple. i should have watched the last part befoure pausing it hehe
This one was really advanced. Will try to return to it tomorrow. Wasn't able to fully grasp it.
it is a mind bender for sure.
Great explanation. Mixins used quite a bit in the Angular framework.
Very good explanation! Much better than on documentation.
this is really interesting byt as others pointed I don't see directly use cases for it (I might be wrong). Nonetheless, the video was really nice and worth watching for the knowledge itself. Thanks, Jack!
It's not complicated, but requires too much work to get it working. In dart you just use the "with" keyword in the class definition. Would be incredible if MS implemented this into TS, but I doubt it, since they follow ES too closely.
You are correct. Typescript is never going to whole sale add new language features. An underlying tenet of TS is that you can remove all the type annotation and have code that runs as JS. Personally I'm ok with that. I like that TS is just "JS with types". There are lots of languages out there that compile to JS and have an entirely different syntax (e.g. Elm). And if that's what people want they can do that. But it's nice to have TS in this space of tracking to JS.
@@jherr it seems v8 is very fast that "compilers developers" never wants to replace the JS interpreter iteself
do you is it worth to have an enitrely independet engine for typescript ?
beacause it's something higher than a just superset lang ... it's perfect i think .
Wow. I know how to do composition in JS, but have really been scratching my head over the Typescript way for the past week or so. I click on your video and suddenly everything "clicks" for me and I wonder how come I did not find that video the first time I was researching this. Turns out it was uploaded today :D Instantly subscribed!
What is your opinion on using applyMixins as described in the TS docs here? I can't really work out the benefits of using either approach over the other. They mention in the docs that applyMixins rely on your codebase over the compiler to keep the build- and runtime type-system in sync. But I'm not really sure what the implication of this is in practice?
Forgot to paste in the link to the docs: www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern
great video! thanks for sharing!
you have the best tutorials thanks for your videos
you can use a generic and replace "getObject():object" in line 52 with "getObject():K" to make it more open and not bound to an object type.
Jack , really nice tutorial i need more and more example about this feature Mixins in real work or when can I used it .
That's insanely good
What kind of black magic is this? so cool!
That was very helpful, thanks. BTW, how do you draw on screen ?
I use Screen Brush and a tablet.
You both look and sound like another person I like and listen to a lot, Sean Carroll. Sorry I just had to say it. 😄
Thanks a bunch for all your great content! 🙏🏻
The physicist?
@@jherr Indeed! 🙂
Thank you for your amazing videos Jack ! I am learning concepts from your videos indeed. I tested your initial class return from the function but I get an error that "Property 'completeLog' of exported class expression may not be private or protected." So basically it should be marked as public. But I wonder how in your video it does not show any errors. The code that I am referring to is :
function myLoggerClass() {
return class Logger {
private completeLog: string = "";
log(str: string) {
console.log(str);
this.completeLog += `${str}
`;
}
dumpLog() {
return this.completeLog;
}
}
}
I think we can do the same by extending the class? Building functionality on top of another class.
But can you add the same functionality to multiple classes with different class tree roots without copy and paste? That's what mixins gives you.
@@jherr awesome thanks for the clarification.
I think a function that returns a function is called a curried function.
vscode themes??
wtf genial!
I watched the full video but still not sure where to use this abnormal thing (Mixins).
Maybe adding logging to existing un-logged classes?
No BS, this series is the only reason I didn't throw out typescript and run it over with a car.
Why we don't just extend the class that we want to add new functionality to it?!
wait....ya'll use classes? No shade. I just don't get out much from React land.
Some folks still do, but yeah, in React, not so much.
My god Mixins are awful.... The tutorial is great though.