Common Mistakes and Advanced Typescript Techniques

  Рет қаралды 5,613

Ljupche Vasilev

Ljupche Vasilev

Күн бұрын

My desk setup:
💻 Macbook Air M2 8GB RAM, 512GB SSD: (US) amzn.to/4ckunuo | (UK) amzn.to/3PrjddH
⌨️ Apple Magic Keyboard: (US) amzn.to/3IGam3J | (UK) amzn.to/3TetzOQ
🖱️ Apple Magic Mouse: (US) amzn.to/3J1Juf3 | (UK) amzn.to/48YZvfZ
📱 Laptop stand: (US) amzn.to/49X0Ghu | (UK) amzn.to/3wZYwPy
🖥️ Dell 27 inch Full HD Monitor: (US) amzn.to/3TFj0FX | (UK) amzn.to/49ZaIi4
🔲 Dual Monitor Stand: (US) amzn.to/3vr0MyG | (UK) amzn.to/48XxRjK
🎧 Beats Studio Pro: (US) amzn.to/3Tj3yy9 | (UK) amzn.to/3ViiaAr
Are you transitioning from JavaScript to TypeScript but still encountering errors like "cannot read undefined of object"? In today's video, I'll share my insights after years of coding in both languages. Join me as we explore three common TypeScript mistakes and delve into three advanced typing techniques that will elevate your coding game.
🚀 Quick Intro to TypeScript
Let's kick things off with a quick overview of TypeScript. While JavaScript lacks built-in typing, TypeScript offers static typing capabilities, allowing developers to define types and interfaces for variables, functions, and classes. Now, let's dive deeper into the world of TypeScript.
😬 3 Common Mistakes
1. Assuming Types without Validation
2. Using any
3. Using Type Assertions Excessively
🛠️ 3 Advanced Typing Techniques
1. Utility Types
2. keyof
3. Mapped Types
🔍 Closing Thoughts
In conclusion, TypeScript offers a robust solution for writing JavaScript code with enhanced error-checking capabilities. By avoiding common mistakes and embracing advanced typing techniques, you'll unlock the full potential of TypeScript and streamline your development process.
🔗 Useful Links:
JavaScript vs TypeScript: The Key Differences: chat.openai.com/c/67389687-d8...
Official TypeScript Documentation: Official TypeScript Documentation
Stay tuned for more coding tips and tutorials. Happy coding, and I'll catch you in the next one! 🌟🚀👨‍💻
Background song by:
/ dahjp

Пікірлер: 21
@SuperKidontheblock
@SuperKidontheblock 2 ай бұрын
Can you imagine having a large object with different fields being returned. Zod is heaven sent.
@LjupcheVasilev
@LjupcheVasilev 2 ай бұрын
100%! I don’t use it enough, I use AJV more, but I will be using it for my new side project.
@heavierthanlight7173
@heavierthanlight7173 Ай бұрын
I just made the decision to use Zod inside Typescript projects after I read some really interesting articles on the net.
@LjupcheVasilev
@LjupcheVasilev Ай бұрын
Let us know how you're finding it after some time :)) @@heavierthanlight7173
@heavierthanlight7173
@heavierthanlight7173 Ай бұрын
@@LjupcheVasilev will do!
@bradleyhill5312
@bradleyhill5312 2 ай бұрын
Really great rundown of useful tips for TypeScript! Thanks for the good work!
@LjupcheVasilev
@LjupcheVasilev 2 ай бұрын
Glad it was helpful!
@ivanlysko6677
@ivanlysko6677 5 күн бұрын
I've been trying to understand the distinctions between using types, enums, and const in TypeScript. Could you shed some light on how they differ and when to use each one?
@LjupcheVasilev
@LjupcheVasilev 2 күн бұрын
Types is a way to define what kind of values does the variable hold and it helps with type safety, catching issues while developing etc. For example `const status: string = 'active'` Enums are a way to define a set of named constants. For example when we have a variable of status and we know the status can be Active or Inactive only, that's when enums are most useful. Then these enums can be used to validate the input or whenever we need to use the status we can see which values it can be. Const is just a way to define a constant variable, same as in javascript. Constant means the value of the variable never changes. If the type is an array then we can mutate it like add/remove items but if we define a string we can't reassign it. Hope that helps.
@morteza7298
@morteza7298 Ай бұрын
Great video man, keep going
@LjupcheVasilev
@LjupcheVasilev Ай бұрын
Thank you!
@nimitsavant3127
@nimitsavant3127 2 ай бұрын
Very descriptive and informational thank you :)
@LjupcheVasilev
@LjupcheVasilev 2 ай бұрын
You're very welcome!
@manishgautam2424
@manishgautam2424 Ай бұрын
That was great , You can deliver much better content , Keep it up
@LjupcheVasilev
@LjupcheVasilev Ай бұрын
Thank you, glad you like it :)
@iUmerFarooq
@iUmerFarooq 2 ай бұрын
Will you make course on typescript or Vuejs or Nuxtjs or NodeJs ExpressJs or Nestjs or Graphql?
@LjupcheVasilev
@LjupcheVasilev 2 ай бұрын
Probably not a whole course soon. But I will continue to make videos on those subjects.
@umaralifayzullayev
@umaralifayzullayev 2 ай бұрын
Wow this channel is so good 👍 👍 👍
@LjupcheVasilev
@LjupcheVasilev 2 ай бұрын
Thank you so much 😀
@user-dd7kw3ym5i
@user-dd7kw3ym5i 2 ай бұрын
I think you don't need to check their types here 2:41 you already have defined types of it so TS will throw an error and you don't have to check it
@LjupcheVasilev
@LjupcheVasilev 2 ай бұрын
The reason why I’m checking the types there is because in my types they are set as required properties, but because they are input from the user we can’t be sure the user has actually sent all the required fields. I could’ve made the properties optional and then typescript will complain if they are not checked.
Finally Fix Your Issues With JS/React Memory Management 😤
20:13
Jack Herrington
Рет қаралды 78 М.
TypeScript Wizardry: Recursive Template Literals
14:47
Tech Talks with Simon
Рет қаралды 36 М.
маленький брат прыгает в бассейн
00:15
GL Show Russian
Рет қаралды 4,4 МЛН
SHE WANTED CHIPS, BUT SHE GOT CARROTS 🤣🥕
00:19
OKUNJATA
Рет қаралды 11 МЛН
ISSEI funny story😂😂😂Strange World | Magic Lips💋
00:36
ISSEI / いっせい
Рет қаралды 160 МЛН
Chips evolution !! 😔😔
00:23
Tibo InShape
Рет қаралды 27 МЛН
Common Typescript Mistakes You Don’t Know About
15:35
Monsterlessons Academy
Рет қаралды 2,7 М.
Software Architecture From 0 To Enterprise
13:31
Ljupche Vasilev
Рет қаралды 708
Learn TypeScript Generics In 13 Minutes
12:52
Web Dev Simplified
Рет қаралды 203 М.
7 Awesome TypeScript Types You Should Know
8:57
Josh tried coding
Рет қаралды 74 М.
any vs unknown vs never: TypeScript demystified
8:01
Andrew Burgess
Рет қаралды 19 М.
Infer is easier than you think
13:38
Matt Pocock
Рет қаралды 84 М.
How Senior Programmers ACTUALLY Write Code
13:37
Thriving Technologist
Рет қаралды 1,3 МЛН
TypeScript Generics are EASY once you know this
22:21
ByteGrad
Рет қаралды 119 М.
маленький брат прыгает в бассейн
00:15
GL Show Russian
Рет қаралды 4,4 МЛН