bool()
Function in Values
A bool literal node, the condition type for .select(), select() and control flow (If, While).
import { bool } from 'typeshade/core/ir'
This export returns an IR node. A "use typeshade" file calls the builtin itself: bool()
The signature, the description and the examples come from the compiler's own source at commit af54ddad5.
Syntax
const bool: (v: boolean) => Node<"bool">Parameters
vboolean
Return value
Node<'bool'>
Exceptions
TypeErrorvis not a JS boolean.
Description
Only a JS boolean is accepted, so a stray bool(someNode) fails at the
call site instead of coercing to true.
Examples
Example
import { bool } from 'typeshade/core/ir'
const flag = bool(true) // Node<'bool'>In the guide
See also
Source
src/core/ir/node.ts, line 879, at commit af54ddad5