API Reference: Forger
The public entry point of the library.
import { Forger } from '@artstesh/forger';
Forger.create
static create<T>(
settings?: SpoofSettings,
circularDepth?: number,
...args: ForgerElement[] // technical — injected by the transformer
): T | undefined
Creates a fully populated fake of T.
Parameter | Type | Default | Description |
|---|---|---|---|
|
|
| Generation tuning — see SpoofSettings |
|
|
| Allowed nesting depth for circular types — see Circular references |
|
| — | Technical; never pass manually |
Returns the forged value, or undefined when the transformer did not run (see Caveats).
Forger.createWith
static createWith<T>(
settings?: SpoofSettings,
circularDepth?: number,
...args: ForgerElement[] // technical — injected by the transformer
): CreateWithModel<T>
Creates a fake of T wrapped in a builder that allows pinning properties:
const order = Forger.createWith<Order>()
.with(o => o.status = 'paid')
.result();
Parameters are identical to create. The returned CreateWithModel exposes with() and result().
Default export
import Forger from '@artstesh/forger';
The class is available as both a named and a default export.
08 September 2026