Typescript Mistakes Every Junior Developer should Avoid | clean-code

2024 ж. 19 Мам.
273 971 Рет қаралды

If you're a Typescript Developer and you use it pretty much for any project you would work on, then, you're probably missing out on some Junior Mistakes that you should avoid to become more productive and write cleaner code.
⭐ Timestamps ⭐
00:00 Intro
00:55 Use `unknown` instead of `any`
05:33 Not using the `is` Operator
07:55 `satisfies` Operator is awesome
10:30 No more Enums
11:37 Utility Types are superb!
-- Special Links
✨ Join Figma for Free and start designing now!
psxid.figma.com/69wr7zzb1mxm
👉 ✨ Join Figma For Professionals And Start Designing with your Team ✨
psxid.figma.com/ucwkx28d18fo-...
🥶 💻 Typescript Junior Mistakes Repo
github.com/ipenywis/typescrip...
🧭 Build Login/Register API Server w/ Authentication | JWT Express AUTH using Passport.JS and Sequelize
• Build Login/Register A...
🧭 Turn Design into React Code | From prototype to Full website in no time
• Turn Design into React...
🧭 Watch Tutorial on Designing the website on Figma
• I Design a onecolor We...
🧭 Watch Create a Modern React Login/Register Form with smooth Animations
• Create a Modern React ...
🧭 Debug React Apps Like a Pro | Master Debugging from Zero to Hero with Chrome DevTools
• Debug React Apps Like ...
🧭 Master React Like Pro w/ Redux, Typescript, and GraphQL | Beginner to Advanced in React
• Master React Like Pro ...
🧭 Learn Redux For Beginners | React Redux from Zero To Hero to build a real-world app
• Debug React Apps Like ...
🧭 Introduction to GraphQL with Apollo and React
• Introduction to GraphQ...
🐦 Follow me on Twitter: / ipenywis
💻 Github Profile: github.com/ipenywis
Made with 💗 by Coderone

