import { CompiledSchema } from "./core/types.js"; import { ZodType, output } from "zod"; //#region src/jit.d.ts interface JitOptions { /** * Compile immediately instead of on first use. Costs ~0.1-0.2 ms per schema * at import time; useful for a long-lived server that would rather pay during * startup than on the first request, or to surface a compilation failure * eagerly. Default `false`. */ eager?: boolean | undefined; /** Use compact codegen and delegate cold error production to Zod. @default "schema" */ output?: "schema" | "compact" | undefined; } /** * Compile `schema` in-process and install the compiled `parse` / `safeParse` / * `parseAsync` / `safeParseAsync` / `is` / `~standard` on it. * * Returns the SAME object — identity-preserving exactly as the build plugin is, * so `.shape`, `_zod`, `instanceof`, `z.toJSONSchema()`, `.meta()` and * composition into a larger schema all keep working, and every existing * reference to the schema picks the compiled methods up. * * ```ts * import { z } from "zod"; * import { jit } from "zod-compiler/jit"; * * export const UserSchema = jit(z.object({ name: z.string(), email: z.email() })); * UserSchema.safeParse(input); // compiled on this first call * ``` * * Schemas the compiler cannot reproduce fall back to Zod per sub-schema, the * same way they do at build time; a schema that cannot be compiled at all is * left as plain Zod. */ declare function jit(schema: T, options?: JitOptions): T & CompiledSchema>; /** * Compile every Zod schema found among an object's own values — typically a * module namespace, so a whole schema file opts in with one call: * * ```ts * import * as schemas from "./schemas.js"; * jitAll(schemas); * ``` * * The namespace object itself is never written to (a module namespace is * read-only); `jit()` mutates the schema objects it holds, which is what every * importer of that module already references. */ declare function jitAll(schemas: object, options?: JitOptions): void; //#endregion export { JitOptions, jit, jitAll }; //# sourceMappingURL=jit.d.ts.map