TypeScript Tutorial #18 - Generics

Поділитися
Вставка
  • Опубліковано 22 гру 2024

КОМЕНТАРІ • 113

  • @codecleric4972
    @codecleric4972 2 роки тому +14

    This syntax was one of the most confusing bits about TS for me, but now it makes perfect sense. Thank you! Such a clear explanation!

  • @madd5
    @madd5 4 роки тому +35

    As a C# developer it's nice to see these features in javascript.

  • @TJMcCarty
    @TJMcCarty Рік тому +4

    The best explanation of Generics I've seen so far on UA-cam. Thank you for making this simple to understand.

    • @NetNinja
      @NetNinja  Рік тому +2

      Glad it was helpful!

  • @joephus24
    @joephus24 10 місяців тому

    Generics have confused me from the moment I laid eyes on typescript. This video has done wonders to clear the fog around . Thanks a bunch!

  • @ib7612
    @ib7612 Рік тому

    Such a great explanation! I loved the approach when u said that the generic type T for example, CATCHES what is passed in as arguments when we invoke the function. Thank you very much!

  • @Shakeel714
    @Shakeel714 3 роки тому +9

    Wonder explanation of complex topics in simple and easy-to-digest way!! Thanks

  • @timsch4101
    @timsch4101 2 роки тому +4

    Thanks for this! I ended up following this complete course because of my confusion with Generics and you filled in a lot of gaps :)

  • @NativeFX22
    @NativeFX22 Рік тому

    I was confused about the whole concept of generics.But, I got a solid understanding of it before you even complete the video. Your explanation is clear and straight to the point. Thanks.

    • @NetNinja
      @NetNinja  Рік тому

      That's awesome to hear :) thanks for watching

  • @mattwilliams1844
    @mattwilliams1844 4 роки тому +4

    Really love how the typescript devs implemented some core concept ideas from C++.

    • @peterschmid7507
      @peterschmid7507 2 роки тому

      they did not, Anders Heljsberg designed the language

  • @RajvirSingh1313
    @RajvirSingh1313 3 роки тому

    I want to appreciate that you explained so hard a concept so easily

  • @tretyakweb1754
    @tretyakweb1754 Рік тому +1

    This is the best training video about Generics. Thank you!😘😘😘😘😘

  • @jakubnam7512
    @jakubnam7512 4 роки тому +3

    Thank you very much for sharing your knowledge with us in such an accessible way

  • @MrVisheshsingh
    @MrVisheshsingh 4 роки тому +3

    The best explanation for Generics 🤑

  • @xenialxerous2441
    @xenialxerous2441 3 роки тому

    You are awesome

  • @phoneix24886
    @phoneix24886 4 роки тому +26

    How did I learn typescript in a day?
    Code like C#, think like javascript. And there you go.. Typescript ladies and gentlemen.

    • @mecamon
      @mecamon 4 роки тому +4

      Both languages were made by the same person, that's probably why they are so similar.

  • @yasinatesim
    @yasinatesim 4 роки тому +10

    The video series I need, perfect timing. I love The Net Ninja 😍
    What's your VSCode theme? Your VSCode theme is very cool 😎

  • @VishnuSunilkumar
    @VishnuSunilkumar 3 роки тому +2

    Got it.Good Explanation...Thank you for making this video.

  • @gulinatayier9049
    @gulinatayier9049 2 роки тому

    The best explanation so far! Thank you so much!

  • @damiangilz
    @damiangilz 4 роки тому +2

    And when It has several values, comma separated, like ?

  • @johnnysepulveda1185
    @johnnysepulveda1185 Рік тому

    Thank you very much ninja for these tutorials 💻💪🏼👨🏼‍💻

  • @Danny-uq9zf
    @Danny-uq9zf 4 роки тому

    Two videos in the same minute
    Bravo

  • @ridl27
    @ridl27 4 роки тому +1

    perfect explanation of Generics!

  • @factsfundoo
    @factsfundoo 4 роки тому

    lecture 16 or 17:
    let doc: HasFormatter;
    we can define it as object like let doc:{};
    because if we assign doc = new invoice()
    and invoice class has format function that doc can access why we assign doc: HasFormatter.

  • @tayfun6378
    @tayfun6378 4 роки тому +41

    please make a video about how to stop watching your videos and actually start coding. I'm in the net ninja tutorial hell and I've even created a playlist of playlists that I'm gonna binge watch.

    • @mikha2880
      @mikha2880 3 роки тому +1

      just finding a job. your knowledge will be usefull and implemented ASAP :)

    • @Maya_ni_Ochiru
      @Maya_ni_Ochiru 3 роки тому +1

      @@mikha2880 bruh

    • @TrinaYau
      @TrinaYau 2 роки тому

      code along! :)

    • @hongquannguyen5532
      @hongquannguyen5532 7 місяців тому

      @@mikha2880 that's not how to escape tutorial hell lol

  • @NateBabbel
    @NateBabbel 2 роки тому

    Excellent video on Generics! Thank you!

  • @kjn5991
    @kjn5991 4 роки тому +1

    Little tip for ID's: use something like UUID (if you are using npm):
    npm install uuid
    import { v4 as uuidv4 } from 'uuid';
    uuidv4(); // Returns random UUID

    • @ibadshaikh2215
      @ibadshaikh2215 3 роки тому

      Obviously! Shaun is just giving an example.

    • @kjn5991
      @kjn5991 3 роки тому +1

      @@ibadshaikh2215 Yeah, but it wouldn't hurt to teach a good practise right away.
      Of course, there are already auto-generated ID's with Firestore and other modern databases.

  • @daliagadelhak3237
    @daliagadelhak3237 2 роки тому

    Excellent brief clear explanation! Lots of thanks!!

  • @emmanuelamodu2390
    @emmanuelamodu2390 2 роки тому

    Great tutorial shaun, helped brush up my TS knowledge as well as vanilla JS concepts

    • @NetNinja
      @NetNinja  2 роки тому

      Glad it helped Emmanuel!

  • @thriftykapila8420
    @thriftykapila8420 4 роки тому +3

    You are the best, just a little request. The Net Ninja, I hope you see this comment. Like me many other people want a web series based on building couple of web apps using complete MERN stack, as you had already covered everything like these in separate playlists dedicated to each technology. Kindly make a series for complete MERN stack web app. Also please teach Role based access control. and dashboard building...
    Lots of love, big time fan... Alright then Gang!

  • @dijiflex
    @dijiflex 2 роки тому

    Thank you. This was a clear defination

  • @amershboul9107
    @amershboul9107 2 роки тому

    you are amazing by simplifies things .. THANK YOU

    • @NetNinja
      @NetNinja  2 роки тому +1

      Thanks for your support Amer :)

  • @longhenaa
    @longhenaa 2 роки тому

    just incredibly good every time

  • @Alex-vg8zw
    @Alex-vg8zw 4 роки тому +1

    Nice tutorial. May I ask you a question? Why you use windows over Mac OS or Linux as a developer?

  • @Palundrium
    @Palundrium 3 роки тому

    How did you convert that string so quickly to an array at 9:10 in the video? Is there a VS Code shortcut or extension that does that?

    • @joemn9114
      @joemn9114 3 роки тому

      @palundrium select the string and ctrl + [ To wrap brackets around the string or ctrl + { to wrap curly braces around the string.

  • @Room3102
    @Room3102 2 роки тому

    Great explanation. Thank you.

  • @TheVideogamemaster9
    @TheVideogamemaster9 2 роки тому

    Instead of "string[]" would you also be able to do "Array"?

  • @wuxinyang1797
    @wuxinyang1797 8 місяців тому

    What if we want to make all three fields generics in that interface, what should the syntax look like?

  • @dadadodo123
    @dadadodo123 3 роки тому

    brilliant explanation, thank you so much!

  • @marcinkalmar9964
    @marcinkalmar9964 2 роки тому

    It is easy to understand by your explain.

  • @aidenyang747
    @aidenyang747 3 роки тому +1

    Thanks for this playlist, it is really awesome. Just wondering when will the webpack playlist that you mentioned come out?

  • @sean9829
    @sean9829 4 роки тому +1

    nicely explained.

  • @telviosheldon3204
    @telviosheldon3204 3 роки тому

    This video saved me. I was stuck on a bug for 2days

  • @mikesmyth6576
    @mikesmyth6576 4 роки тому +2

    Thank you, excellent tutorial series. I have to start doing TypeScript for work these days so this has been a great explainer. To be honest I think I prefer the simplicity of plain vanilla JavaScript (ES6+) for an easier coding life. Interfaces + Generics, that's heavy doc. Also I don't know if I want to invest in TypeScript for personal projects, it might not be around forever, it could go the way of CoffeeScript if they add typing to JS one day.

  • @andrew.schaeffer4032
    @andrew.schaeffer4032 Рік тому

    Great explanation thanks!

    • @NetNinja
      @NetNinja  Рік тому

      Glad it was helpful Drew!

  • @eugeniogonzato
    @eugeniogonzato 3 роки тому

    Very interesting and very well explained

  • @DanNjeru1
    @DanNjeru1 3 роки тому

    I had trouble understanding Java generics, but this just clicked.

  • @jojojawjaw
    @jojojawjaw 3 роки тому

    Such a great tutorial, thank you

  • @RezHimself
    @RezHimself 7 місяців тому

    why don't you use :any instead of ?

  • @amirovuz
    @amirovuz 4 роки тому +1

    thank you very much

  • @yamgemy
    @yamgemy 3 роки тому

    thank you man, that helped

  • @planetmall2
    @planetmall2 2 роки тому

    Thank you!

  • @mohammedmiah3019
    @mohammedmiah3019 2 роки тому

    Thank you, its been bugging me for a while this.

  • @zachmsdev747
    @zachmsdev747 2 роки тому

    Such a good video thank you!

    • @NetNinja
      @NetNinja  2 роки тому

      Thanks Zach, hope it helped!

  • @prachibadami5023
    @prachibadami5023 2 роки тому

    hii, I am new to typescript
    i have one doubt about returning value that why there is 3 dot before obj while returning?

    • @icy1
      @icy1 2 роки тому

      It's a spread operator, an ES6 feature.

  • @Alptugaydin
    @Alptugaydin 3 роки тому

    6:20 why not any?

  • @moatazemad3678
    @moatazemad3678 3 роки тому

    but why we make its harder to our selfs we can just use (any) type in front of the value that we want it to be generic and thats it
    and in function we can just structure the object by saying obj:{name:string,age:string} so its know the properties

  • @nouralsatari6424
    @nouralsatari6424 3 роки тому

    why don't we use type any instead of assigning a generic to data property?

  • @thulasireddy1122
    @thulasireddy1122 4 роки тому +3

    Please upload angular series tutorial ninja sir

  • @canmertinyo
    @canmertinyo 2 роки тому

    thanks dude

    • @NetNinja
      @NetNinja  2 роки тому +1

      No problem! :) thanks for watching

  • @sayanmohsin
    @sayanmohsin 4 роки тому

    is Decorators included in the coming tutorial?

    • @NetNinja
      @NetNinja  4 роки тому +1

      Hey, not in this one but I’ll do a video about them in future 👍

    • @sayanmohsin
      @sayanmohsin 4 роки тому

      @@NetNinja thanks :)

  • @kshitijmohan3992
    @kshitijmohan3992 2 роки тому

    would love a trpc tutorial

  • @jeffinj7707
    @jeffinj7707 4 роки тому

    Wow, just great

  • @avigarg3357
    @avigarg3357 Рік тому

    awesome video

  • @VishnuSunilkumar
    @VishnuSunilkumar 3 роки тому

    You just scared me at @9:24 I thought my screen wrecked....

  • @priyandarshana4830
    @priyandarshana4830 4 роки тому

    thanks

  • @VishalSharma-rn7mt
    @VishalSharma-rn7mt 2 роки тому

    Awesome

  • @bohdanyun
    @bohdanyun 2 роки тому

    👍👍👍

  • @ASTechEdu
    @ASTechEdu 11 місяців тому

    Nice video sir

  • @nobodyeverybody8437
    @nobodyeverybody8437 Рік тому

    and the use case?

  • @Faheem4449
    @Faheem4449 3 роки тому

    Attach playlist link in description or in comments

  • @asfandiyar5829
    @asfandiyar5829 Рік тому

    OHHHHHHHHHHHHHH. So that's what it means. Thanks :)

  • @ridl27
    @ridl27 4 роки тому

    ty vm.

  • @codewithsait
    @codewithsait 4 роки тому +3

    We are waiting node.js course, Mr. Ninja

  • @ulrichfladl7995
    @ulrichfladl7995 2 роки тому

    Programming is hard. We can combat this by listening to the Net Ninja.

  • @Ivsti831
    @Ivsti831 10 хвилин тому

    why don't you just put any as the type of data

  • @newmagicfilms
    @newmagicfilms 3 роки тому

    1000+ likes / 1 dislike ... wow who is that hater

  • @CastleShield
    @CastleShield Рік тому

    So it's a way for not using 'any' and not creating a bunch of interfaces for objects that are very simmilar I guess.

  • @mtalhakhalid1679
    @mtalhakhalid1679 5 місяців тому

    look like templates in c++

  • @sam-h5r6j
    @sam-h5r6j 6 місяців тому

    The fact that 'docone' didn't pick up the other properties of the object e.g. name:'yoshi' seems to make no sense at all.

  • @moussafiradil1700
    @moussafiradil1700 2 роки тому

    well, that's just C++minus some steps

  • @himanshupathak2197
    @himanshupathak2197 2 роки тому

    So, can i say - "generics are a way to use Type as a parameter."

  • @juroltv3119
    @juroltv3119 4 роки тому

    More now like java. Polymorphism 🎩

  • @alanwalker5845
    @alanwalker5845 3 роки тому

    but why tf we do all this nonsense. It seems like C# crap

  • @handsome_man69
    @handsome_man69 2 роки тому

    I have herpes

  • @salahalhashmi6528
    @salahalhashmi6528 3 роки тому

    thanks