This WILL CHANGE How You Work With Strings - Advanced TypeScript Magic!

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

Typed Rocks

Typed Rocks

Күн бұрын

Пікірлер: 37
@punithg1572
@punithg1572 Күн бұрын
This channel is just super fun! I’m super curious on how you come with these ideas though.
@Typed-Rocks
@Typed-Rocks 19 сағат бұрын
Thank you 😁, I like to fiddle around with the more unusual parts of languages so as soon as you start to do that, the ideas will come naturally 🤘
@KamelJabber1
@KamelJabber1 15 сағат бұрын
Fantastic content and we'll presented!
@Typed-Rocks
@Typed-Rocks 14 сағат бұрын
Thank you 😁
@MrAlao675
@MrAlao675 3 күн бұрын
you solve typescript types as if you don't know anything else... well done man.
@Typed-Rocks
@Typed-Rocks 3 күн бұрын
Everyone needs a hobby 😝
@LePhenixGD
@LePhenixGD 3 күн бұрын
You never fail to amaze us ! This is wonderful !!!
@Typed-Rocks
@Typed-Rocks 3 күн бұрын
Thank you so much for your kind words. Glad it is helpful ☺️🤘
@danko95bgd
@danko95bgd 3 күн бұрын
Wow typescript is so cool and powerful. Maybe it can tell me if func could throw an error, oh wait.
@Typed-Rocks
@Typed-Rocks 2 күн бұрын
While I see your point, many languages think checked exceptions were a mistake. Often they just get thrown further.
@gerkim62
@gerkim62 2 күн бұрын
This is the biggest issue in typescript by far
@pierwszywolnynick
@pierwszywolnynick Күн бұрын
every function can throw an error, a stack overflow or out of memory, checked exceptions are just irritating
@BeeBeeEight
@BeeBeeEight 3 күн бұрын
Amazing work there. I remember u covered how to make sure rgb values has exactly 3 numbers with template literals. Now I feel like trying with this method to make sure those numbers are within range (0-255).
@Typed-Rocks
@Typed-Rocks 3 күн бұрын
You could but it could make your types quite recursively deep and not that well readable. So always keep that in mind 🤘👍
@precisionchoker
@precisionchoker 3 күн бұрын
Wow this is awesome Subscribed
@Typed-Rocks
@Typed-Rocks 3 күн бұрын
Awesome, thank you!
@balaclava351
@balaclava351 2 күн бұрын
Can you explain how to limit a number to range. Currently if I want to restrict a number to be `
@djs-vids
@djs-vids Күн бұрын
hihi! How do you view the result of the type as a comment like that (3:04)? You were using a different IDE before but not it's finally VSCode I think. Great content btw!
@Typed-Rocks
@Typed-Rocks Күн бұрын
Thank you 🤘. It‘s called „twoslash-queries“ for vscode and „witt“ for Jetbrains.
@dave6012
@dave6012 3 күн бұрын
I opening a PR with this type first thing monday morning
@Typed-Rocks
@Typed-Rocks 3 күн бұрын
Keep me updated if they liked it 🤘😁
@moneyfr
@moneyfr 3 күн бұрын
you should work with valibot
@Typed-Rocks
@Typed-Rocks 3 күн бұрын
I will look into it. Looks interesting 👍🤘
@snatvb
@snatvb 3 күн бұрын
it would be great to have possibility to add own error messages :)
@Typed-Rocks
@Typed-Rocks 2 күн бұрын
We could make it so that instead of never, it returns an object type with an error property in
@snatvb
@snatvb 2 күн бұрын
@@Typed-Rocks but it's not an really error. I mean improvement TS compiler :) but it's just kinda my "ny wish" :D
@ИльяСтрелец-ц4к
@ИльяСтрелец-ц4к 3 күн бұрын
Think it's better to take string's "length" property directly, as it is readonly despite arrays length property which can be set directly by programmer
@Typed-Rocks
@Typed-Rocks 2 күн бұрын
In types you can‘t use the length property of the string as it‘s just „string“. That‘s why you need to do that trick.
@kettenbach
@kettenbach 8 сағат бұрын
@@Typed-Rocksthis gives compile time support also. String.length is runtime
@pierwszywolnynick
@pierwszywolnynick Күн бұрын
very cool but as always - please don't actually use it, especially for comparing large numbers; you will kill the compiler and IDE performance quickly
@AbhiShake-pl3cf
@AbhiShake-pl3cf 2 күн бұрын
Counter doesnt need to be an array. It should just be a readonly number
@Typed-Rocks
@Typed-Rocks 2 күн бұрын
It cant, as we need to update the counter every recursive iteration. Otherwise we would need to create an array and increment it and put it back into a number each time.
@AbhiShake-pl3cf
@AbhiShake-pl3cf 2 күн бұрын
Ah yes i just tried and i cant just increment numeric type. Sorry for saying that without confirming it. You are awesome
@Typed-Rocks
@Typed-Rocks 2 күн бұрын
@ no worries. Thanks for your comment 😁
@jfftck
@jfftck 6 сағат бұрын
Isn’t this getting outside the domain of types? I don’t understand why you would really want or need this, it is a lot of computation on something that should be a concrete type definition. This is bad practice for typing and I wouldn’t use this code in my code base, it’s also pointed out that runtime checks are necessary for any values that are not consistent.
@kuyugama
@kuyugama Күн бұрын
There are no real usage for this
Rolldown is here, can it save Vite?
20:08
Theo - t3․gg
Рет қаралды 51 М.
Generics: The most intimidating TypeScript feature
18:19
Matt Pocock
Рет қаралды 187 М.
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
The weird history of "serverless"
1:14:50
Theo - t3․gg
Рет қаралды 49 М.
The Biggest Mistake Intermediate React Developers Make
18:32
Cosden Solutions
Рет қаралды 20 М.
A cool way to do reflection in javascript
8:15
mcsamr
Рет қаралды 4,4 М.
Easily create overlapping sections on a website
11:20
Kevin Powell
Рет қаралды 28 М.
Dependency Injection | Prime Reacts
28:34
ThePrimeTime
Рет қаралды 363 М.
Object Validation and Invariants End at This Point
9:57
Zoran Horvat
Рет қаралды 4 М.
The Honey Scam: Explained
10:53
Marques Brownlee
Рет қаралды 4,7 МЛН
7 Awesome TypeScript Types You Should Know
8:57
Josh tried coding
Рет қаралды 90 М.
Let's Fix The Fatal Flaw in TypeScript's Union Types!
13:45
Typed Rocks
Рет қаралды 23 М.
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН