[BUG]: PgSchema enum type changed from typeof pgEnum
to any
#4421
Labels
bug
Something isn't working
typeof pgEnum
to any
#4421
Report hasn't been filed before.
What version of
drizzle-orm
are you using?0.42.0
What version of
drizzle-kit
are you using?0.31.0
Other packages
No response
Describe the Bug
[BUG] Breaking change in v0.42.0: PgSchema enum type definition causing NestJS/TypeScript errors
Describe the Bug
Undesired Behavior
After upgrading to drizzle-orm v0.42.0, the type definition for
PgSchema.enum
has changed fromtypeof pgEnum
toany
inpg-core/schema.d.ts
. This breaks strict TypeScript type checking due to use of any.We use
drizzle-kit introspect
to generate our schema file from our existing PostgreSQL database.Steps to Reproduce for our use-case
drizzle-kit introspect
to generate schema from a database with enums:drizzle-kit introspect
again doesn't help as it still generates string arrays for enumsDesired Result
The enum type definition should maintain proper typing while supporting both TypeScript enums and string unions, rather than using
any
. This would preserve type safety while allowing the new enum functionality introduced in v0.42.0, regardless of whether the enums are manually defined or generated via introspection.Additional Information
Relevant Code
Previous type definition (pre-v0.42.0):
Current type definition (v0.42.0):
Workaround
Currently rolling back to the previous version of drizzle-orm.
The text was updated successfully, but these errors were encountered: