TS query types dont match + no return types

I'm trying to query data from my db after importing the Item table from my schema. const data = await db.select().from(Item) As you can see in the screenshot and the error message below typescript seems to have trouble with that. Item table definition is being imported from another typescript project within the repo which might have to do with it?
Argument of type 'PgTableWithColumns<{ name: "item"; schema: undefined; columns: { id: PgInteger<{ tableName: "item"; name: "id"; data: number; driverParam: string | number; hasDefault: false; notNull: true; }>; type: PgInteger<...>; ... 29 more ...; eventTermId: PgText<...>; }; }>' is not assignable to parameter of type 'AnyPgTable | Subquery<string, unknown> | PgViewBase<string, boolean, ColumnsSelection> | SQL<unknown>'.
Type 'PgTable<{ name: "item"; schema: undefined; columns: { id: PgInteger<{ tableName: "item"; name: "id"; data: number; driverParam: string | number; hasDefault: false; notNull: true; }>; type: PgInteger<...>; ... 29 more ...; eventTermId: PgText<...>; }; }> & { ...; }' is missing the following properties from type 'SQL<unknown>': queryChunks, shouldInlineParams, append, toQuery, and 6 more.ts(2345)
Argument of type 'PgTableWithColumns<{ name: "item"; schema: undefined; columns: { id: PgInteger<{ tableName: "item"; name: "id"; data: number; driverParam: string | number; hasDefault: false; notNull: true; }>; type: PgInteger<...>; ... 29 more ...; eventTermId: PgText<...>; }; }>' is not assignable to parameter of type 'AnyPgTable | Subquery<string, unknown> | PgViewBase<string, boolean, ColumnsSelection> | SQL<unknown>'.
Type 'PgTable<{ name: "item"; schema: undefined; columns: { id: PgInteger<{ tableName: "item"; name: "id"; data: number; driverParam: string | number; hasDefault: false; notNull: true; }>; type: PgInteger<...>; ... 29 more ...; eventTermId: PgText<...>; }; }> & { ...; }' is missing the following properties from type 'SQL<unknown>': queryChunks, shouldInlineParams, append, toQuery, and 6 more.ts(2345)
4 Replies
Dan
Dan2y ago
Currently, you cannot use multiple instances of Drizzle in the same project Also, if it errors on the type level, it means those are two different versions with incompatible types
warflash
warflashOP2y ago
ah great call, yeah making sure all versions are the same across projects indeed got rid of the type error. Thank you 🙏 That's interesting. It does seem to work with the setup I have right now for some reason 🤔 We have 2 databases we need to connect to and as far as I can tell it works as expected. Is proper multi instance support something that is planned then? Couldn't find an open issue for it so figured I'd ask :)
warflash
warflashOP2y ago
Subscribed, appreciate it!
Want results from more Discord servers?
Add your server