drizzle-team / drizzle-team/drizzle-orm
[BUG]: qb.leftJoin results in `Type null is not assignable to type ...'
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [x] I have verified that the bug I'm about to report hasn't been filed before.
### What version of `drizzle-orm` are you using?
0.39.0
### What version of `drizzle-kit` are you using?
0.30.0
### Other packages
_No response_
### Describe the Bug
When I left join a table that is conditionally selected I get the following error.
```
Type 'import("/Users/stickb/Code/dos/dos-monorepo/node_modules/.pnpm/drizzle-orm@0.39.0_@types+react@18.3.12_postgres@3.4.5_react@18.3.1/node_modules/drizzle-orm/pg-core/query-builders/select").PgSelectBase<"trip", { vehicle?: { id: import("/Users/stickb/Code/dos/dos-monorepo/node_modules/.pnpm/drizzle-orm@0.39.0_@types+r...' is not assignable to type 'import("/Users/stickb/Code/dos/dos-monorepo/node_modules/.pnpm/drizzle-orm@0.39.0_@types+react@18.3.12_postgres@3.4.5_react@18.3.1/node_modules/drizzle-orm/pg-core/query-builders/select").PgSelectBase<"trip", { vehicle?: { id: import("/Users/stickb/Code/dos/dos-monorepo/node_modules/.pnpm/drizzle-orm@0.39.0_@types+r...'. Two different types with this name exist, but they are unrelated.
The types returned by 'prepare(...)' are incompatible between these types.
Type 'import("/Users/stickb/Code/dos/dos-monorepo/node_modules/.pnpm/drizzle-orm@0.39.0_@types+react@18.3.12_postgres@3.4.5_react@18.3.1/node_modules/drizzle-orm/pg-core/query-builders/select.types").PgSelectPrepare
Contributor guide
Assessment
This issue has not been assessed yet.