import type { FormulaAstNode } from "./formulaAst.mjs"; import type { FormulaErrorValue } from "./formulaErrors.mjs"; import type { FormulaCellRef, FormulaPositionContext, FormulaResult, FormulaRowId, FormulaScalar } from "./formulaTypes.mjs"; import type { FormulaFunctionRegistry } from "./formulaFunctions.mjs"; /** * The resolver and context the grid adapter supplies for one evaluation. * * Contract: `getCellValue` is side-effect free and never re-enters the engine. * The adapter evaluates dirty cells in topological order, so a dependency's * value is already final when its dependents read it — formula dependencies * resolve from the in-pass results cache, raw dependencies from row data * (with `valueGetter` applied). */ export interface FormulaEvaluationContext { currentCell: FormulaCellRef; getCellValue: (ref: FormulaCellRef) => FormulaScalar | FormulaErrorValue | undefined; hasRow: (id: FormulaRowId) => boolean; hasField: (field: string) => boolean; position: FormulaPositionContext; functions: FormulaFunctionRegistry; } /** * Evaluates a parsed formula. Never throws: every failure mode is a * `{ type: 'error' }` result carrying one of the spreadsheet error codes. * `#CYCLE!` is never produced here — it is assigned by the graph layer. */ export declare function evaluateFormula(ast: FormulaAstNode, context: FormulaEvaluationContext): FormulaResult;