feat(base-formula): add type checker

This commit is contained in:
Philipinho
2026-04-23 23:52:11 +01:00
parent 216a4a99e1
commit 77897733de
5 changed files with 140 additions and 2 deletions
@@ -1,2 +1,14 @@
// Minimal stub: FormulaFn type will be expanded in Task 10.
export type FormulaFn = unknown;
// packages/base-formula/src/functions/registry.ts
import type { FormulaResultType, Value, EvalContext } from "../types";
export type FormulaFn = {
name: string;
arity: { min: number; max: number | null };
paramTypes: FormulaResultType[] | "any" | "variadic-any";
returnType: FormulaResultType | ((argTypes: FormulaResultType[]) => FormulaResultType);
eval: (args: Value[], ctx: EvalContext) => Value;
doc: string;
category: "logic" | "math" | "string" | "date" | "coercion";
};
export const registry: Map<string, FormulaFn> = new Map();