Пікірлер
  • Awesome tips! I have been working with typescript for few weeks, almost all pf the tips you mentioned I needed them at some point.

    @abdulazeez.98@abdulazeez.98 Жыл бұрын
  • The most concise explanation of `unknown` vs `any` i know of: - `unknown` is the union of every type there is. - `any` is the "elastic" type which fits to what it needs to be. (It may also be thought of as the switch to selectively disable type checking) bonus point: `never` is the union of no type.

    @FozIrenics@FozIrenics Жыл бұрын
    • And when you realize unknown is a complementary type of never

      @tylim88@tylim88 Жыл бұрын
    • i would add, that use const enum, not enum... it will make optimization better ; )

      @Microphunktv-jb3kj@Microphunktv-jb3kj Жыл бұрын
    • And what a "no type" would be?

      @AmodeusR@AmodeusR Жыл бұрын
    • i keep reading comments the more i read the more i dont see sense of learning 100 new keywords to write 'safeR javascript' TS was supposed to be a safe way of writing javascript; I watched like 5 tutorials, took notes, and now that im reading comments there seem to be a few keywords popping up suggested in the comments. It feels like, its not but, it feels like im learning C++ in order to write JavaScript I really see no point of learning TS but every job description for JS requires TS skills so yeah, otherwise i've built personal projects in JS (react+node) and there's bugs, and i fixed those bugs, i didnt need TS. In my last project i have like 100 files just on the frontend, i've separated logics, kept it clean, followed naming convention, and everything is pretty clean ........ TS feels like u live in China and u learn Japanese when everyone around u speaks Chinese.

      @Winter_Wyvern1@Winter_Wyvern1 Жыл бұрын
    • ​@@Winter_Wyvern1are you using it by now?

      @thecoolnewsguy@thecoolnewsguy7 ай бұрын
  • Good stuff man. Been in the field for 4 years. Ive only known half of the things u mentioned. Awesome to learn something new today 😄

    @aminroslan@aminroslan Жыл бұрын
  • All explanations were clearly and consistent, with perfect examples

    @martinemanuel8239@martinemanuel8239 Жыл бұрын
  • Great video, well explained… for all audience, I believe it will be easier to follow the examples if they are very bare or well slimmed down if you’re talking about the basics.

    @mbao01@mbao01 Жыл бұрын
  • This is pure gold. So clear and concise! Thank you!

    @rodrigolaporte274@rodrigolaporte274 Жыл бұрын
  • This is great!!! I've been using typescript for a long time and learned something. Thank you!!

    @emcpadden@emcpadden Жыл бұрын
  • Some tips I knew but would not have been able to explain better than you ! Excellent video.

    @AlainBoudard@AlainBoudard Жыл бұрын
  • Thank you so much this tip will adjust my type annotation in correct way to avoid using explicit any type

    @warenarapocgador4633@warenarapocgador46335 ай бұрын
  • 12:49 Fun thing is here, using satisfies keyword along with Record would be a good idea too, because for the red property, without satisfies (so color: Record = {} ) you will only have the common methods/properties between arrays and string, such as .length etc ... I'm pretty sure I saw this exemple in the documentation for satisfied :D

    @ZeldriFR@ZeldriFR Жыл бұрын
  • Learnt some new features that Typescript has that I wasn't aware of. The `satisfies` and `obj is Type` sections were nice to see. I've been using Typescript for 4 years, and never knew these existed, though, they may have been added more recently than my knowledge extends to (TS 2.4). I'm currently between jobs, so I'm taking my free time to catch up on technologies that I learnt prior to my most recent job.

    @AeroSW@AeroSW5 ай бұрын
  • This was great, I learned so much in this video. Thank you!

    @lin-zchang4774@lin-zchang4774 Жыл бұрын
  • Mate this is so good! Definitely helped out this JS dev!

    @ryanvarley2391@ryanvarley2391 Жыл бұрын
  • Great video! The first point at 1:00 does a great job on type guards, but doesn't really explain `any` vs `unknown`. Like at 5:03, code completion has nothing to do with `any` vs `unknown` and everything to do with the type guard. What `unknown` does a great job with is *requiring* that the narrowing happens before assignment. IOW if you change the code to use `any`, it will still work and the type guard will still allow completion. But it will fail to compile if you try to assign the unknown response to a user variable (whether admin or not) before that type guard. Just paste in the following in the typescript playground: interface IUser { id: number; name: string; foo: (s: string) => void; } /** * type guard would be better implemented like stated in the video, using `unknown` type. */ function isUser(obj: any): obj is IUser { // extremely naive checking here for illustrative purposes only if (typeof obj === "object" && typeof obj.name === "string" && typeof obj.id === "number" && typeof obj.foo === 'function') { return true; } else { return false; } } const obj = { id: 42, name: "Alice", foo: (s: string) => { console.log('foo: ' + s); } } obj.foo('const obj'); // compiles because tsc knows of the property on the object itself const anyObjDeserialized: any = JSON.parse(JSON.stringify(obj)); const unknownObjDeserialized: unknown = JSON.parse(JSON.stringify(obj)); // anyObjDeserialized. // no type completion because type `any` // anyObjDeserialized.foo(); // compiles but UNSAFE because we haven't narrowed the deserialized object. // (This actually throws at runtime because you can't deserialize functions like this.) // unknownObjDeserialized. // also no type completion because type `unknown` // unknownObjDeserialized.foo(); // unlike `any`, this SAFELY fails to compile let user: IUser; user = anyObjDeserialized; // compiles UNSAFELY because it's type `any` // user = unknownObjDeserialized; // SAFELY fails to compile, because it hasn't been narrowed if (isUser(obj)) { obj.foo('narrowed const obj') } if (isUser(anyObjDeserialized)) { // anyObjDeserialized. // YES code completion because of type guard anyObjDeserialized.foo('narrowed any'); } else { console.log('type guard worked! deserialized `any` isn\'t a user (because foo fn deserialized isn\'t a function'); } if (isUser(unknownObjDeserialized)) { // unknownObjDeserialized. // YES code completion because of type guard unknownObjDeserialized.foo('narrowed unknown') user = unknownObjDeserialized; // compiles because we have narrowed the unknown with the type guard } else { console.log('type guard worked! deserialized `unknown` isn\'t a user (because foo fn deserialized isn\'t a function'); }

    @ibgib@ibgib Жыл бұрын
    • Thank you dude, thats the second video I see telling to use the Unknown type and the second that doesn't provide an actual argument about why, but your comment explained me, now I have an actual reason to make this change.

      @LP...@LP...7 ай бұрын
  • Excelent video totally understood 'satisfies', utility types and 'is', saved to watch untill I memorize.

    @velkanalpha@velkanalpha Жыл бұрын
  • Look, using enums does not make you a junior dev. Enums don't make you anything. And also, yes you can directly pass a number instead of the enum, but that defeats the purpose of enums in the first place. The "junior mistake" is not using enums, but passing the enum value directly instead of using the enum. Do you see the pattern? Using enums is not bad. Using enums the wrong way is bad. I've noticed that a lot of self proclaimed typescript experts on KZhead talk badly about enums. But that just proves that you are junior devs yourselves. Don't blame a language feature, when you misuse it...

    @arjix8738@arjix8738 Жыл бұрын
    • This is a guy who creates a union type and calls it an intersection pipe, so take it with a grain of salt. Enums are bad for other reasons, though: every other feature in TS can be just stripped away because they only exist as compile-time validation. Enums, on the other hand, generate code (an object to perform the map between names and values).

      @unfilledflag@unfilledflag Жыл бұрын
    • though TypeScript still could improve enums - just passing a number shouldn't be possible. "Don't blame a language feature, when you misuse it..." sounds like C vs Rust, who blames the programmer when does make a mistake that's made easy by the language

      @climatechangedoesntbargain9140@climatechangedoesntbargain9140 Жыл бұрын
    • ts enum is actually bad compared to other languages, since it doesn't validate type the way you would expect ts or any other compiler to. You should use "object as const" instead of enum in ts because it works more like a proper enum

      @artistry7919@artistry7919 Жыл бұрын
    • Too much overhead using enum, it is not possible to generate new enum type out of a old enum type because enum is also a runtime code which is not manipulate able on type level

      @tylim88@tylim88 Жыл бұрын
    • enums should not exist in ts

      @jeffnikelson5824@jeffnikelson5824 Жыл бұрын
  • Very helpful tips, I've learned a lot. Thanks :)

    @noelfrancisco5778@noelfrancisco5778 Жыл бұрын
  • I agree that you don't want to use "any" but if you are a junior dev then you probably don't want to use "unknown" either. Chances are very high that you know what type or types are a possibility at compile time. In this case, instead of returning "unknown[]" the fetch should return "(IAdminUser | IUser)[]" or even just "IUser[]" and then check if the user is admin and cast to admin at that time.

    @joenewton251@joenewton251 Жыл бұрын
    • how about type of error in try catch. Are you use any

      @atnguyenucchi9776@atnguyenucchi97764 ай бұрын
    • aside from catching errors and writing libraries or packages, I can't think of many scenario's where unknown would be good if you wrote your code properly.

      @RmonikMusic@RmonikMusic4 ай бұрын
    • @@RmonikMusic If you're using some third party lib or web api you don't particularly trust, it can be a good idea.

      @slimbofat@slimbofat3 ай бұрын
  • Thank you for sharing those amazing tips. :)

    @codingprojects4002@codingprojects4002 Жыл бұрын
  • #4 - enums, I understand what your saying about using number enums, but if you misspell one of them and want to rename it, VScode would change it throughout your app. however for "GoodState" and using strings |string |string, if you change the string of the first one, then I don't believe VScode will update the string everywhere.

    @harag9@harag96 ай бұрын
  • 11:04 type on line 18 for enum on line 19. There is cool trick, you can auto generate type for enums. It can be for instance `type GoodStateType = keyof typeof GoodState` - GoodState is enum name

    @milan5131@milan5131 Жыл бұрын
  • I've been doing all these mistakes. Gonna fix them. Thanks alot.

    @Fernando-du5uj@Fernando-du5uj Жыл бұрын
  • `satisfies` Operator is indeed awesome. Thank you for the tips, I learned a lot!

    @lancetv4826@lancetv48262 ай бұрын
  • I didn't know the thirs one, super interesting letting typescript to infer the type. Memoizing it😊

    @oscargm1979@oscargm19794 ай бұрын
  • thanks for this video, it was very informative. i don't like the idea of the custom type guard functions, they introduce possible runtime errors since you could write the wrong logic to determine the type, so i think they should be avoided when possible.

    @mike110111@mike1101118 ай бұрын
  • thanks for this TypeScript tutorial. Love Typescript!

    @CodingElf@CodingElf Жыл бұрын
    • Thanks! Keep up with making videos. They look great!

      @CoderOne@CoderOne Жыл бұрын
  • thank you. now i know typescript can satisfy Operator

    @somebody-17546@somebody-17546 Жыл бұрын
  • superb explenation very clear thanks a lot !

    @maxhweb@maxhweb Жыл бұрын
  • Very practical tips. Thanks!

    @jackshephard7920@jackshephard7920 Жыл бұрын
  • Thanks. So much to learn 😊

    @audiodrocher@audiodrocher Жыл бұрын
  • Lots of great content on this channel. Take my money.

    @asyourlipslounge@asyourlipslounge Жыл бұрын
  • title recommendation: "typescript mistakes every junior should make at least once"

    @jonathan-._.-@jonathan-._.- Жыл бұрын
  • The "isAdminUser" method should take "IUser", not "unknown". If you are worried that you will not get an IUser from your endpoint, use something like zod.

    @kajacx@kajacx Жыл бұрын
    • Or ajv / any other type validator

      @hups6648@hups6648 Жыл бұрын
    • @@hups6648 I used ajv and moved to zod in typescript context because zod's feature to get type from schema is a game changer for me.

      @van_valdis@van_valdis Жыл бұрын
    • isAdminUser should take an union type of IUser | IAdminUser and then the type guard can get to work. Using unknown is lazy imho and its not like it will give you any advantage at runtime.

      @Friskni@Friskni Жыл бұрын
    • @@Friskni IAdminUser is a subtype of IUser, so "IUser | IAdminUser" is the same as "IUser". I guess the latter is more clear on one hand, but also less clear on the hand, because it makes it look like it is not a subtype.

      @kajacx@kajacx Жыл бұрын
    • im new to typescript; thanks god im reading examples. TBFH it feels like learning a whole new programming language rather than what was supposed to be a 'safeR way of writing javascript' I would say 'im beginner to typescript so once i learn it it would be easier for me and the team of developers' -> but comments says otherwise: They disagree with a guy who MAKES tutorials of 'mistakes in typescript' lol, so, next im thinking: if there's 2 typescript developers in a team there's already something they'd disagree upon, and imagine if there are 10 developers lol. Imagine being "careful" about writing something that should have given u peace of mind when coding in JS..., There should be a `HardScript` on top of typescript on top of js...... Lol but yeah.

      @Winter_Wyvern1@Winter_Wyvern1 Жыл бұрын
  • Awesome video, thank you!

    @igordasunddas3377@igordasunddas3377 Жыл бұрын
  • This was really excellent.

    @avneet12284@avneet12284 Жыл бұрын
  • Amasing! Thanks for sharing!

    @FSRezende@FSRezende Жыл бұрын
  • I used to make these mistakes 5 years ago. Thanks

    @wensmartsandy@wensmartsandy5 ай бұрын
  • Such a banger video ngl, thanks!

    @makl-the-oracle@makl-the-oracle Жыл бұрын
  • Great tips, thank you!

    @louielee3583@louielee3583 Жыл бұрын
  • Morning with this ❤

    @sainathpatil1858@sainathpatil1858 Жыл бұрын
  • @CoderOne what is the extension causing the function names to stick to the top when you scroll?

    @dalgeubam@dalgeubam Жыл бұрын
  • 5:00 - There is no need to actually use 'unknown' in this example, I think it would be more correct to use the following syntax: const goodUser: IUser | IUserAdmin = await response.json() Now you explicitly defined the possible types (interfaces) without being too "generic" with unknown. You can also define an "error" type/interface, let's say "IError", and use a type guard "isIError()". Then: const goodUser: IUser | IUserAdmin | IError = await response.json()

    @Niconelli12@Niconelli12 Жыл бұрын
  • The "satisfies" keyword looks really cool. I wonder if it can be used for an implicit cast. The "pass 100 into the enum function" is a thing from a horror. This is C# levels of bad. Does that still happen will all strict modes being turned on?

    @kajacx@kajacx Жыл бұрын
    • they fixed it in 5.0 beta

      @kardashevr@kardashevr Жыл бұрын
  • i loke alot all those tips, also the enum is a good one and the one i most use for strict declarations

    @Iam_AndersonP@Iam_AndersonP Жыл бұрын
  • Nice Tipps 👌 If I'm not totally wrong, you're confusing intersection (& operator) and union (| operator).

    @maltehecht1845@maltehecht1845 Жыл бұрын
    • Oh that's what I noticed but wasn't sure about !

      @AlainBoudard@AlainBoudard Жыл бұрын
  • 4:17 why not assign IUser and then use the isAdminUser to make it more specific?

    @patricsteiner8483@patricsteiner8483 Жыл бұрын
    • If you create a good validation function you can use it to detect errors. Suppose the `fetch` call might return either an user or an error message (or the API might change because APIs change).

      @unfilledflag@unfilledflag Жыл бұрын
  • Very well done 👍

    @raymondmichael4987@raymondmichael4987 Жыл бұрын
  • Appreciate the tips and the video. Some constructive criticism: Take a breath once in a while (or don't edit video so it feels like you don't) There really isn't much time for the viewer to absorb your points before you are half way into your next one ;) Otherwise good video. Plenty of self-taught mistake patterns in web-development, nice to know what to look out for :)

    @mikaelberg4304@mikaelberg4304 Жыл бұрын
  • Wow, I'm impressed. You really know your stuff and explained this in such a great way. Thank you!

    @yaakovisaacs@yaakovisaacs Жыл бұрын
  • Thank you for really useful tips !! By the way, I just wonder why you named IUser, IAdminUser types intead of just User, AdminUser?

    @seunghwanjeong5348@seunghwanjeong5348 Жыл бұрын
    • it's a common way to name your type declaration. He used Interface so he named it starting with an I, if he use Type he might use T as the starting alphabet.

      @ngamsomset@ngamsomset Жыл бұрын
    • @@ngamsomset I got it! Thank you so much😄😄😄

      @seunghwanjeong5348@seunghwanjeong5348 Жыл бұрын
    • Bad habits in my opinion. Prefixing types with "i" for interface is an antipattern in Typescript, it doesn't tell you anything useful. Types and interfaces should be interchangeable and if you have an interface and a class, they should just be give names that naturally make sense.

      @TheJohnreeves@TheJohnreeves Жыл бұрын
  • I am not a Typescript fan. I don't hate it but I definitely don't love it. Stuff like this is why. This is all very helpful but that aside from the unknown types and enums most of this doesn't pop up in other tutorials and training. Granted some are recent features but you have to be deep in the weeds of Typescript and frankly I've personally seen no significate benefits using Typescript that's made me want to take such a deep dive. I don't mind learning new things but I was doing fine without it.

    @michaelash8552@michaelash8552 Жыл бұрын
  • I'm super new to TypeScript, but I use all the tips you just mentioned. Does that make me a senior developer?

    @AhmadNasriya@AhmadNasriya3 күн бұрын
  • Nothing of this makes you a senior dev. It takes so much more

    @RealHomeboy@RealHomeboy Жыл бұрын
  • great video. would help if you talk slowly or maybe have some transition in between the tips or just maybe pause for two seconds in between. thanks for the video!

    @calvinchance5444@calvinchance5444 Жыл бұрын
  • thank you, that awesome!

    @bojack4800@bojack4800 Жыл бұрын
  • That was helpful, thanks

    @immer5680@immer5680 Жыл бұрын
  • I wish I could know these tips sooner

    @MyLe-ss5ij@MyLe-ss5ij Жыл бұрын
  • what vscode theme u use?? it look goood

    @thanathatjivapaiboonsak2180@thanathatjivapaiboonsak2180 Жыл бұрын
  • is there any difference if I change to: function isAdminUser(object: unknown): object is IAdminUser { return Boolean(object?.token); } ?

    @guilhermebabugia8562@guilhermebabugia8562 Жыл бұрын
  • Please consider to do a MERN and typescript advanced real-world project tutorial

    @regilearn2138@regilearn2138 Жыл бұрын
    • He did! Look in the channel for the longest content.

      @DIN_A8@DIN_A8 Жыл бұрын
  • Good advices ❤

    @carlosricardoziegler2650@carlosricardoziegler2650 Жыл бұрын
  • const {} as const is preferrred over using enum entirely

    @benbrown1535@benbrown15357 ай бұрын
  • thank you so much I liked the theme you're using, what is it called ?

    @ELYUSEF@ELYUSEF Жыл бұрын
    • Halcyon

      @wanderingwanderer1016@wanderingwanderer1016 Жыл бұрын
  • Enum are good even with numerical values as long as you do 2 things : - Explicitly set the numerical value - Make them "const enum" regardless of the enum being numbers or strings. The satisfies operator is horrible. You should be able to write it as const goodUser: satisfies IUser = { ... } Or at least const goodUser = { ... }

    @vukkulvar9769@vukkulvar9769 Жыл бұрын
  • Hi! Is this VS Code? What extensions are you using to make it look so good? :D

    @Ionut-lm9cj@Ionut-lm9cj Жыл бұрын
    • Yes it is. Its a theme that i wish to know the name as well

      @henriquemagno9326@henriquemagno9326 Жыл бұрын
  • Thank you so much!!

    @steiljeds@steiljeds Жыл бұрын
  • Good stuff!

    @thatWebGuySolutions@thatWebGuySolutions9 ай бұрын
  • real good one!

    @presDev@presDev Жыл бұрын
  • A better alternative to enums is using a javascript object as const.

    @AmodeusR@AmodeusR Жыл бұрын
  • What color theme on a video?

    @meowwyay@meowwyayАй бұрын
  • These are pretty subjective tbh. There are a lot of use cases where any or enums are a better choice.

    @daheck81@daheck81 Жыл бұрын
    • Where any is a better choise? I had to use it only in projects with fucked up typings (any everywhere) for solve tasks at estimated time. Enum - yeah, i agree.

      @Vishtar_Official@Vishtar_Official Жыл бұрын
    • @@Vishtar_Official With any, you're essentially opting out of TS. You're saying, I don't want to benefit from TS benefit for this variable. Usually it means you're not understanding a type error message. Better to learn what's going on and keep your code type safe.

      @alastairtheduke@alastairtheduke Жыл бұрын
    • @@alastairtheduke That's not what I mean. There are use cases where you don't want to create a hardlink to a specific module by relying on its types for example. There are quite a few of these abstractional situations

      @daheck81@daheck81 Жыл бұрын
    • Default numbered enums are a nightmare on default. For example, say You have an enums of Status {Accepted, Working, Finished} At that moment Accepted = 0 But if You assign that value like currentStatus = Status.Accepted Then the currentStatus becomes 0, wich is a falsy value and can mess up your logic if you are not paying attention. Enums should be used by default with string values, and numbers only if you really need It. You can also start your enums with 1 as the first value to avoid the falsy value problem

      @marcospenadev@marcospenadev11 ай бұрын
    • @@marcospenadevYep. And this exactly supports what enums are intended for in 90 percent of cases. Usually enums are used to uniquely identify a type of something. You don’t care it’s value. You just care about a readable unique identifier. Enums also show up differently than constants in most IDEs. There I big readability advantage to visually identify when an enum is being used. Also, enums are easier to work with in type manipulations. It’s rare to run into any issue when using enums. And the argument, “well it compiles to JavaScript blah blah blah anyway” is such a weak reason. That is like someone arguing that you may as well write code in assembly because your code is getting compiled down to it anyway. Today, we write code for humans. Computers don’t need our help reading it.

      @Logan-un6qw@Logan-un6qw9 ай бұрын
  • Thank you so muchhh

    @koocheukkeijacky9704@koocheukkeijacky9704 Жыл бұрын
  • The Omit one is great, also yeah, who could be stupid enough to think using numbered enums is good, either you name them with string or don't use them. \

    @johnddonnet5151@johnddonnet5151 Жыл бұрын
  • 11.20 why not to use Const BetterState = { Asd:”123” } as const

    @azizoid@azizoid11 ай бұрын
  • thank you🎉

    @wisdomelue@wisdomelue Жыл бұрын
  • good stuff, cute way saying 'type' tho, 🤣

    @chaseliu5011@chaseliu5011 Жыл бұрын
  • What you got there, you said you use for all of your type declarations type MyVar = { myKey: 'myVal', myKey2: 'myVal2' } const myVar: MyVar = { myKey: 'myVal', myKey2: 'myVal2' } Is making you do twice as much work when changes to myVar come. First in type then in object itself. You could nicely avoid it like this const myVar = { myKey: 'myVal', myKey2: 'myVal2' } as const type MyVar = typeof myVar It's the same thing except now you'd work as you normally would with JS objects but with read-only types Please don't bash junior developers with such video titles Happy holidays everyone!

    @novailoveyou@novailoveyou Жыл бұрын
    • Yes. Infererence over repetition and manual typing. The point of TypeScript is that you want to get the most out of types without explicitly writing them.

      @dealloc@dealloc Жыл бұрын
  • Thx a lot for the video! Which VS Code theme do you use?

    @artems5802@artems5802 Жыл бұрын
    • Ty ^^ Halcyon

      @CoderOne@CoderOne Жыл бұрын
  • Not using satisfies is barely a Junior Dev mistake. It literally got introduced in the latest release of TypeScript and thus does not yet work in any of my projects. Also obligatory comment about how every youtuber bashes enums because it's the cool things to do and ignores the existence of `const enum` which literally fixes 95% of issues related to enums.

    @Mitsunee_@Mitsunee_ Жыл бұрын
  • 1. Understand the "unknown" type in TypeScript to avoid bypassing type checks and compromising code reliability. 2. Avoid using "any" type as it disables TypeScript's type checking, leading to potential errors and decreased code quality. 3. Utilize type guards effectively to determine the type of a variable dynamically, enhancing code readability and reliability. 4. Refrain from relying solely on enums with implicit numbering, as it can lead to ambiguous code and decreased maintainability. 5. Make use of built-in utility types like "Partial" and "Omit" to enhance code clarity and avoid unnecessary complexity in TypeScript development.

    @Tempeck81@Tempeck813 ай бұрын
  • 7:31 it is rather asserting than casting

    @jewbarrymore_@jewbarrymore_ Жыл бұрын
  • What is the theme used in VSC?

    @daph7017@daph7017 Жыл бұрын
    • Halcyon

      @wanderingwanderer1016@wanderingwanderer1016 Жыл бұрын
  • thank you

    @user-ww3gp5bk4w@user-ww3gp5bk4w Жыл бұрын
  • I always forget the is keyword is a thing. My main take away from this video is I need to use the return type : T is R more.

    @Metruzanca@Metruzanca Жыл бұрын
  • Thanks

    @doniaelfouly4142@doniaelfouly4142 Жыл бұрын
  • The I prefix you use with interface is obsolete for quite a while now

    @Atif1702@Atif1702 Жыл бұрын
    • Why?

      @alastairtheduke@alastairtheduke Жыл бұрын
  • is unknown like template?

    @mrlectus@mrlectus Жыл бұрын
  • how to change intellisense icons?

    @syz66p9@syz66p9 Жыл бұрын
  • Whats the VS color theme??? Edit: it's Halcyon.

    @f3sa899@f3sa899 Жыл бұрын
  • nice content!

    @mateuszkulesza8528@mateuszkulesza8528 Жыл бұрын
  • Simply mean turn of the Typescript "type-checks" " Someone is junior English ;)

    @yaroslavpanych2067@yaroslavpanych2067 Жыл бұрын
  • if u tell p = cat why you have to check it if its a cat? are you doubting it? sorry im new at programming

    @backupmemories897@backupmemories897 Жыл бұрын
  • very satisfies

    @asepsan8977@asepsan8977 Жыл бұрын
  • Bro Your Products icons name.?

    @Vicky2000p@Vicky2000p Жыл бұрын
  • Diff between as Vs satisfies?

    @ytadi9229@ytadi9229 Жыл бұрын
  • string | ICustomImage is not types' intersection, it's an union

    @isfland@isfland5 ай бұрын
  • My recomendation not use "I" prefix to name the interfaces

    @shakapaker@shakapaker Жыл бұрын
    • use "I" prefix to distinguish between interface and class

      @crazycode2578@crazycode2578 Жыл бұрын
    • You should always give a reason lol, that's like saying "you should try to use inference over explicit typing... just cos".

      @Ctrl_Alt_Elite@Ctrl_Alt_Elite Жыл бұрын
    • @@CodeOnBlocks watch the video "How to name things in Code" then you'll have an answer

      @phill030@phill030 Жыл бұрын
    • @@Ctrl_Alt_Elite because it's a bad practice to clean code. It's more efficient to name things like "UserProps", describing the objective of that interface.

      @olucascardoso@olucascardoso Жыл бұрын
    • I use Types over interfaces because of type utilities and with types you can create something like TUserId = string while you cannot do that with interfaces And I use T as prefix

      @brucewayne2480@brucewayne2480 Жыл бұрын
  • great content

    @janosszabo9251@janosszabo9251 Жыл бұрын
  • useful!

    @hdching@hdching Жыл бұрын
  • in type script the | operator is union. type Tuser = string | number

    @davidabu3170@davidabu3170Ай бұрын
KZhead