DRY up your TS code with keyof

preview_player
Показать описание
Become a TypeScript Wizard with my free beginners TypeScript Course:

Follow Matt on Twitter

Join the Discord:

Комментарии
Автор

This is on the verge of being ASMR - and I think that's great!

chaosflaws
Автор

Yup, this format is a win.
Please continue teaching ts.

wennwenn
Автор

for some specific usecases (like when dealing with generics such as T extends string) you may need to use Extract<keyof FormValues, string> to remove the implicit number and symbol key values that keyof may pick up, since these do (obviously) not extend string and will cause a confusing type error.

Mitsunee_
Автор

Always great, straight to the point videos on TS. Love your stuff.

TJKlimoski
Автор

Very nice format and so clear. Thank you for this short!

flibben
Автор

how do you make an assertion from the formvalues keys?

of example i have column from my sql and check if it exist in any from the keys?

rogerpantil
Автор

I'd love to have similar valueof keyword. Yeah, i know we can easily construct it with generic wrapper, but i want it to be supported internally the same way as keyof

TheSome
Автор

@mattpocockuk How did you create this presentation? Manual editing or did you use a specific tool?

gabrielbianchi
Автор

Wouldn't it be further improved, by simply iterating FormValues keys and their values and on each iteration add "initialValue" and "label"?

Anyhow, like the style of this kind of shorts 👏.

albannurkollari
Автор

From what version of typescript this was introduced ?

tntg
Автор

what software did you use to make these?

emmanuelchucks
Автор

I learnt TypeScript from the Type Challenges.

MirrorsEdgeGamer
Автор

What’s the difference between using keyof and keyof typeof ?

markokafor
Автор

Like every npm and docusaurus2 banner: "we stand with keyof" 😂

DannyEck
Автор

Nice man, thats gonna save plenty of time ^-^

alangraton
Автор

How have I been using keyof for all this time, yet had no idea about Record

JohnBuildWebsites
Автор

FormValues type using a plural form! 🤫

ChrisKobrzak