resolveBool
Reads a boolean attribute that may be a condition, such as hidden: t > 3, at the current parameter values, or returns fallback.
@internote/canvas-sdkOn this page
import { resolveBool } from '@internote/canvas-sdk';A bool attribute reads its whole text as a condition (D57), so a boolean may arrive as a bound $chalk-expression rather than true or false — whenever it follows a slider's letter or a node's live member. Testing attrs.hidden === true misses every such value; this decides it with the compiler's own rules. fallback is returned for a value that is neither, and for a condition while the runtime has not loaded.
#Signature
(
value: unknown,
params?: Record<string, number>,
fallback?: boolean,
refs?: (ref: ExpressionRef) => unknown,
): boolean#Parameters
valueA refined attribute value.
paramsThe parameter values, such as
ctx.parameters.numbers().fallbackWhat to return when the value does not come out as a boolean.
refsThe live value of a
#id.member the condition reads, where the caller has a store.#Example
if (resolveBool(attrs.hidden, ctx.parameters.numbers())) return null;Declared in packages/canvas-sdk/src/data/values.ts:116.