Open this example in the interactive library
Source code
const samples: unknown[] = [null, "Ada", 12, { id: 1 }, [2, 3], true];
console.log(
((v: unknown): v is boolean => typeof v === "boolean")(samples.at(-1)),
);
Sample output
true

Open this example in the interactive library
const samples: unknown[] = [null, "Ada", 12, { id: 1 }, [2, 3], true];
console.log(
((v: unknown): v is boolean => typeof v === "boolean")(samples.at(-1)),
);
true