In this Typescript tutorial, we'll learn about TS Arrays, Tuples, Objects & Enums. If you have questions, please join my Discord server where I answer questions and you can chat with other web dev students: discord.gg/neKghyefqh
@ahmad-murery2 жыл бұрын
2:50 if we want to specify the type and we don't enclose the union type within parentheses like this using: string | number[] instead of (string | number)[] TS will then think it's either a string or array of numbers, In addition to using interfaces to declare custom types, the real power of interfaces (IMHO) comes from implementing it in multiple different classes, after that we can use that interface to declare a param type in a function which now can accept any object implementing specified interface regardless of what its base class looks like a rare but useful use case for enum is when combined with binary values to represent multiple options, here is a quick example for a collection of weapons might be used in game dev enum Weapon { Pistol = 1, Gun = 2, Bomb = 4, Sowrd = 8 } // Collect a few weapons using bitwise OR let myWeapons = Weapon.Gun | Weapon.Pistol console.log(myWeapons) // Check if you have a specific weapon using bitwise AND if(myWeapons & Weapon.Bomb){ console.log('Drop your bomb') } if(myWeapons & Weapon.Gun){ console.log('Shoot the target') } Finally, thanks Dave and thanks to everyone who read so far,
@DaveGrayTeachesCode2 жыл бұрын
Great notes and examples Ahmad! 💯
@flowerofash4439 Жыл бұрын
man, telling me to "please give this video a like" really helpful since I always forget to leave a like before hopping to the next video
@DaveGrayTeachesCode Жыл бұрын
Thank you! 🚀
@zuhaibamjad7668 Жыл бұрын
Thanks Mr Gray. I will remember to keep striving for progress over perfection because a little progress everyday will go a long way.
@DaveGrayTeachesCode Жыл бұрын
💯🚀
@celestinenwachukwu919 Жыл бұрын
Everyday, I’m grateful I started with JAVA
@dansmar_24142 жыл бұрын
Absolutely, one of the best channels about programming!
@DaveGrayTeachesCode2 жыл бұрын
Thank you for the kind words!
@Duelweb2 жыл бұрын
Just popped in quickly (since I am still doing your Javascript course) to give a thumbs up as I will be returning to watch this very excellent course. Man, I just love your teaching style. No BS, nice n' snappy and to the point!
@DaveGrayTeachesCode2 жыл бұрын
Thank you for the kind words!
@BirushaNdegeya10 ай бұрын
This video is great for someone who wants to start in Typescript. Thanks
@keunbai12 жыл бұрын
You are the best teacher in coding ever. Thank you always
@DaveGrayTeachesCode2 жыл бұрын
You're very welcome!
@alexvass2 жыл бұрын
Thanks
@DaveGrayTeachesCode2 жыл бұрын
Thank you for the support, Alex!
@mdsalahuddin46464 Жыл бұрын
Your channel is the great treasure for the passionate learners
@DaveGrayTeachesCode Жыл бұрын
I appreciate that!
@gabcompany59602 жыл бұрын
Amazing Dave , really loved it, I was looking for a series like this to learn ReactJs, I've seen crash course in ur channel but I need step by step tutorial like this . Thanks again and have a nice day
@DaveGrayTeachesCode2 жыл бұрын
You're very welcome! After the basics, we'll look at TS & React.
@okonkwo.ify182 жыл бұрын
You refused to answer my questions about remote jobs but I always refer my friends to your channel cos I love your content
@DaveGrayTeachesCode2 жыл бұрын
I don't refuse to answer any questions. Sometimes YT marks comments as spam or makes them hard for me to find. Please join my Discord to insure your questions are seen. Link to Discord invite in the description.
@okonkwo.ify182 жыл бұрын
@@DaveGrayTeachesCode Oh. Thanks. I was worried cos I asked twice . Am downloading discord now. See you there
@Hferko67 Жыл бұрын
Very clear explanations that even I as a beginner could understand.😃
@madi4128 Жыл бұрын
I learned many valuable things from your channel, thanks for sharing it
@mohammadrezaakhshabi75872 жыл бұрын
hello dave thank you for great tutorial. i learned many things from you such as redux toolkit full course and react authenthication, i just want to say thank you and i appreciate that. and i dont want watch other TS courses because i feel more comfortable with your courses and your learnings way, So i wait untill you release the new episode
@DaveGrayTeachesCode2 жыл бұрын
You are welcome!
@ranjanrnj68642 жыл бұрын
Great Video again, Thank you Dave
@damianodamian79072 жыл бұрын
Brilliant tutorial, I enjoy a lot your teaching style. It was very interesting, thank you very much. I'm sure your channel is going to grow fast
@DaveGrayTeachesCode2 жыл бұрын
Thank you very much!
@syedmajid32024 күн бұрын
Thanks for tutorial, very helpful!
@pH7Programming Жыл бұрын
Great one Dave! Thanks for sharing this 🤗
@zabiremu Жыл бұрын
Thank you sir for your wonderful tutorial. Thanks from Bangladesh.
@MOJICA72572 жыл бұрын
Thanks again Dave!, You are the BEST!
@DaveGrayTeachesCode2 жыл бұрын
My pleasure!
@blueblue94102 жыл бұрын
This is an amazing tutorial! Thank you so much for this! I'm learning react and ts and this is super helpful. I'm understanding everything. Gonna watch the entire playlist if I have time
@DaveGrayTeachesCode2 жыл бұрын
Glad it was helpful!
@AliRaza-nm3eu2 жыл бұрын
i learn a new thing from this video ....if we put ? this make that field optional .... sir really appreciated your teaching procedure ,,,, Thanks for providing these series for free
@DaveGrayTeachesCode2 жыл бұрын
You're welcome!
@piyushmahapatra54022 жыл бұрын
Would request you to start using Typescript in next React Project:)
@DaveGrayTeachesCode2 жыл бұрын
Great suggestion!
@hosamgnaba32052 жыл бұрын
Nice video Dave, thank you 😄😄
@DaveGrayTeachesCode2 жыл бұрын
Very welcome!
@rahmatyousefi82732 жыл бұрын
You explain very well, thank you
@DaveGrayTeachesCode2 жыл бұрын
You are welcome!
@abdulrahmanagboolaosho35822 жыл бұрын
Thanks man
@DaveGrayTeachesCode2 жыл бұрын
You're welcome!
@sonamohialdin33762 жыл бұрын
Awesome teaching thank you
@DaveGrayTeachesCode2 жыл бұрын
You are very welcome!
@k303k Жыл бұрын
Thanks for the video!
@habib40972 жыл бұрын
You are great teacher. Please start Next.js series
@DaveGrayTeachesCode2 жыл бұрын
Thank you!
@g-ytub2 жыл бұрын
Excellent! keep it up Dave :)
@DaveGrayTeachesCode2 жыл бұрын
Much appreciated! I'll keep going! 🚀
@j7coder Жыл бұрын
Amazing Dave!
@DaveGrayTeachesCode Жыл бұрын
Thank you!
@johannedwardpolaniagonzale67972 жыл бұрын
Thanks for sharing your incredible knowledge.
@DaveGrayTeachesCode2 жыл бұрын
Glad it was helpful!
@TravinskiyVladislav2 жыл бұрын
Thank you, Dave
@DaveGrayTeachesCode2 жыл бұрын
You're welcome!
@DiegoBM2 жыл бұрын
Fantastic content Dave! The first video got me completely engaged! This one is also very good but it feels very packed, since you went through a lot of content (although very well explained), but since you're keeping the duration still short you didn't explain some elements, which I don't know if it's intended and this was just an introduction leaving it for the student to dig deeper, or if you'll be revisiting these topics in future videos. In particular I was wondering if you'll be introducing the "const enum" concept later on, since it has some benefits if you want to keep your JavaScript codebase more streamlined.
@DaveGrayTeachesCode2 жыл бұрын
Although I often receive compliments for how detailed my tutorials are, they would be much, much longer if I attempted to cover everything. I always recommend students dig deeper into the docs as they learn to discover more.
@DiegoBM2 жыл бұрын
@@DaveGrayTeachesCode I apologise, I expressed myself poorly. By packed I meant more like that there was not enough time to cover everything so in-depth as to touch the "const enum" mentioned earlier, more than there was too much content to process. The video was very detailed in what it was explained indeed.
@alseynidiop86502 жыл бұрын
I you do react-typescrpte , if would be perfect, I mean a react project with typescrpt. Thank you. you are doing an amazing job.
@DaveGrayTeachesCode2 жыл бұрын
Thank you!
@sarmadfaizan28102 жыл бұрын
learn alot from you.. can you please start angular after this..
@DaveGrayTeachesCode2 жыл бұрын
Glad to hear that! Thanks for the request, but I have no plans for Angular in the near future.
@Odisej12 жыл бұрын
this is some quality staff.
@BrentHarris002 жыл бұрын
thank you!
@DaveGrayTeachesCode2 жыл бұрын
Welcome!
@martinmendez695 Жыл бұрын
This is a great tutorial... you have no Shades Mr Gray.
@aurobindobhuyan2107 Жыл бұрын
New subscriber ❤
@roman_k892 жыл бұрын
like #153💪 nice video, I`m learning typescript with you) thanks for an awesome job
@DaveGrayTeachesCode2 жыл бұрын
You're welcome! 💯
@BackToVoid2 жыл бұрын
thank you sir. btw, what's your favorite Van Halen song ?! im a fan too 🙃
@DaveGrayTeachesCode2 жыл бұрын
You're welcome! Oh so many to like... it might be Drop Dead Legs. Hard to commit to just one! 🎸💯
@MigalYaroslav2 жыл бұрын
nice lesson.
@DaveGrayTeachesCode2 жыл бұрын
Thank you!
@sidkapoor90852 жыл бұрын
Hello sir, I had a quick question. do backend devs mainly work on CRUD apps at the junior level? appreciate everything you do.
@DaveGrayTeachesCode2 жыл бұрын
Hi Sid - I cannot give one answer for the entire industry. I think this could vary greatly from job to job. Maybe they land a job and get assigned to maintain a legacy project that no one else wants. Maybe they just get assigned small pieces of a larger project. Maybe they do get assigned a CRUD project. So many possibilities.
@raminisrafilli32672 жыл бұрын
veryy goood
@DaveGrayTeachesCode2 жыл бұрын
Thank you!
@soner87802 жыл бұрын
Wohhooo 🥳
@DaveGrayTeachesCode2 жыл бұрын
🚀😎
@big-jo892 жыл бұрын
Thank you Dave for this great content I really love this series I just have a question about TS don't know if this is the right place to ask, but I hope you can help me out here, so I have this array : [ { data: [ { id: 1, title: 'manage team', icon: , href: '/team', options: { selected: false, active: false } }, { /* SAME STRUCTURE */ }, ], }, { charts: [ /* SAME STRUCTURE */ ], }, // MAYBE MORE ... ]; and I just don't know how to annotate it properly in TS 😔, really appreciate your help with this one 🙏
@DaveGrayTeachesCode2 жыл бұрын
Please join my Discord where it is easier to share code examples and discuss problems like this compared to the YT comments: discord.gg/neKghyefqh
@@proletar3799 yeah this almost identical to what I have come up with, but I think your interface is missing [ ] at the end because I need the Data to hold an array of the structure so my solution was like that : type Data = { [key: string | number]: Item[ ] }[ ]; but again I don't think it's the best way to do it but hey it works, thank you
@bryikcode Жыл бұрын
Hello Dave thank u , when you complete NextJS Course
@DaveGrayTeachesCode Жыл бұрын
I just follow the content. No specific timeline to complete.
@bryikcode Жыл бұрын
@@DaveGrayTeachesCode 😇 no rush , thank u
@rjmacalino31862 жыл бұрын
Off topic: What do you think about Next JS? I finish your MERN lesson but as i heard from other videos, React is not SEO friendly so they use Next to solve that. Next 13 is out btw. Hope you can make a crash course.
@DaveGrayTeachesCode2 жыл бұрын
Yes, many requests for Next.js and I'm glad I have waited. Anything released before a couple of days ago would be obsolete. I'll cover it in the near future.
@DiegoBM2 жыл бұрын
@@DaveGrayTeachesCode fantastic timing then! I presume that your course will be focusing on Next13 (although I seem to remember that some kind-of-major changes might be coming in future versions)
@YL-pl1ek Жыл бұрын
Awesome!!!!!!!!!!! I do the like to every video and for sure subscribed as well ! Thank you for the excellence go! Now - all of the above in one words :=> yAsssssz !
@DaveGrayTeachesCode Жыл бұрын
You're welcome!
@hardwired662 жыл бұрын
Next js typescript tailwind maybe good
@hanhtruong48482 жыл бұрын
Next time i think you should try to covert a ReactJS project you had to new ReactTS project.
@DaveGrayTeachesCode2 жыл бұрын
A refactor video would be good. Yes, this tutorial series has two new projects.
@emmanueloluwafemi72362 жыл бұрын
Dave how are you learning all these and releasing videos at once.. You are really trying. Please learn mySQL.. We need react node express sequelize and mySQL. Relational database management system is the best.. I still learn javascript everyday even though I'm very good at javascript.. I'm afraid I won't forget js if I move to typescript or python
@DaveGrayTeachesCode2 жыл бұрын
I've been doing this for years - definitely not learning everything at once! I so know SQL (and variations like MySQL and MS-SQL). You can always search my channel, but here's a link to the one video I have released about SQL: kzbin.info/www/bejne/jXexpaCerLpofrc I will likely do more in the future. 🚀
@emmanueloluwafemi72362 жыл бұрын
@@DaveGrayTeachesCode please can you integrate it with node js. Use Prisma framework or sequelize with react express and node please. This kind of video is very scarce in youtube
@DaveGrayTeachesCode2 жыл бұрын
@@emmanueloluwafemi7236 thank you for the request!
@olawumisegun58982 жыл бұрын
Hi, is it possible to get the keys of an interface as an array just like we would normally do with object using Object.keys(Person). my end goal is to get ["name", "age", "location"] from interface Person. interface Person { name: string; age: number; location: string; }
@DaveGrayTeachesCode2 жыл бұрын
Keep going in this series. I think what you will want is an index signature and there is a video in this series that covers those.
@nikhilraj4098 Жыл бұрын
Why does this work? let tupleActual: [string, number, boolean] = ["Nikhil", 24, true]; tupleActual.push(444); console.log(tupleActual); Output=> ['Nikhil', 24, true, 444] Why does this work? Why is TypeScript not throwing an error and allowing us to modify the length? I thought it was supposed to not work
@Grishopping2 жыл бұрын
SENESEI online gracias .
@DaveGrayTeachesCode2 жыл бұрын
Welcome!
@loukhai Жыл бұрын
❤
@jiauyjiauy37777 ай бұрын
hwen?
@BrentHarris002 жыл бұрын
EVH is active: false, cause he passed away :(
@DaveGrayTeachesCode2 жыл бұрын
He lives on through his music! 🤘🎸💯 But yes, RIP EVH.
@jserr9682 Жыл бұрын
when I heard typescritp was static type I was Sold on it ......and Also RIP the Greates Guitarist To EVER LIVE Eddie Van Halen!!!!!!!