fix drizzle-orm tsc overload errors blocking npm run check #10

Open
opened 2026-09-16 19:22:48 +00:00 by Mark · 0 comments
Owner

Symptom

After Forgejo Actions reaches the npm run check step for the first time (post-#8 peer-dep fix), the build fails with ~30 TS2349 errors across server/storage.ts and shared/schema.ts:

server/storage.ts(141,42): error TS2349: This expression is not callable.
  Each member of the union type '(<TFrom extends SQLiteTable | ...>...) | (<TFrom extends PgTable | ...>...)'
  has signatures, but none of those signatures are compatible with each other.

shared/schema.ts(22,3): error TS2769: No overload matches this call.
  Object literal may only specify known properties, and 'id' does not exist in type '(columnTypes: { blob: { ... } ...

Diagnosis

shared/schema.ts declares BOTH pgTable and sqliteTable variants of every table. server/db.ts types db as the union of node-postgres and better-sqlite3 adapters. TypeScript 5.6.3 with drizzle-orm@^0.39.3 cannot reconcile the two signatures for any query builder call.

Fix

Branch fix/9-drizzle-overload (commit 8c0dc80) drops the Postgres branch entirely:

  • shared/schema.ts: keep only sqliteTable variants; rename *Sqlite duplicates away.
  • server/db.ts: SQLite-only path; honour DATABASE_URL only when it doesn't look like a postgres URL.
  • script/migrate.ts, drizzle.config.ts, server/test/setup.ts: follow the SQLite-only change.
  • server/storage.ts: ISO-string dates for text columns; default optional email to ''.
  • server/routes.ts: import the missing Relationship/Action types; coerce req.params.id via String().
  • server/index.ts: reshape the logger.error(...) call to fit its (string, string?) signature.

Verification

  • npm run check exits 0 (was 30+ errors).
  • npm run build succeeds (vite + esbuild).
  • npx vitest run: 10/10 tests pass.

Resolves the blocker on #7 ("CI always fails").

## Symptom After Forgejo Actions reaches the `npm run check` step for the first time (post-#8 peer-dep fix), the build fails with ~30 TS2349 errors across `server/storage.ts` and `shared/schema.ts`: ``` server/storage.ts(141,42): error TS2349: This expression is not callable. Each member of the union type '(<TFrom extends SQLiteTable | ...>...) | (<TFrom extends PgTable | ...>...)' has signatures, but none of those signatures are compatible with each other. shared/schema.ts(22,3): error TS2769: No overload matches this call. Object literal may only specify known properties, and 'id' does not exist in type '(columnTypes: { blob: { ... } ... ``` ## Diagnosis `shared/schema.ts` declares BOTH `pgTable` and `sqliteTable` variants of every table. `server/db.ts` types `db` as the union of node-postgres and better-sqlite3 adapters. TypeScript 5.6.3 with `drizzle-orm@^0.39.3` cannot reconcile the two signatures for any query builder call. ## Fix Branch `fix/9-drizzle-overload` (commit `8c0dc80`) drops the Postgres branch entirely: - `shared/schema.ts`: keep only `sqliteTable` variants; rename `*Sqlite` duplicates away. - `server/db.ts`: SQLite-only path; honour `DATABASE_URL` only when it doesn't look like a postgres URL. - `script/migrate.ts`, `drizzle.config.ts`, `server/test/setup.ts`: follow the SQLite-only change. - `server/storage.ts`: ISO-string dates for `text` columns; default optional `email` to `''`. - `server/routes.ts`: import the missing `Relationship`/`Action` types; coerce `req.params.id` via `String()`. - `server/index.ts`: reshape the `logger.error(...)` call to fit its `(string, string?)` signature. ## Verification - `npm run check` exits 0 (was 30+ errors). - `npm run build` succeeds (vite + esbuild). - `npx vitest run`: 10/10 tests pass. Resolves the blocker on #7 ("CI always fails").
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AuWoMe/Drift#10
No description provided.