/** * `if` / sibling `else` runtime semantics. * * Operational semantics: * 1. Evaluate `cond` exactly once for the current `if` arm. * 2. If truthy, run the `if` children and skip every paired `else` arm. * 3. If falsy and an immediate sibling `else` exists, run that `else`. * The reference runner pairs siblings before dispatching this contract. * 4. `else > [if]` and `else > [if, else]` are just nested body sequences * in the reference semantics; TS/Python emitters are free to collapse * them to `else if` / `elif` because the chosen branch and completion * records are identical. * * Truthiness portability: * This Phase 1 contract deliberately restricts `cond` to a cross-target * primitive truthiness domain: booleans, finite numbers, strings, null, and * undefined/None. Arrays and objects are rejected because JS and Python * disagree on empty container truthiness. */ import type { IRNode } from '../../types.js'; import { type NodeContract } from './index.js'; export interface IfProps { cond?: string; __pairedElse?: IRNode; } export declare function portableTruthy(value: unknown): boolean; export declare const ifContract: NodeContract; /** Idempotent registration. Test cleanup that clears the registry must re-call. */ export declare function registerIfContract(): void; /** Reset registration flag — only for test cleanup that clears the registry. */ export declare function _resetIfContractForTest(): void;