Complete API documentation for @neabyte/typebox.
- Define - Build contracts and stateful contract builders.
- Loader - Activate a contract map into a live callable facade.
- State - Reducer-style stateful contracts with deep-immutable reads.
- Validation - Guards, verdicts, and fail-closed rejection.
- Types - Compile-time shapes exported for advanced usage.
| Name | Purpose | Form |
|---|---|---|
Define |
Build a contract | Define(contract, guard?) |
Define.state |
Build a stateful contract | Define.state(initialState, stepFn) |
Loader |
Activate a contract map | Loader(contractMap) |
StateHandle |
Live stateful entry | handle(payload?) / handle.get() |
type ContractFn = (input: never) => unknownEvery face of Typebox is the same atom in a different role:
| Face | Form | Description |
|---|---|---|
| Operation | Define((props) => result) |
A plain contract |
| Data | Define(() => value) |
A contract with no meaningful input |
| State | Define.state(initial, (state, payload) => next) |
A contract whose output becomes the next input |
| Validation | Define(fn, guard) |
A contract with a guard |
| Async | Define(async (props) => value) |
A contract returning a promise |