TypeScript Syntax and Type Operators
is — user-defined type predicate
A predicate signature relates a boolean return to a parameter or this type. A true branch narrows to the declared type; a false branch can exclude it from the known union. The checker does not prove that the implementation accurately expresses both outcomes. A misleading predicate can make accepted code fail at runtime. Use a guard that genuinely distinguishes the promised cases. Example output: "READY". Tested in the strict TypeScript 5.8.3 / ES2022 baseline; the example is not a runtime type validator.
Formal Syntax & Structure
typescript syntaxtypescript
function isText(value: unknown): value is string { return typeof value === "string"; }Working Example
Example Snippettypescript
function isText(value: unknown): value is string { return typeof value === "string";}function describe(value: unknown) { return isText(value) ? value.toUpperCase() : "other";}console.log(describe("ready"));