Stop Wasting Time and Effort: Automate String Types with These TypeScript Tricks

  Рет қаралды 3,352

Typed Rocks

Typed Rocks

Күн бұрын

Пікірлер: 30
@eqprog
@eqprog Күн бұрын
This is the best typescript-related channel.
@Typed-Rocks
@Typed-Rocks Күн бұрын
Thank you so much 🙏. Really appreciate it. 🤘😁
@ivanbryukhov
@ivanbryukhov Күн бұрын
This is genius! Man, you're great! You always bring up something extraordinary! Keep it up!
@Typed-Rocks
@Typed-Rocks Күн бұрын
Thanks for the kind words. I will try my best 🤘
@markcampbell2491
@markcampbell2491 Күн бұрын
On a par with Matt Pocock, quality content
@Typed-Rocks
@Typed-Rocks Күн бұрын
Thank you. This is a huge honour to hear 🙏
@frstylol
@frstylol Күн бұрын
Okay, you teach me something new about typescript every single time.
@Typed-Rocks
@Typed-Rocks Күн бұрын
Thank you, really glad to hear 🙏👍
@TheSP337
@TheSP337 Күн бұрын
Amazing work! I often find myself come to your videos to do something neat and advanced. I would love to see if you have any TS tips for React components, hooks, props - anything.
@Typed-Rocks
@Typed-Rocks Күн бұрын
I‘m more of an Angular guy but I will look into it. 😁👍
@Md_sadiq_Md
@Md_sadiq_Md 2 сағат бұрын
Disclaimer: It's unlikely u get this type of example in real life is highly unlikely
@Typed-Rocks
@Typed-Rocks Сағат бұрын
It was found in the node util package type declaration file so this looks like a „real world“ example 😁. And I think types like these, which are copied, exist quite often to be honest.
@Md_sadiq_Md
@Md_sadiq_Md Сағат бұрын
@Typed-Rocks Uhh kinds agree Might look like I had seen it very few times
@Caldaron
@Caldaron Күн бұрын
swiss matt pocock ftw!
@Typed-Rocks
@Typed-Rocks Күн бұрын
Thanks 😁
@deatho0ne587
@deatho0ne587 Күн бұрын
Guessing each of colors has a CSS thing somewhere, so you would also still have to add `orange` roughly 4 times in CSS or maybe 1 time with some SCSS.
@Typed-Rocks
@Typed-Rocks Күн бұрын
This is only used once as a type for the styleText in the utils. So in there you only need it once. But of course if you need it somewhere else, you would have to derive from it.
@eqprog
@eqprog Күн бұрын
That’s what SASS (etc) is for.
@deatho0ne587
@deatho0ne587 Күн бұрын
@@eqprog Which is why I clearly mentioned SCSS.
@CyanureNeko
@CyanureNeko Күн бұрын
Is things like this that makes me love TS more and more every day, just found about it recently and used it to force the user to send limit the user input to use in some object sizes, use variables only (-- or var(--...)), while I couldn't do something as strict as this video is still such a good example
@Typed-Rocks
@Typed-Rocks Күн бұрын
Great idea👍
@dave6012
@dave6012 Күн бұрын
I was hoping you were going to do modifiers as well in a clever way, but I guess that’s an exercise left to the viewer 😄
@Typed-Rocks
@Typed-Rocks Күн бұрын
Exactly 😜.
@virtualfi
@virtualfi 4 сағат бұрын
Great video, love the channel. For discussion sake here is an argument why NOT change it and leave it in more original form. Understanding original version takes me literally 0 seconds. I see what is going on. For second version I need to stop foe some time, analyze it, "Oh... nice clever i get it now, clever!" that is real con. If you need to stop to look at simple stuff you attention is driven away from essentials. In real life scenario especially on bigger project where a team of ppl is involved I would stick to simpler version as a rule of thumb.
@gilbes1139
@gilbes1139 Күн бұрын
So the type named Bright contains no bright colors. uhh...
@Typed-Rocks
@Typed-Rocks Күн бұрын
Naming things is the hardest part in programming 😜
@ValorHeart
@ValorHeart Күн бұрын
Nice!
@Typed-Rocks
@Typed-Rocks Күн бұрын
Thanks! Really appreciate it🙏
@wvovaw3052
@wvovaw3052 18 сағат бұрын
And keep in mind that the Typescript Language Server may go brr if your template type is too complex
@Typed-Rocks
@Typed-Rocks 18 сағат бұрын
TypeScript will stop at a maximum recursive depth of 1000 so this is a safety net 😁. Of course you can make the ts server make sweat a bit, but it is really capable
Operations with Variables
7:59
Malloc
Рет қаралды 3,9 М.
TypeScript: Should you use Types or Interfaces?
4:06
Matt Pocock
Рет қаралды 163 М.
Twin Telepathy Challenge!
00:23
Stokes Twins
Рет қаралды 61 МЛН
Haunted House 😰😨 LeoNata family #shorts
00:37
LeoNata Family
Рет қаралды 15 МЛН
visually minimal neovim setup
5:13
Omu9f
Рет қаралды 1,1 М.
25 Apple Notes Hacks that Save Me 10 Hours/Week
19:27
Nick DZ
Рет қаралды 6 М.
Create Forms 500% Faster With This Shadcn Tool
6:02
Web Dev Simplified
Рет қаралды 25 М.
How I Use AI + Git to Code 3x Faster (Real Dev Workflow with Cursor)
9:44
Yifan - Beyond the Hype
Рет қаралды 1,9 М.
Learn TypeScript - Full Course for Beginners
2:06:13
freeCodeCamp.org
Рет қаралды 111 М.
Twin Telepathy Challenge!
00:23
Stokes Twins
Рет қаралды 61 МЛН