D1 false type-safety using TypeScript
As explained here: https://developers.cloudflare.com/d1/build-with-d1/d1-client-api/#typescript-support
but trying this out it's giving false type-safety.
Imagine this type definition:
(note the camel case property names, and there is no
breed
field)
and the following query:
(note the underscore case as it is stored like that in the database)
Now the result is:
All properties (date_of_birth
, date_of_death
, chip_number
, breed
) in the query that do not match the type definition are still included in the result.
It gives some false type-safety.Cloudflare Docs
Query D1 · Cloudflare D1 docs
D1 client API allows you to interact with a D1 database from within a Worker.
1 Reply
maybe check out drizzle and/or drizzle-zod?