UNPKG

@lifeart/gxt

Version:

<img align="right" width="95" height="95" alt="Philosopher’s stone, logo of PostCSS" src="./public/logo.png">

29 lines (27 loc) • 1.17 kB
import { AnyCell } from '../reactive'; /** * Check if a value is a Cell/Tag (reactive value). */ export declare function isTag(arg: unknown): arg is AnyCell; /** * Check if a value is a compiler-generated getter function. * The compiler wraps reactive values in arrow functions: `() => this.value` * Arrow functions have no `.prototype` property, while regular functions do. * * Note: This heuristic also matches async functions and bound functions, * but in compat mode (the default), these come through getters and are * handled correctly. */ export declare function isGetter(value: unknown): value is () => unknown; /** * Unwrap a value - if it's a getter function, call it to get the actual value. * If it's a Tag (reactive cell), get its .value property. * * IMPORTANT: Only unwraps arrow functions (no prototype) to avoid calling * user callbacks or functions returned by helpers like `fn`. * The compiler generates getters as arrow functions: () => this.value * * Used by reactive helpers ($__if, $__eq, $__and, $__or, $__not) that need * to compare VALUES, not Cell references. */ export declare function unwrap(value: unknown): unknown;