Effect CommunityEC
Effect Community6mo ago
3 replies
Lloyd

TypeScript Error with Arrays in `sql.insert` and `sql.update` for PostgreSQL

I think I found a type bug in the sql.insert and sql.update in relation to using arrays in Postgre. I've found that when a schema contains a prop that is an array, then the sql.insert throws a TypeScript error that Type 'readonly string[]' is not assignable to type 'Primitive | Fragment | undefined'. However, running the code results in both compilation and correct validation from the Schema. Check out the repo for the recreation and a more detailed explanation.

I understand that arrays aren't supported in SQLite, so perhaps there is a reason for excluding them from the Primitive types. However, it seems odd to have to force an incorrect type on the database to make TypeScript happy.

Minimal Repo
Screenshot_2025-07-22_at_09.25.03.png
Was this page helpful?