Тёмный

Learn TypeScript Generics In 13 Minutes 

Web Dev Simplified
Подписаться 1,6 млн
Просмотров 265 тыс.
50% 1

Опубликовано:

 

21 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 252   
@Oliver-rh5bv
@Oliver-rh5bv 4 месяца назад
Very often it feels like - yes its totally clear and so easy - when watching videos like this. Then we go back to work and in most cases our problems are more complex and they still need some time to get around that barrier in the head and apply what we just have learned. I tought myself the generic stuff by using it in my daily work and I still keep watching videos like this to learn about the very edgew cases - the smart little things I missed in the documentation documents in the web.
@afrotechtips
@afrotechtips 8 месяцев назад
Whenever I find it very hard to grasp a concept, I run to this channel. You are the GOAT
@Martin97perussini
@Martin97perussini 9 месяцев назад
Excellent, you honored the "simplified" to your name with this video, really easy to understand this way
@gyros9162
@gyros9162 8 месяцев назад
This is the shortest and best explanation generic types and functions I've ever saw
@gheorghitacristea5750
@gheorghitacristea5750 5 месяцев назад
Shortest, you sure?
@yuvrajsingh-gm6zk
@yuvrajsingh-gm6zk 24 дня назад
I just had completed the rust book and searching for the term "generics" on youtube, came across this video( just for second perspective to make the thing really sink in) nailed it!
@waseemtahir6740
@waseemtahir6740 6 месяцев назад
This is shortest and the best explanation of generics in TS. Thanks for this Kyle.
@AtaurRahman-vm1uz
@AtaurRahman-vm1uz 4 месяца назад
Probably the best video for generics in youtube. Hats of man.
@true227
@true227 4 месяца назад
is it a joke?
@AtaurRahman-vm1uz
@AtaurRahman-vm1uz 3 месяца назад
@@true227 Why do you think its a joke? Simple explanation.
@crvlwanek
@crvlwanek 9 месяцев назад
The type system in TypeScript is so much more expressive than other languages. It has great inferencing, keyof for derived types, even ternaries for narrowing/filtering types
@arshiagholami7611
@arshiagholami7611 9 месяцев назад
You need an expressive type system to support types in a dynamic scripting language.
@oscarljimenez5717
@oscarljimenez5717 9 месяцев назад
@@arshiagholami7611actually not, for example python type system is very basic.
@arshiagholami7611
@arshiagholami7611 9 месяцев назад
@@oscarljimenez5717 python doesn't have a type system. it's a type hint for your IDE.
@ElektrykFlaaj
@ElektrykFlaaj 8 месяцев назад
@@arshiagholami7611 Rust has even more expressive type system than TS, and it's a static typed language
@arshiagholami7611
@arshiagholami7611 8 месяцев назад
@@ElektrykFlaaj no it doesn't, i've coded in both languages for years and I can tell you typescript's type system is way more complex for obvious reasons. I love rust tho 😇
@lauragreen3132
@lauragreen3132 7 месяцев назад
I was baffled by Generics in the docs & other tutorials. This is incredibly helpful and clear. Thank you.
@NLJ-r9y
@NLJ-r9y 8 месяцев назад
Really need your nextjs course, Kyle!!!
@miladevs
@miladevs 3 месяца назад
This video is a great introduction to generics! Generics can be a confusing topic, but this video breaks it down into clear and easy-to-understand concepts. I especially liked the way he showed how to use generics with API responses. This is a common use case for generics, and it was helpful to see how to create a generic API response type that can be reused for different API endpoints.
@fifty-plus
@fifty-plus 8 месяцев назад
Its a better practice to name your generic arguments prefixed with T, like TModel, TRequest, etc. like we do in C#. Yes it's Hungarian-like but it works well to distinguish generic arguments while keeping them explicit and descriptive.
@ivan.jeremic
@ivan.jeremic 8 месяцев назад
Hungarian-like. What does that even mean?
@fifty-plus
@fifty-plus 8 месяцев назад
@@ivan.jeremic Hungarian notation.
@IannoOfAlgodoo
@IannoOfAlgodoo 8 месяцев назад
Marking your type in TS with T, makes code messy IMO.
@anotherhumanLingLing
@anotherhumanLingLing 4 месяца назад
Wow, this is the first time I feel like I understand what Generics type is. BIG THANK YOU!
@srleom
@srleom 4 месяца назад
Simply the best explanation of TypeScript generics out there. Kyle, you're a legend. Thanks for making these videos 🙏🏻
@SirojiddinMirzayev-zy3pl
@SirojiddinMirzayev-zy3pl 3 месяца назад
You are the one of the teacher who I know in RU-vid , I did not understand until I watched this video why we needs typescript
@bencipherx
@bencipherx 5 месяцев назад
I have not started watching this but when I saw the video, I said if I don’t understand this concept after watching your videos then I can never understand it from anywhere else. Already seeing positive comments so 😅fingers crossed 🤞
@Belgabor
@Belgabor 8 месяцев назад
Very good introduction. One thing I would recommend for people just starting to learn this, do not even start naming generic parameters with single letters, be expressive. You may start out with a simple type where it's clear what 'T' is, but after a few weeks it has T, R, E, O and W. And a month later you have no idea any more what each of the letters are supposed to mean.
@fabianpetersen2452
@fabianpetersen2452 8 месяцев назад
I'm currently learning Typescript and struggled a lot getting used to the syntax and trying to figure out what must be passed in to remove all these errors even though the code is correct with plain react/javascript. Thanks Kyle, this will assist me tremendously going forward.
@adreto2978
@adreto2978 3 месяца назад
Wow this actually exactly what I need to clean up some messy types in my current project.
@WebSurfingIsMyPastime
@WebSurfingIsMyPastime 8 месяцев назад
I needed more info on generics and I had already signed up for the react course on webdev. I'm glad I purchased the course on typescript. The extra info in your course was exactly what I needed to guide me through a basic understanding of generics.
@kanfit
@kanfit 3 месяца назад
brief and get to the point, really appreciated
@ahsanimam5243
@ahsanimam5243 3 месяца назад
Hey @kyle, That is an awesome video. I wanted to point something in your last example regarding object. The value of new Date() would resolve to `object` so that might not work well. I think a more robust definition for an object would be Record or something along those lines. What are your thoughts? And thanks once again for another great video.
@MagicPants647
@MagicPants647 9 месяцев назад
I like thinkin of generics as just a way to pass in types to a function or another type. kinda like how you’d pass in parameters to a function.
@leobertobittencourtfilho3036
@leobertobittencourtfilho3036 4 месяца назад
Goodness me, and you're not even cutting the video every time! Cheers, mate!
@therealj4282
@therealj4282 5 месяцев назад
Nice clear explanation - so many people get tied up in knots trying to explain generics.
@felistusobieze8951
@felistusobieze8951 8 месяцев назад
I enjoyed this. Thanks for clarifying. I actually use this but never knew I was implementing a generic type system. Learnt new stuff today.
@thedrew6905
@thedrew6905 4 месяца назад
short and concise, i always come back to refresh my memory
@caioveb
@caioveb 5 месяцев назад
The best drops of knowledge in video I ever seen! Congratulations, man! And thank you very very much
@shreyas12321
@shreyas12321 4 месяца назад
Cool thumbnail. That was the exact emotions I was going through before seeing this video :) Thank you for the video
@ThangPhan-q3u
@ThangPhan-q3u 4 месяца назад
Thank you so much, I really appreciate it :)
@aaadesh
@aaadesh 2 месяца назад
Great content, well explained.
@fuadagayev-mg7fk
@fuadagayev-mg7fk 5 месяцев назад
Best Generics explain one of!
@anruntxd8711
@anruntxd8711 4 месяца назад
Thank you so much, your explanation was really easy and helpful!
@maxidietz429
@maxidietz429 4 дня назад
Short question about generics. When I have this type: export type TExtensionConfig = { oExtClass: TExt; oExtConfig?: ConstructorParameters[1]; }; How look's the array type for this? Background. I woul'd like to have a settings object who have a property "aExtensions". Each extension object should have a property called "oExtClass" for defining the extension class and an optional property called "oExtConfig". Each array item can have another extension / another generic class. The extension class is a abstract. Thanks.
@edisonj9664
@edisonj9664 4 месяца назад
Typescript generics explained well
@pro100tom
@pro100tom 8 месяцев назад
Man, after watching all kinds of your videos I am now convinced you are the one to explain the monads!
@fifty-plus
@fifty-plus 8 месяцев назад
Monads are easy but often over complicated. ru-vid.comC2-ljnsckrs?si=cHTDnp5xmdRE_b9f
@gageracer
@gageracer 9 месяцев назад
bro, you just explained it so well! Now I don't hate generics that much. My only issue was that for some reason you need to put generics between the name and the parenthesis. I was trying to use it for svelte 5 props and was doing: let {name} = $props() and had no idea why it wasn't working. fyi you need to do it $props()
@joe-skeen
@joe-skeen 9 месяцев назад
I think that choice came from other C-family languages that also use the same syntax for generics, like C# and Java to make it more approachable and intuitive for those developers. But for someone that hasn't worked with strongly typed languages in the past, they are understandably intimidating
@romaniaplus
@romaniaplus 9 месяцев назад
Love to see you simplifying the crazy webdev today everything build on top of everything. This mess starts to kill me.
@ClaytonBoyle
@ClaytonBoyle 6 месяцев назад
Just an amazing 12 minutes of content. Thank you so much
@Vptechvelly
@Vptechvelly 6 месяцев назад
Easy explanation ,Simplified the explanation of generic type easy to understand.
@Matiast9477
@Matiast9477 9 месяцев назад
This was great, now I need to understand when you get to that point where you see stuff like T extende keyof K or something like that
@khawajamohsin7194
@khawajamohsin7194 8 месяцев назад
I just realised how much i needed this video. Good work.
@mondirhallouli
@mondirhallouli 8 месяцев назад
great video! finally got a better idea on how generics work. I had the basic notion but never understood them like this. They are kinda placeholders for a type(s).
@ozdenocak7937
@ozdenocak7937 Месяц назад
great explanation!
@tjohns92109
@tjohns92109 6 месяцев назад
Is Typescript really necessary? I have not wrapped my head around why there is a use to make code more complex just to make sure you are using the correct type of variables. I mean... I know what my variables are intended to be when I create them and when I use them later. So I'm not sure of the whole point of TS.
@lucasbezerra649
@lucasbezerra649 4 месяца назад
JSDocs is a good alternative if you feel that way
@NazwaBricksZajeta
@NazwaBricksZajeta 5 месяцев назад
Thank you for clarifying this!
@jattoritittor8342
@jattoritittor8342 7 месяцев назад
Thank you very much for always simplifying very well this kind of typescript concepts :D
@theisoj
@theisoj 9 месяцев назад
Great video so far! Thanks Kyle as always! 👍
@sergiom.954
@sergiom.954 8 месяцев назад
Great video! 👏I have been working with typescript for 3 years (angular) and I didn't even know this generic types possibilities.
@hillelgarcia5140
@hillelgarcia5140 3 месяца назад
very good stuff, thanks!
@LeVanHienFEFPLHN
@LeVanHienFEFPLHN 5 месяцев назад
Great video, thanks for kyle
@norbusherpa3665
@norbusherpa3665 5 месяцев назад
it was so fun to watch this
8 месяцев назад
You really do the web dev simplified!!!😀
@PrabhuKripaHai
@PrabhuKripaHai 8 месяцев назад
Nicely explained, it just fit into my mind. Thanks.😊
@magorzatagajlusz9170
@magorzatagajlusz9170 6 месяцев назад
so amazing! it's really easy to understand 😄
@StephenRayner
@StephenRayner 9 месяцев назад
Already good with generics, this is a decent coverage of them.
@abhidadhaniya5701
@abhidadhaniya5701 8 месяцев назад
Great video kyle, Please cover keywords like Infer, As and Satisfy in Typescript. Thank you.
@Cognitoman
@Cognitoman 6 месяцев назад
Think of generics like functions for types, the generic takes a type as an argument. Once you think of it like that… it’s easy
@eduardherasym689
@eduardherasym689 7 месяцев назад
best webDev channel. Thanks)
@Amanrauniyar-dm7in
@Amanrauniyar-dm7in 7 месяцев назад
brother your next level thankyou for all these
@pakistanigymers2k22
@pakistanigymers2k22 8 месяцев назад
Loved your explanation!!! 😁
@d-princecoder4031
@d-princecoder4031 6 месяцев назад
great simplification
@MuhammadumarSotvoldiev
@MuhammadumarSotvoldiev 10 дней назад
Thank you very much
@mosescosme8629
@mosescosme8629 8 месяцев назад
My favorite part of this video was learning that I've already been using Generics everywhere and had no idea that's what they were called.
@secret786786
@secret786786 7 месяцев назад
Amazing video... Really helpful!!
@gunjangaba122
@gunjangaba122 9 месяцев назад
This is super useful for writing clean Typescript code. Thanks for sharing!
@rajviahmed-r7c
@rajviahmed-r7c 8 месяцев назад
Great tutorial. Your explanation is awesome.
@kylesandstrom853
@kylesandstrom853 5 месяцев назад
Great video and explanation as always, I really like your video tutorials... but TS still feels like overkill in most use cases I've seen.
@angmathew4377
@angmathew4377 2 месяца назад
Thanks for making it happen, do you do blazor, any content references?
@radomir_web
@radomir_web 22 дня назад
Thanks!
@tomasburian6550
@tomasburian6550 8 месяцев назад
Top. I'm to this day shocked how little attention people give to TS given that we use it everywhere in the professional world. Learning as much of it as possible can make a developer go a long way. The same goes for writing tests.
@rEmIxKoOL
@rEmIxKoOL 8 месяцев назад
Amazing! Clear and helpful
@mukullataroy2195
@mukullataroy2195 9 месяцев назад
Ahh generics.... My worst enemy
@joe-skeen
@joe-skeen 9 месяцев назад
Right next to regular expressions, no doubt 😉
@yohanneskindu8794
@yohanneskindu8794 8 месяцев назад
​@@joe-skeenchatgpt used to do it's magic for me on regex
@elixirdeveloper6673
@elixirdeveloper6673 8 месяцев назад
I feel u
@unleash-gamplay
@unleash-gamplay 8 месяцев назад
Same to you
@elixirdeveloper6673
@elixirdeveloper6673 8 месяцев назад
@@unleash-gamplay dw bro practice makes perfect
@boxboxerson991
@boxboxerson991 9 месяцев назад
see this is good because it's not some vague opinion piece on how types are better than interfaces or some nonsense. exclusively stuff like this pls.
@YusufxonToshkandiy
@YusufxonToshkandiy 5 месяцев назад
perfect , and thanks bro
@dinguskhan8883
@dinguskhan8883 8 месяцев назад
Would love to see a video about what stuff makes typescript’s inference not work
9 месяцев назад
thank you a much, I love your courses
@valkopuhelin2581
@valkopuhelin2581 3 месяца назад
Any video that shows all the keyboard typing shortcuts, many of which were used here and went over my head?
@Aditya-k4t
@Aditya-k4t 2 месяца назад
Informative but i got confused at the end
@superuser8636
@superuser8636 8 месяцев назад
Coming from C++, I love everything about TypeScript
@david.thomas.108
@david.thomas.108 5 месяцев назад
Super informative video thanks 👍
@enlightenedarchitect1673
@enlightenedarchitect1673 6 месяцев назад
i wish you were a private tutor!
@ehsanset6709
@ehsanset6709 6 месяцев назад
Very helpful, Thanks
@theidanking
@theidanking 8 месяцев назад
Thank you! You know how to explain
@tubenzr
@tubenzr 8 месяцев назад
long time no see Kyle, as always great content. 👍👍👍
@true_visual
@true_visual 8 месяцев назад
Thank you very very much for this tutorial! Can you please make a video about differences between Generics and Interfaces? I am pretty new and if someone would ask me to define a type of something, my mind thinks "Interface" at once!
@dawid_dahl
@dawid_dahl 8 месяцев назад
With (string | number)[] you said, when the type returned from getFirstElement was “string | number”: “But TypeScript is not smart enough to know that (what we passed in was actually a string).” It’s not that TS is not smart enough. It was that the type was explicitly set as “string | number”, and since the function has not actually been run yet, there is no way TS could possibly know that, no matter how smart it was. It was simply respecting the programmer’s wishes, not being stupid. 😄
@deogenesabejuelajr6701
@deogenesabejuelajr6701 3 месяца назад
AMAZING!!!!🙌🙌👋👋👋
@lambgoat2421
@lambgoat2421 8 месяцев назад
Thanks for these tips Spider-Man
@alexanderkomanov4151
@alexanderkomanov4151 8 месяцев назад
Thanks a lot for this!
8 месяцев назад
nice content , I wish you sell your ts course cheaper hence we could buy it my friend 😂
@danilomourelle
@danilomourelle 8 месяцев назад
I don't know man. I would say that it gonna use extends a lot when using generics... Every time I neede an explicit generic, half of time is with extends... Great video by the way...
@jasonlough6640
@jasonlough6640 8 месяцев назад
At 4:02, you pass to tell it what the generic value passed in should be. Makes sense. At 4:37, you seem to be passing in... the return type? querySelector, now input is of type HTMLInputElement. so which is it, the type passed in or a return type?
@kenichiwaaa
@kenichiwaaa 8 месяцев назад
If you pause at 4:42, you can see that the generic is placed after the semicolon, meaning the return type. At 4:02, Kyle specifically use the generic for the parameter passed in. So it can be both. It is just a matter of how and where you define it
@LittleLily_
@LittleLily_ 8 месяцев назад
The generic type can be used anywhere in the function, either in the input arguments, the return type, or even both. For example: function foo(a: T) { return "foo" } function bar(a: T): T { return a } function getFoo(obj: { foo: T }): T { return obj.foo }
@_neuromanser_
@_neuromanser_ 8 месяцев назад
Never used this, but it seems useful.
@adityamittal4357
@adityamittal4357 4 месяца назад
Thanks a lot
@eyobsamuel8722
@eyobsamuel8722 8 месяцев назад
did you know? the intro music in the video is done by Kyle, with that guitar. @Kyle, please confirm.
@MrVipulLal
@MrVipulLal 9 месяцев назад
Brilliant video, as usual
@RandikaTechWork
@RandikaTechWork 6 месяцев назад
Rally good one .. Keep it up..!!
@iqbalibrahim4713
@iqbalibrahim4713 8 месяцев назад
You sir, are a hero
@hemat_energi
@hemat_energi 6 дней назад
shorter and better generic explanation
Далее
TypeScript Generics are EASY once you know this
22:21
Просмотров 136 тыс.
연준 (YEONJUN) ‘GGUM’ Official MV
02:44
Просмотров 9 млн
А вам, слабо?
00:22
Просмотров 56 тыс.
The Most Important Skill You Never Learned
34:56
Просмотров 204 тыс.
as const: the most underrated TypeScript feature
5:38
Просмотров 118 тыс.
Why Signals Are Better Than React Hooks
16:30
Просмотров 476 тыс.
Generics: The most intimidating TypeScript feature
18:19
Top 6 React Hook Mistakes Beginners Make
21:18
Просмотров 573 тыс.
TypeScript Tutorial for Beginners
1:04:28
Просмотров 1,3 млн
Why use Type and not Interface in TypeScript
14:12
Просмотров 206 тыс.