Тёмный

Senior Typescript Features You don't Know About - clean-code 

CoderOne
Подписаться 109 тыс.
Просмотров 57 тыс.
50% 1

Опубликовано:

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 44   
@ExoMemphiz
@ExoMemphiz Год назад
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.
@theLowestPointInMyLife
@theLowestPointInMyLife Год назад
So what is senior then
@Lewboskii
@Lewboskii 10 месяцев назад
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
@dinoscheidt
@dinoscheidt 9 месяцев назад
@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.
@mattpocockuk
@mattpocockuk Год назад
Nice explanations!
@CoderOne
@CoderOne Год назад
Thanks Matt! I enjoy your Typescript content
@macr76
@macr76 Год назад
Those are definitely not "senior" typescript features - those are a little bit more advanced, but still basic features (still very useful, especially discriminating unions).
@CuriousSpy
@CuriousSpy Год назад
I made kirka for those unions 😊
@ya4dang1
@ya4dang1 Год назад
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
@twothreeoneoneseventwoonefour5
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).
@linkfang9300
@linkfang9300 Год назад
I didn't know this operators and it is AWESOME! Thanks for sharing!!!
@sivuyilemagutywa5286
@sivuyilemagutywa5286 11 месяцев назад
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.
@twothreeoneoneseventwoonefour5
@twothreeoneoneseventwoonefour5 11 месяцев назад
@@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.
@eqprog
@eqprog 7 месяцев назад
{} is not a falsey value????
@twothreeoneoneseventwoonefour5
@twothreeoneoneseventwoonefour5 7 месяцев назад
@@eqprog actually {} is a truthy value apparently. 0 and "" for example are falsy. I edited my comment to fix it.
@JEsterCW
@JEsterCW Год назад
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 :)
@aertrashbin
@aertrashbin Год назад
agree
@noNullMoments
@noNullMoments 5 месяцев назад
😅 the variables called a generic captain
@nikkodelossantos6116
@nikkodelossantos6116 Год назад
Awesome tutorial!!!! Liked and Subscribed!
@iamworstgamer
@iamworstgamer 11 месяцев назад
to be honest first one looks ugly,
@lasindunuwanga5292
@lasindunuwanga5292 11 месяцев назад
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
@bhumit070
@bhumit070 Год назад
1) It won't work for deeply nested objects. and I am leaving the video.
@blaaaabla
@blaaaabla 10 месяцев назад
We have the `Readonly` utility type built-in and we don't actually need to type it's functionality manually.
@Vetal-dc8ir
@Vetal-dc8ir 11 месяцев назад
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 ‼️
@ChimbzZ
@ChimbzZ Год назад
I love your tutorials 🫶! But to be fair, the title is misleading. These aren’t “senior” features. I’d say beginner to intermediate.
@joelinman6455
@joelinman6455 Год назад
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.
@abolfazljalildoost766
@abolfazljalildoost766 8 месяцев назад
Dude awesome. loved every minute of it
@Muhammed-nani964
@Muhammed-nani964 Год назад
Long time no seen , wlc , or maybe it’s me
@kirolosmahfouz9173
@kirolosmahfouz9173 Год назад
Great video keep upload this kind of videos
@LarsRyeJeppesen
@LarsRyeJeppesen Год назад
It's a pity you're a React-only channel, otherwise great channel
@rockNbrain
@rockNbrain Год назад
NICE JOB! TKS
@rishiraj2548
@rishiraj2548 Год назад
🙏👍
@lucaslevandoski2946
@lucaslevandoski2946 Год назад
Hey man, that is really nice, why don't you do a PR to add the readonly thing to actual typescript repo instead ?
@lucaslevandoski2946
@lucaslevandoski2946 Год назад
@@carlosmagno326 nice, didn't know it, that type declaration from the video is kinda useless then
@carlosmagno326
@carlosmagno326 Год назад
@@lucaslevandoski2946 its good to know how to do it by yourself, case you want that readonly to do something else... but yeah, kinda useless
@dwikurniawan1376
@dwikurniawan1376 Год назад
amazing
@ThanHtutZaw3
@ThanHtutZaw3 Год назад
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.
@fouadchahd2969
@fouadchahd2969 Год назад
Can you please explain more or link me
@ThanHtutZaw3
@ThanHtutZaw3 Год назад
@@fouadchahd2969 drive.google.com/file/d/1dvErD6uDq3jlnLo3PgzW0Rc-Lc_vHbZp/view?usp=share_link
@tbkswagg
@tbkswagg Год назад
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
@ThanHtutZaw3
@ThanHtutZaw3 Год назад
​@@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 ?
@Tarabass
@Tarabass Год назад
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..
Далее
Everything You Need to Know About React 19
21:42
Просмотров 17 тыс.
React Server Components Change Everything
15:48
Просмотров 201 тыс.
Bearwolf - GODZILLA Пародия Beatrise
00:33
Просмотров 359 тыс.
This Is One Of My Favorite TypeScript Features
5:22
Просмотров 138 тыс.
Being Competent With Coding Is More Fun
11:13
Просмотров 84 тыс.
Generics: The most intimidating TypeScript feature
18:19
You might not need useEffect() ...
21:45
Просмотров 162 тыс.
10 React Antipatterns to Avoid - Code This, Not That!
8:55
Learn TypeScript Generics In 13 Minutes
12:52
Просмотров 267 тыс.
7 Awesome TypeScript Types You Should Know
8:57
Просмотров 84 тыс.