ai-functions
Version:
Core AI primitives for building intelligent applications
28 lines • 733 B
TypeScript
/**
* Type Guards for AI Functions
*
* Shared type guard utilities used across AI packages.
*
* @packageDocumentation
*/
import type { ZodTypeAny } from 'zod';
/**
* Check if value is a Zod schema
*
* Uses duck-typing to detect Zod schemas by checking for the
* `_def` property (internal Zod schema definition) and `parse` method.
*
* @example
* ```ts
* import { isZodSchema } from 'ai-functions'
* import { z } from 'zod'
*
* const schema = z.object({ name: z.string() })
* if (isZodSchema(schema)) {
* // TypeScript knows schema is ZodTypeAny
* schema.parse({ name: 'test' })
* }
* ```
*/
export declare function isZodSchema(value: unknown): value is ZodTypeAny;
//# sourceMappingURL=type-guards.d.ts.map