Skip to content

Conversation

@ebiyy
Copy link

@ebiyy ebiyy commented Dec 29, 2025

Closes #4705

Problem

The type-level condition TColumn['_']['data'] extends Buffer can produce false positives in environments where the Buffer type is declared differently (e.g. Cloudflare Workers), causing non-buffer columns to be inferred as Buffer.

Solution

Switch the check to TColumn['_']['dataType'] extends 'buffer' to match the runtime logic that treats dataType === 'buffer' as a Buffer column.

Testing

  • All existing tests pass (70 tests)
  • Type tests pass

Acknowledgments

Thanks to @stefnba for testing and confirming this fix works in a Hono + React (Vite) setup:
#4705 (comment)


Note: The beta branch addresses this with a different approach (TType['constraint']). This PR keeps the 0.8.x line aligned with the runtime behavior.

Change type-level condition from 'TColumn["_"]["data"] extends Buffer'
to 'TColumn["_"]["dataType"] extends "buffer"' to align with runtime
implementation and prevent incorrect type inference in certain environments.

Fixes drizzle-team#4705
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.

[BUG]: drizzle-zod schema methods incorrectly set the field types to Buffer instead of correct types

1 participant