Type Alias: StringifyFn()
ts
type StringifyFn = (doc) => string;Defined in: packages/core/src/core/serialization/JsonSerializer.ts:49
A pre-compiled stringify function.
Generated at boot or on first use from a Zod schema. Accepts any object and returns a JSON string (minified).
Parameters
| Parameter | Type |
|---|---|
doc | unknown |
Returns
string
Example
typescript
const stringify = serializer.compile(myZodSchema);
const json = stringify({ id: 1, name: 'Alice' });
// '{"id":1,"name":"Alice"}'