Build fails because of drizzle typescript files

Created a node drizzle backend with typescript. When i run TSC for my build to compile Any idea whats up? Im on the latest versions i get these errors
Errors Files
2 node_modules/drizzle-orm/db.d-b9835153.d.ts:593
1 node_modules/drizzle-orm/node-postgres/index.d.ts:4
2 node_modules/drizzle-orm/pg-core/index.d.ts:336
Errors Files
2 node_modules/drizzle-orm/db.d-b9835153.d.ts:593
1 node_modules/drizzle-orm/node-postgres/index.d.ts:4
2 node_modules/drizzle-orm/pg-core/index.d.ts:336
node_modules/drizzle-orm/db.d-b9835153.d.ts:593:15 - error TS2515: Non-abstract class 'PgSelect<TTableName, TSelection, TSelectMode, TNullabilityMap>' does not implement inherited abstract member 'getSQL' from class 'PgSelectQueryBuilder<PgSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap>'.

593 declare class PgSelect<TTableName extends string | undefined, TSelection, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'> : {}> extends PgSelectQueryBuilder<PgSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap> {
~~~~~~~~

node_modules/drizzle-orm/db.d-b9835153.d.ts:733:15 - 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'.

733 declare class PgDelete<TTable extends AnyPgTable, TQueryResult extends QueryResultHKT, TReturning extends Record<string, unknown> | undefined = undefined> extends QueryPromise<TReturning extends undefined ? QueryResultKind<TQueryResult, never> : TReturning[]> implements SQLWrapper {
~~~~~~~~

node_modules/drizzle-orm/column.d-aa4e525d.d.ts:275:5
275 getSQL(): SQL;
~~~~~~~~~~~~~~
'getSQL' is declared here.

node_modules/drizzle-orm/node-postgres/index.d.ts:4:8 - error TS1192: Module '"/Users/artemaleksandruk/Development/ess/xavier-institute/enstigate-forge/node_modules/@types/pg/index"' has no default export.

4 import pg, { PoolClient, Client, QueryResult, QueryResultRow } from 'pg';
~~

node_modules/drizzle-orm/pg-core/index.d.ts:336:43 - error TS2344: Type 'Omit<T, "hasDefault"> & { hasDefault: true; } extends infer T_1 ? { [K in keyof T_1]: (Omit<T, "hasDefault"> & { hasDefault: true; })[K]; } : never' does not satisfy the constraint 'ColumnBuilderBaseConfig'.
Type '{}' is missing the following properties from type 'ColumnBuilderBaseConfig': name, data, driverParam, notNull, hasDefault

336 defaultNow(): ColumnBuilderKind<THKT, Omit<T, "hasDefault"> & {
~~~~~~~~~~~~~~~~~~~~~~~~~
337 hasDefault: true;
~~~~~~~~~~~~~~~~~~~~~~~~~
...
339 hasDefault: true;
~~~~~~~~~~~~~~~~~~~~~~~~~
340 })[K]; } : never>;
~~~~~~~~~~~~~~~~~~~~

node_modules/drizzle-orm/pg-core/index.d.ts:338:47 - error TS2536: Type 'K' cannot be used to index type 'Omit<T, "hasDefault"> & { hasDefault: true; }'.

338 } extends infer T_1 ? { [K in keyof T_1]: (Omit<T, "hasDefault"> & {
~~~~~~~~~~~~~~~~~~~~~~~~~~
339 hasDefault: true;
~~~~~~~~~~~~~~~~~~~~~~~~~
340 })[K]; } : never>;
node_modules/drizzle-orm/db.d-b9835153.d.ts:593:15 - error TS2515: Non-abstract class 'PgSelect<TTableName, TSelection, TSelectMode, TNullabilityMap>' does not implement inherited abstract member 'getSQL' from class 'PgSelectQueryBuilder<PgSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap>'.

593 declare class PgSelect<TTableName extends string | undefined, TSelection, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'> : {}> extends PgSelectQueryBuilder<PgSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap> {
~~~~~~~~

node_modules/drizzle-orm/db.d-b9835153.d.ts:733:15 - 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'.

733 declare class PgDelete<TTable extends AnyPgTable, TQueryResult extends QueryResultHKT, TReturning extends Record<string, unknown> | undefined = undefined> extends QueryPromise<TReturning extends undefined ? QueryResultKind<TQueryResult, never> : TReturning[]> implements SQLWrapper {
~~~~~~~~

node_modules/drizzle-orm/column.d-aa4e525d.d.ts:275:5
275 getSQL(): SQL;
~~~~~~~~~~~~~~
'getSQL' is declared here.

node_modules/drizzle-orm/node-postgres/index.d.ts:4:8 - error TS1192: Module '"/Users/artemaleksandruk/Development/ess/xavier-institute/enstigate-forge/node_modules/@types/pg/index"' has no default export.

4 import pg, { PoolClient, Client, QueryResult, QueryResultRow } from 'pg';
~~

node_modules/drizzle-orm/pg-core/index.d.ts:336:43 - error TS2344: Type 'Omit<T, "hasDefault"> & { hasDefault: true; } extends infer T_1 ? { [K in keyof T_1]: (Omit<T, "hasDefault"> & { hasDefault: true; })[K]; } : never' does not satisfy the constraint 'ColumnBuilderBaseConfig'.
Type '{}' is missing the following properties from type 'ColumnBuilderBaseConfig': name, data, driverParam, notNull, hasDefault

336 defaultNow(): ColumnBuilderKind<THKT, Omit<T, "hasDefault"> & {
~~~~~~~~~~~~~~~~~~~~~~~~~
337 hasDefault: true;
~~~~~~~~~~~~~~~~~~~~~~~~~
...
339 hasDefault: true;
~~~~~~~~~~~~~~~~~~~~~~~~~
340 })[K]; } : never>;
~~~~~~~~~~~~~~~~~~~~

node_modules/drizzle-orm/pg-core/index.d.ts:338:47 - error TS2536: Type 'K' cannot be used to index type 'Omit<T, "hasDefault"> & { hasDefault: true; }'.

338 } extends infer T_1 ? { [K in keyof T_1]: (Omit<T, "hasDefault"> & {
~~~~~~~~~~~~~~~~~~~~~~~~~~
339 hasDefault: true;
~~~~~~~~~~~~~~~~~~~~~~~~~
340 })[K]; } : never>;
5 Replies
mr_pablo
mr_pablo2y ago
use "skipLibCheck": true, in your tsconfig
pandareaper
pandareaper2y ago
I've also been facing this issue, "skipLibCheck": true works around the issue. Is there a bug here that needs to be fixed though? It's not a great workaround
mr_pablo
mr_pablo2y ago
AFAIK its not a "workaround" but just how TS works? Or do you mean the fact that without skipLibChecks set to true, it fails to compile?
pandareaper
pandareaper2y ago
I'd consider it a workaround given it's the first time I have ever had to configure that in a typescript project, it's a smell of a deeper problem
pandareaper
pandareaper2y ago
Reading this in the docs makes me uneasy about it https://www.typescriptlang.org/tsconfig#skipLibCheck
This can save time during compilation at the expense of type-system accuracy.
This can save time during compilation at the expense of type-system accuracy.
TSConfig Reference - Docs on every TSConfig option
From allowJs to useDefineForClassFields the TSConfig reference includes information about all of the active compiler flags setting up a TypeScript project.
Want results from more Discord servers?
Add your server