Full Stack Radio cover image

144: Gary Bernhardt - TypeScript and Testing

Full Stack Radio

00:00

Typescript

If user has a method the group doesn't have, and your function wants to call that method, then you need to somehow tell typescript in a way that it can actually verify that, ah, this thing as a user. It's called enarowing. Your narrowg manuscript is doing that automatically, like you're never been explicitly saying. You could literally use jobscripts in operator, for example, and say, if the string name in my object, my can own things object. And then inside of that, if the the type of that variable only for that block of code will be user, it will no longer be the union. So that is one of the ways.

Play episode from 01:00:08
Transcript

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app