bool
On this page

bool()

Function in Values

A bool literal node, the condition type for .select(), select() and control flow (If, While).

import { bool } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

const bool: (v: boolean) => Node<"bool">

Parameters

v boolean

Return value

Node<'bool'>

Exceptions

TypeError

v is 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'
const flag = bool(true) // Node<'bool'>

In the guide

Source

src/core/ir/node.ts, line 1068, at commit 26de7be8

Edit this page Report a problem