(side: MathJSON, types: Record<string, string>)
| 163 | } |
| 164 | |
| 165 | const boxSide = (side: MathJSON, types: Record<string, string>): string => { |
| 166 | ce.pushScope(); |
| 167 | try { |
| 168 | for (const w of collectWildcards(side)) { |
| 169 | try { |
| 170 | ce.declare(w, types[w] ?? 'complex'); |
| 171 | } catch { |
| 172 | /* tolerate */ |
| 173 | } |
| 174 | } |
| 175 | const b = ce.box(side as never); |
| 176 | expect(b.isValid).toBe(true); |
| 177 | return JSON.stringify(b.json); |
| 178 | } finally { |
| 179 | ce.popScope(); |
| 180 | } |
| 181 | }; |
| 182 | |
| 183 | /** Join two canonical sides, renaming wildcards jointly by order of |
| 184 | * first appearance — so `f(_a,_b) → g(_b)` and `f(_x,_y) → g(_y)` get |
no test coverage detected