TypeScript Errors in drizzle-orm Package During Build with pnpm

I am encountering several TypeScript errors when trying to build my project using pnpm. The errors seem to be related to the drizzle-orm package. Here is the relevant part of the output:


> [email protected] dev /Users/dxphilo/Desktop/kikao/kikao-back
> pnpm run build && pnpm run concurrently "pnpm run build -w" "pnpm nodemon"


> [email protected] build /Users/dxphilo/Desktop/kikao/kikao-back
> pnpm tsc

node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/drizzle-orm/mysql-core/query-builders/delete.d.ts:36:22 - error TS2420: Class 'MySqlDeleteBase<TTable, TQueryResult, TPreparedQueryHKT, TDynamic, TExcludedMethods>' incorrectly implements interface 'SQLWrapper'.
  Property 'getSQL' is missing in type 'MySqlDeleteBase<TTable, TQueryResult, TPreparedQueryHKT, TDynamic, TExcludedMethods>' but required in type 'SQLWrapper'.

36 export declare class MySqlDeleteBase<TTable extends MySqlTable, TQueryResult extends MySqlQueryResultHKT, TPreparedQueryHKT extends PreparedQueryHKTBase, TDynamic extends boolean = false, TExcludedMethods extends string = never> extends QueryPromise<MySqlQueryResultKind<TQueryResult, never>> implements SQLWrapper {
                        ~~~~~~~~~~~~~~~

  node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/drizzle-orm/sql/sql.d.ts:50:5
    50     getSQL(): SQL;
           ~~~~~~~~~~~~~~
    'getSQL' is declared here.
...

I have the following setup:

  • Node.js version: v20.x
  • TypeScript version: 4.x
  • drizzle-orm version: 0.38.2
  • pnpm version: 6.x
    Here is a snippet of my package.json:
{
  "name": "kikao-back",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "pnpm run build && pnpm run concurrently "pnpm run build -w" "pnpm nodemon"",
    "build": "pnpm tsc"
  },
  "dependencies": {
    "aws-sdk": "2.1692.0",
    "body-parser": "1.20.3",
    "cloudinary": "2.5.1",
    "compression": "1.7.5",
    "cookie-session": "2.1.0",
    "cors": "2.8.5",
    "dotenv": "16.4.7",
    "drizzle-orm": "0.38.2",
    "express": "4.21.2",
    "express-rate-limit": "7.5.0",
    "express-session": "1.18.1",
    "express-validator": "7.2.0",
    "jsonwebtoken": "9.0.2",
    "multer": "1.4.5-lts.1",
    "mysql2": "3.11.5",
    "nodemon": "3.1.9",
    "openai": "4.77.0",
    "passport": "0.7.0",
    "passport-google-oidc": "0.1.0",
    "pg": "8.13.1",
    "postgres": "3.4.5",
    "superstruct": "2.0.2",
    "zod": "3.24.1"
  },
  "devDependencies": {
    "@types/bcryptjs": "2.4.6",
    "@types/body-parser": "1.19.5",
    "@types/compression": "1.7.5",
    "@types/cookie-session": "2.0.49",
    "@types/cors": "2.8.17",
    "@types/express": "5.0.0",
    "@types/express-session": "1.18.1",
    "@types/jsonwebtoken": "9.0.7",
    "@types/multer": "1.4.12",
    "@types/passport": "1.0.17",
    "@types/pg": "8.11.10",
    "@typescript-eslint/eslint-plugin": "8.18.1",
    "@typescript-eslint/parser": "8.18.1",
    "concurrently": "^7.6.0",
    "drizzle-kit": "0.30.1",
    "eslint": "9.17.0",
    "eslint-config-prettier": "9.1.0",
    "eslint-plugin-prettier": "5.2.1",
    "prettier": "3.4.2",
    "tsx": "4.19.2"
  }
}

The errors seem to imply missing or incorrectly implemented interfaces in drizzle-orm. I have tried updating and downgrading the package, but the issue persists.

What could be causing these TypeScript errors, and how can I resolve them?

Additional Context:

  • I am using PostgreSQL as my database.
  • The project builds fine without drizzle-orm.

Any help or guidance on how to fix these errors would be greatly appreciated!