Checks if the given value is a boolean.

Type signature

(x?: unknown) => x is boolean

Examples

boolean(false); // ⇒ true
Try in REPL
boolean(1); // ⇒ false
Try in REPL

Questions

  • How to check if a given value is a boolean?

TypeScript sourceJavaScript source