Use the high-level Z3 API (Z3Py-like)
masterThe high-level API is designed to be similar to Z3Py. Most operations require a Context. When you create a Context, TypeScript uses the provided name to narrow types, preventing you from accidentally mixing objects from different contexts at compile time.
Note: The high-level API is not thread-safe; long-running functions are queued and executed one after another.
const { init } = require('z3-solver');
const { Context } = await init();
const { Solver, Int, And } = new Context('main');
const x = Int.const('x');
const solver = new Solver();
solver.add(And(x.ge(0), x.le(9)));
console.log(await solver.check());
// sat