fix: replace as any casts in AST walkers with typed guards + add options to PredicateCall

logic-ast.ts: add optional options?: Record<string, unknown> to
  PredicateCall interface. Previously any predicate needing options
  (e.g., space, dimension, tolerance) smuggled them via (node as any)
  .options, bypassing the type system entirely.

extraction.ts: replace all 18 (node as any).body/.left/.right etc.
  casts with proper type guard narrowing (isForAllFormula, isExistsFormula,
  isAndFormula, isOrFormula, isNotFormula, isImpliesFormula, isPredicateCall).
  Affected functions: collectPredicates, formulaNeedsCssLengthMetrics,
  usesLayoutSpace, computeRequiredFacts & nestDomAncestry, getSelectorsFromFormula.

595 SDK + 57 E2E tests pass.
This commit is contained in:
John Dvorak
2026-05-22 12:18:22 -07:00
parent 07ed316135
commit aa69ddc52f
2 changed files with 54 additions and 45 deletions
+1
View File
@@ -81,6 +81,7 @@ export interface PredicateCall extends AstNode {
kind: 'predicate'
predicate: string
args: TermNode[]
options?: Record<string, unknown>
}
// ---------------------------------------------------------------------------