Restrict String Types using Template Literals in TypeScript #typescript #coding #tutorial

preview_player
Показать описание
We often need our string types to be more restrictive and not just allow all kind of strings. So let's use template literals to achieve exactly that in TypeScript.
Рекомендации по теме
Комментарии
Автор

Wooow!!
I thought it was gonna be generic.

Awesome stuff

oabdulazeez
Автор

I want to make a union type of template literals now, like one for RGB, one for Hex, things like that 👀

offroaders
Автор

And now it’s time to make it 0-255 restriction by using a tuple / range and the length 👍🏼

hugodsa
Автор

So... It's a regex with longer keywords?

tomerhorowitz