Complete worked example
typescript
type Title = { title: string };
function isTitle(value: unknown): value is Title {
return typeof value === "object" && value !== null
&& "title" in value && typeof value.title === "string";
}
function title(value: unknown): string { return isTitle(value) ? value.title : "Missing"; }- Reasoning
- The checks establish object presence and the precise field type before returning true.