TypeScript type predicates allow you to check if an object has a specific property or set of properties so that TypeScript can narrow the type of the object. This makes code more precise and readable. Here’s the syntax:
function yourFunction(argument: unknown): argument is {
// Perform an evaluation
// If evaluation pass then
return true
}