Error when using Drizzle (Non-abstract class 'PgSelect<TTableName, TSelection, TSelectMode, [...])
I'm getting the following error when I try to use Drizzle:
> [email protected] start
> npm run compile && node ./dist/index.js
> [email protected] compile
> tsc
node_modules/drizzle-orm/db.d-2eb7c122.d.ts:521: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>'.
521 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-2eb7c122.d.ts:655: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'.
655 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-c31e7ad3.d.ts:257:5
257 getSQL(): SQL;
~~~~~~~~~~~~~~
'getSQL' is declared here.
Found 2 errors in the same file, starting at: node_modules/drizzle-orm/db.d-2eb7c122.d.ts:521
> [email protected] start
> npm run compile && node ./dist/index.js
> [email protected] compile
> tsc
node_modules/drizzle-orm/db.d-2eb7c122.d.ts:521: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>'.
521 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-2eb7c122.d.ts:655: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'.
655 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-c31e7ad3.d.ts:257:5
257 getSQL(): SQL;
~~~~~~~~~~~~~~
'getSQL' is declared here.
Found 2 errors in the same file, starting at: node_modules/drizzle-orm/db.d-2eb7c122.d.ts:521
2 Replies
Here's my
And my
Not sure what I'm doing wrong here.
I suppressed the error by adding:
package.json
:
{
[... removed]
"main": "index.js",
"type": "module",
"scripts": {
"compile": "tsc",
"start": "npm run compile && node ./dist/index.js"
},
"dependencies": {
"@apollo/server": "^4.7.1",
"drizzle-orm": "^0.26.1",
"graphql": "^16.6.0",
"postgres": "^3.3.4"
},
"devDependencies": {
"@types/node": "^20.2.5",
"drizzle-kit": "^0.18.1",
"typescript": "^5.0.4"
}
}
{
[... removed]
"main": "index.js",
"type": "module",
"scripts": {
"compile": "tsc",
"start": "npm run compile && node ./dist/index.js"
},
"dependencies": {
"@apollo/server": "^4.7.1",
"drizzle-orm": "^0.26.1",
"graphql": "^16.6.0",
"postgres": "^3.3.4"
},
"devDependencies": {
"@types/node": "^20.2.5",
"drizzle-kit": "^0.18.1",
"typescript": "^5.0.4"
}
}
tsconfig.json
:
{
"compilerOptions": {
"rootDirs": ["src"],
"outDir": "dist",
"lib": ["es2020"],
"target": "es2020",
"module": "esnext",
"moduleResolution": "node",
"esModuleInterop": true,
"types": ["node"]
}
}
{
"compilerOptions": {
"rootDirs": ["src"],
"outDir": "dist",
"lib": ["es2020"],
"target": "es2020",
"module": "esnext",
"moduleResolution": "node",
"esModuleInterop": true,
"types": ["node"]
}
}
"skipLibCheck": true
to my tsconfig.json
That's it