2min chapter

Syntax - Tasty Web Development Treats cover image

TypeScript Fundamentals × Type Narrowing, Guards, and Predicates

Syntax - Tasty Web Development Treats

CHAPTER

JavaScript Type Type Guards

The first one is a type of which you know it's a pretty standard JavaScript thing but this is often used to make sure that what you're doing in an if statement is the type of the thing that you're expecting. TypeScript narrowing the type for you and saying okay you are now in a place where you can comfortably assume that this will always be a string next one we have here is check if a property on that type exists so basically all of these type guards are going to be just regular JavaScript that you are used to checkingYeah like if someone were to tell you all right well check if this thing is has a specific property or check if this things looks like this you there's many

00:00

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode