I've always never understood infer. But the examples you have shown is the best that made me understand finally.
@vihanv8582
2 жыл бұрын
Wow! This has got to be the best video on the infer keyword I've ever seen. Keep up the good work Andrew! Liked and subbed 😀
@the_proletariat
9 ай бұрын
This was cool. I didn't know anything about infer. Thanks to your video and challenges, now I know. Keep up the good work!
@serglohm
2 жыл бұрын
Great job! This is definitely the best video about infer on 2022!
@i.j.5513
Жыл бұрын
Really nice demonstrations. Thanks a lot! It really made me understand the infer keyword better!
@kyuubyemy
Жыл бұрын
My implementation of FirstParam and SecondParam: type FirstParameter any> = T extends (firstParam: infer A, ...args: any[]) => any ? A: never; type SecondParam any> = T extends (firstParam: any, secondParam: infer A, ...args: any[]) => any ? A: never; Also Jojo is everywhere LMAO
@AiguretDuren
Жыл бұрын
This was legitimately fun to code along with. Thank you!
@user-pk8dz4qc9b
2 жыл бұрын
This was the best explanation for infer. Cheers!
@user-vp7ht2fg1u
2 жыл бұрын
That is the best explanation of infer ever. It is not fair. Why shitty stuff like "BECOME A FRONTEND DEVELOPER IN 5 SECONDS" is much more popular...
@dimitargetsov9690
Жыл бұрын
Two reasons to remember and share this channel with anybody: 1.content (on TS) second to none. 2.family name -Burgess--same as of Antony Burgess--"Clockwork Orange".
@andrew-burgess
Жыл бұрын
Lol thanks!
@BobbyBob21
Жыл бұрын
Thank you. Perfect examples.
@vishwajeetraj11
2 жыл бұрын
This was Epix. Looking out for more.
@user-zx8js8do5b
2 жыл бұрын
What a great explanation, thank you so much!
@joshreynolds4164
2 жыл бұрын
Great explanation on this. Infer is so powerful
@samirnayibruza9135
11 ай бұрын
You could do something like this instead of using overloads on functions: ```ts interface Item { id: number } interface FindOptions { one: boolean } declare function find(options: Options): Options extends {one: infer FindOne} ? FindOne extends true ? Item: Item[] : never const item = find({one: true}) // Item const items = find({one: false}) // Item[] ``` Edit: After a few minutes I realized that in the above case there is no need because I could just do `Options extends {one: true}` directly but imagine the possibilities 😁
@johnyepthomi892
2 жыл бұрын
Dayum. This is very useful. Thanks for sharing.
@devinorium
Жыл бұрын
Upped the production quality. Looks dope
@shayanpaul3430
2 жыл бұрын
I have a question related to testing whether two types are equal or not. The utility type in @type-challenge is as follows : export type Equals = (() => T extends X ? 1 : 2) extends (() => T extends Y ? 1 : 2) ? true : false; Maybe it a very basic or idiotic question but i am unable to understand from where this T type parameter is coming from and what will be its values
@andrew-burgess
2 жыл бұрын
Definitely not a dumb question, TypeScript's syntax here is pretty confusing. My understand is that, by declaring a generic parameter T (that declaration is the part), you're saying that T should be assigned when you call the function. Like this: declare function oneOrTwo(): T extends string ? 1 : 2; const x = oneOrTwo(); // 1 const y = oneOrTwo(); // 2, because T defaults to unknown I found this really in-depth explanation of the whole Equals type, which might be helpful too: stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript Thanks for watching!
@douglasamoo-sargon5049
Ай бұрын
Awesome tutorials
@mikedelcastillo
Жыл бұрын
you are a god kind sir, thank you!
@MohamedRagab-kp6bp
2 жыл бұрын
type MyParameters< T extends (...args: any[]) => any, I extends number > = T extends (...args: infer A) => any ? A[I] : never;
@yujitomita3969
2 жыл бұрын
Thank you for this. Agreed with Jimmy this is hard.
@mohibwasay5102
2 жыл бұрын
Wow. Awesome. Thanks Andrew.
@fluxsiarski
3 ай бұрын
Amazing!
@PickleRiiiiiiick
2 жыл бұрын
This is good stuff.
@gangster4208
2 жыл бұрын
Thanks for the video!
@ffedchik
2 жыл бұрын
Awesome content. Keep up the great work!
@developerfriendly
2 жыл бұрын
superb tutorial!
@michaelalls8230
2 жыл бұрын
Tried to use typescript-challenges but getting an error on the import of the challenges utils. Is there something special that has to be done to get that working?
@andrew-burgess
2 жыл бұрын
Hmm, don’t think so. Can you comment with a link to your playground?
@afuzzybearsyoutubechannel2812
4 ай бұрын
💚
@chamir4614
2 жыл бұрын
Great video dude!! Thx you :D
@handsome_man69
Жыл бұрын
Handsome man
@JackieTreehorn-xd
2 жыл бұрын
Subbed!
@edgarabgaryan8989
2 жыл бұрын
awesome!
@samislam2746
Жыл бұрын
omg, how do you know all that stuff!
@samirnayibruza9135
11 ай бұрын
🤯🤯🤯🤯🤯
@JeanAlesiagain3
2 жыл бұрын
Typescript has become very complicated
@michaeldimmitt9974
2 жыл бұрын
lol
@BHFJohnny
2 жыл бұрын
Nope. Too advanced. Need to back off a bit
@andrew-burgess
2 жыл бұрын
Thanks for checking this out! Here’s one where I explain the details a little finely: kzitem.info/news/bejne/2IWEnIF5jGJ_nno
@alsbahsy
2 жыл бұрын
this is harder than rocket science
@andrew-burgess
2 жыл бұрын
Nah, you got this! Let me know if you have questions, happy to help!
Пікірлер: 48