AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
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