Nothing really senior about this, tbh. Was thinking maybe you'd go through recursive types, but "readonly" as a built-in utility type, together with the other types, type branding and type guarding are definitely not senior-level stuff.
I think it's more of Senior level best practices rather than senior level features, since anyways as a typescript senior you are not going to be doing recursive types, decorators or weird typescript shit everyday
@OP what you mention is rather „principal“ level stuff. If you need the features that you mentioned you either have a very very very messy and poorly structured codebase or build something so advanced, it almost needs meta programming capabilities.
Not a typescript feature, but a javascript one, but I found that surprisingly not many people know about/use "??" and "??=" operators. They are very useful for dealing with default values when something can be undefined(you run into this situation frequently). People tend to use || and explicit =, but it isn't really recommended. || is going to trigger any falsy value, so even if it is 0 or "", it will short circuit to the right value, when ?? is only for undefined and null - which is exactly what you would want in 99% of cases. I knew about this feature from a long time ago, but it actually made most sense when I wrote some dart(flutter) code. There, the || and && operators are used only for actual boolean values and there is no concept of "truthy and falsy values", so you need to use ?? operator there, which made perfect sense to me. Since then, I no longer use || and && for dealing with undefined values. Except in some jsx where I still use && though(but that is different).
for me for objects, and strings I use ||, because {}, "", undefined, and null I treat the same, but for numbers, I use ??, because of 0, I learned about || and ?? the hard way.
@@sivuyilemagutywa5286 then you have crap data or code in the first place. You should never have a {} or "" in your external data. You also should never create a {} or "" in your own code. It is always either null, [](empty array), rarerly undefined, or, actual usable data.
Really cool video, I am going to rewatch minimum once for push all this information to my brain 🧠 branch 😅 Right now I am watching your another video with same theme - cool job ‼️
Those are definitely not "senior" typescript features - those are a little bit more advanced, but still basic features (still very useful, especially discriminating unions).
I would say those are intermediate stuff. Maybe customizing tsconfig for various project is a bit more challenging. And also let's not forget decorators
When I saw the senior thing in the title I knew it is gonna be junior thing Senior or junior don’t reinvent the wheel Just google what you want to do, there is probably some way to do your 10 lines code in one line unless you are doing some rare thing no one has done before For typescript, there is something called utility types. Check them. They are pretty handy
in your 'Advanced Types' section at the beginning. Are the props converted from string types into read-only types? as that is what it suggested when you hovered over 'props.title'. or do they stay as strings that extend the read-only type. I'm wondering if there are any issues that could be come across by setting a strings type to readonly other than trying to edit the string itself.
Just a tips for beginners . when passing props with typescript , I use vs code tools that can fix infer types automatically . After passing props , I don't destructure it and I only write export default function App(props) . So I can click the props and ctrl + . vs code can fix type issue . Not exactly but I like to use it because I don't have to write prop types manually. Then we can adjust type what we want.
Dude youre talking about adding any everywhere if you dont have correct typing anyways if yes then if will add the shape instead of the type itself. So it is useful if you dont have a sperate named type for your object
@@tbkswagg Yes It is only shortcut way for adding type structure . not the real type . I prefer this way because you only have to edit any type with actual types. You don't think it is fast way to type ?
I'm sorry, but the first example only showcase how you don't realize that you don't really need that generic at all, lol....no offense buddy, but it sounds funny cause it's totally clickbait thing at this point, since its bad, not senior-like. Maybe senior over there where youre worknig at is at this level, but definitely not worldwide, but from what i have seen you never ever worked at any serious company and you only do freelance stufff, so ye lol. Really good video tho, kinda WebDevCody vibes :)
Saying that the switch statement is part of a senior solution is very strange in mine opinion. Switch statements are code smell and should be avoided if possible..
Nice explanations!
Thanks Matt! I enjoy your Typescript content
Nothing really senior about this, tbh. Was thinking maybe you'd go through recursive types, but "readonly" as a built-in utility type, together with the other types, type branding and type guarding are definitely not senior-level stuff.
So what is senior then
I think it's more of Senior level best practices rather than senior level features, since anyways as a typescript senior you are not going to be doing recursive types, decorators or weird typescript shit everyday
@OP what you mention is rather „principal“ level stuff. If you need the features that you mentioned you either have a very very very messy and poorly structured codebase or build something so advanced, it almost needs meta programming capabilities.
Not a typescript feature, but a javascript one, but I found that surprisingly not many people know about/use "??" and "??=" operators. They are very useful for dealing with default values when something can be undefined(you run into this situation frequently). People tend to use || and explicit =, but it isn't really recommended. || is going to trigger any falsy value, so even if it is 0 or "", it will short circuit to the right value, when ?? is only for undefined and null - which is exactly what you would want in 99% of cases.
I knew about this feature from a long time ago, but it actually made most sense when I wrote some dart(flutter) code. There, the || and && operators are used only for actual boolean values and there is no concept of "truthy and falsy values", so you need to use ?? operator there, which made perfect sense to me. Since then, I no longer use || and && for dealing with undefined values. Except in some jsx where I still use && though(but that is different).
I didn't know this operators and it is AWESOME! Thanks for sharing!!!
for me for objects, and strings I use ||, because {}, "", undefined, and null I treat the same, but for numbers, I use ??, because of 0, I learned about || and ?? the hard way.
@@sivuyilemagutywa5286 then you have crap data or code in the first place. You should never have a {} or "" in your external data. You also should never create a {} or "" in your own code. It is always either null, [](empty array), rarerly undefined, or, actual usable data.
{} is not a falsey value????
@@eqprog actually {} is a truthy value apparently. 0 and "" for example are falsy. I edited my comment to fix it.
Dude awesome. loved every minute of it
Really cool video, I am going to rewatch minimum once for push all this information to my brain 🧠 branch 😅 Right now I am watching your another video with same theme - cool job ‼️
Awesome tutorial!!!! Liked and Subscribed!
Those are definitely not "senior" typescript features - those are a little bit more advanced, but still basic features (still very useful, especially discriminating unions).
I made kirka for those unions 😊
I would say those are intermediate stuff. Maybe customizing tsconfig for various project is a bit more challenging. And also let's not forget decorators
Great video keep upload this kind of videos
When I saw the senior thing in the title I knew it is gonna be junior thing
Senior or junior don’t reinvent the wheel
Just google what you want to do, there is probably some way to do your 10 lines code in one line unless you are doing some rare thing no one has done before
For typescript, there is something called utility types. Check them. They are pretty handy
NICE JOB! TKS
in your 'Advanced Types' section at the beginning. Are the props converted from string types into read-only types? as that is what it suggested when you hovered over 'props.title'.
or do they stay as strings that extend the read-only type. I'm wondering if there are any issues that could be come across by setting a strings type to readonly other than trying to edit the string itself.
Just a tips for beginners . when passing props with typescript , I use vs code tools that can fix infer types automatically .
After passing props , I don't destructure it and I only write export default function App(props) . So I can click the props and ctrl + . vs code can fix type issue .
Not exactly but I like to use it because I don't have to write prop types manually. Then we can adjust type what we want.
Can you please explain more or link me
@@fouadchahd2969 drive.google.com/file/d/1dvErD6uDq3jlnLo3PgzW0Rc-Lc_vHbZp/view?usp=share_link
Dude youre talking about adding any everywhere if you dont have correct typing anyways if yes then if will add the shape instead of the type itself. So it is useful if you dont have a sperate named type for your object
@@tbkswagg Yes It is only shortcut way for adding type structure . not the real type . I prefer this way because you only have to edit any type with actual types. You don't think it is fast way to type ?
Long time no seen , wlc , or maybe it’s me
Hey man, that is really nice, why don't you do a PR to add the readonly thing to actual typescript repo instead ?
@@carlosmagno326 nice, didn't know it, that type declaration from the video is kinda useless then
@@lucaslevandoski2946 its good to know how to do it by yourself, case you want that readonly to do something else... but yeah, kinda useless
amazing
I love your tutorials 🫶! But to be fair, the title is misleading. These aren’t “senior” features. I’d say beginner to intermediate.
It's a pity you're a React-only channel, otherwise great channel
😅 the variables called a generic captain
🙏👍
I'm sorry, but the first example only showcase how you don't realize that you don't really need that generic at all, lol....no offense buddy, but it sounds funny cause it's totally clickbait thing at this point, since its bad, not senior-like. Maybe senior over there where youre worknig at is at this level, but definitely not worldwide, but from what i have seen you never ever worked at any serious company and you only do freelance stufff, so ye lol.
Really good video tho, kinda WebDevCody vibes :)
agree
1) It won't work for deeply nested objects. and I am leaving the video.
Saying that the switch statement is part of a senior solution is very strange in mine opinion. Switch statements are code smell and should be avoided if possible..
to be honest first one looks ugly,