Object literal may only specify known properties and 'x' does not exist in type SQL<unknown>
Hi, I'm trying out Drizzle and I'm having issues with typescript when trying to query something. The typescript type of the model in the database is in union with SQL<unknown>, causing typescript issues. Can't really seem to find the issue. What am I doing wrong?
The
DbSchema
type is just typeof schema
Using drizzle 0.30.8
Object literal may only specify known properties, and 'courseId' does not exist in type 'SQL<unknown> | ((fields: { id: PgColumn<{ name: "id"; tableName: "lesson"; dataType: "number"; columnType: "PgSerial"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}>; name: PgColumn<...>; description: PgColumn<...>; videoUrl: PgColumn<...>; co...'.![No description](https://cdn.answeroverflow.com/1229035854417363015/image.png)
2 Replies
In the relational query builder,
where
is not an object (like Prisma). You define filters and conditions with their operator functions or their sql`` syntax.
https://orm.drizzle.team/docs/rqb#select-filtersDrizzle ORM - Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Drizzle ORM - Magic sql`` operator
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.