tsc command fails when using sqlite

Hey, just started using the library, and I'm having issues running the tsc command. Here's the output (shortened a lot though):
node_modules/drizzle-orm/mysql-core/db.d.ts:1:38 - error TS2307: Cannot find module 'mysql2/promise' or its corresponding type declarations.

1 import type { ResultSetHeader } from 'mysql2/promise';
~~~~~~~~~~~~~~~~
node_modules/drizzle-orm/mysql-core/db.d.ts:1:38 - error TS2307: Cannot find module 'mysql2/promise' or its corresponding type declarations.

1 import type { ResultSetHeader } from 'mysql2/promise';
~~~~~~~~~~~~~~~~
Even though I'm only using sqlite, it seems that typescript is checking for all of the codebase, including mysql and pg types, which break since I don't have the packages installed.
5 Replies
Angelelz
Angelelz15mo ago
If you're using sqlite, you gotta be careful and import either from "drizzle-orm" or "drizzle-orm/sqlite-core"
hahn
hahnOP15mo ago
I'm already doing that. I'm importing from these places: drizzle-orm/better-sqlite3 dirzzle-orm better-sqlite3 drizzle-orm/sqlite-core If I print more of the callstack, I also get pg errors, e.g.:
node_modules/drizzle-orm/query-builders/query-builder.d.ts:9:14
9 abstract getSQL(): SQL;
~~~~~~
Non-abstract class 'MySqlSelect<TTableName, TSelection, TSelectMode, TPreparedQueryHKT, TNullabilityMap>' does not implement inherited abstract member 'getSQL' from class 'MySqlSelectQueryBuilder<MySqlSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap>'.

node_modules/drizzle-orm/pg-core/query-builders/delete.d.ts:17:22 - error TS2420: Class 'PgDelete<TTable, TQueryResult, TReturning>' incorrectly implements interface 'SQLWrapper'.
Property 'getSQL' is missing in type 'PgDelete<TTable, TQueryResult, TReturning>' but required in type 'SQLWrapper'.

node_modules/drizzle-orm/sqlite-core/columns/blob.d.ts:1:23 - error TS1452: 'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`.

1 /// <reference types="node" resolution-mode="require"/>
~~~~

node_modules/drizzle-orm/sqlite-core/columns/blob.d.ts:2:23 - error TS2688: Cannot find type definition file for 'bun-types'.

2 /// <reference types="bun-types" />
node_modules/drizzle-orm/query-builders/query-builder.d.ts:9:14
9 abstract getSQL(): SQL;
~~~~~~
Non-abstract class 'MySqlSelect<TTableName, TSelection, TSelectMode, TPreparedQueryHKT, TNullabilityMap>' does not implement inherited abstract member 'getSQL' from class 'MySqlSelectQueryBuilder<MySqlSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap>'.

node_modules/drizzle-orm/pg-core/query-builders/delete.d.ts:17:22 - error TS2420: Class 'PgDelete<TTable, TQueryResult, TReturning>' incorrectly implements interface 'SQLWrapper'.
Property 'getSQL' is missing in type 'PgDelete<TTable, TQueryResult, TReturning>' but required in type 'SQLWrapper'.

node_modules/drizzle-orm/sqlite-core/columns/blob.d.ts:1:23 - error TS1452: 'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`.

1 /// <reference types="node" resolution-mode="require"/>
~~~~

node_modules/drizzle-orm/sqlite-core/columns/blob.d.ts:2:23 - error TS2688: Cannot find type definition file for 'bun-types'.

2 /// <reference types="bun-types" />
Angelelz
Angelelz15mo ago
Can you check if you have "skipLibCheck": true in your tsconfig? if not, set it And try again
hahn
hahnOP15mo ago
yeah, setting skipLibCheck makes the compilation work. thanks! is this required for drizzle to work? or just a workaround?
Angelelz
Angelelz15mo ago
A little bit of both You don't want to check the types of all your libraries
Want results from more Discord servers?
Add your server