kysely-org / kysely

A type-safe typescript SQL query builder
https://kysely.dev
MIT License
9.81k stars 249 forks source link

The type of `eb` in `selectFrom(eb => ...)` is wrong #1039

Closed koskimas closed 3 weeks ago

koskimas commented 3 weeks ago

Reprodution https://kyse.link/HqeCE

I think eb should be ExpressionBuilder<Database, never> but instead it's ExpressionBuilder<Database, keyof Database>.

I might be brainfarting here but ExpressionBuilder<Database, keyof Database> is saying "we've joined every table in the database to this query. Go nuts!".

The reproduction fails because there are two tables with different id type "joined" to the query.