Skip to content

Conversation

@IFAKA
Copy link

@IFAKA IFAKA commented Dec 16, 2025

Summary

Small DX improvements that expose existing internals for user convenience:

  • Export CONSTANTS: Users can access integer bounds (INT8_MIN, INT32_MAX, etc.) for custom validation logic without hardcoding values
  • Add ZodInstance type: Provides proper typing for the zodInstance option instead of any

Motivation

Currently, users who want to add custom integer validation need to hardcode bounds or import them from elsewhere. Since drizzle-zod already defines these constants internally, exposing them improves DX.

The zodInstance option accepts any, which loses type safety. Adding a proper type alias improves the developer experience.

Changes

  • src/index.ts: Add export { CONSTANTS } from './constants.ts'
  • src/schema.types.ts: Add ZodInstance type and update zodInstance option type

Test plan

  • All 70 existing tests pass
  • No breaking changes - purely additive exports
  • Types verified with pnpm test:types

- Export CONSTANTS from index.ts for user access to integer bounds
- Add ZodInstance type alias for typeof z
- Update zodInstance option to use the new type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant