fix(soft-delete): make softDelete() callable with a typed db client - #104
Merged
PAMulligan merged 1 commit intoJun 7, 2026
Merged
Conversation
8 tasks
softDelete()'s `db` parameter was typed `PgDatabase<PgQueryResultHKT>`, which pins the schema generics to their `Record<string, never>` defaults. Because that schema generic is invariant, passing a real, schema-typed Drizzle client (e.g. `PostgresJsDatabase<typeof schema>`) fails to compile with TS2379 — so the documented `await softDelete(db, table, id)` pattern could not actually be used in a generated project. Widen the signature to infer the query-result and schema generics, which accepts any concrete Drizzle client while staying fully backward compatible (broadening a constraint never breaks existing callers). Add templates/snippets/node/src/routes/users.ts: a typechecked Hono route that exercises softDelete(), softDeleteFilter(), and includeDeletedQuerySchema against the real db client, so the typecheck suite now covers an actual soft-delete invocation and this regression cannot return unnoticed. Refs #53 (soft-delete feature landed in #103). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
PAMulligan
force-pushed
the
53-add-soft-delete-middleware-and-drizzle-query-filters
branch
from
June 7, 2026 02:03
c070dac to
8b807ae
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
softDelete()(added in #103) typed itsdbparameter asPgDatabase<PgQueryResultHKT>, which pins the schema generics to theirRecord<string, never>defaults. That schema generic is invariant, so passing a real schema-typed Drizzle client (e.g.PostgresJsDatabase<typeof schema>) fails to compile with TS2379. The documentedawait softDelete(db, table, id)pattern therefore couldn't actually be used in a generated project.This PR:
softDelete()'s generics to infer the query-result and schema types, so it accepts any concrete Drizzle client. Backward-compatible — broadening a constraint never breaks existing callers.templates/snippets/node/src/routes/users.ts— a typechecked Hono route that actually invokessoftDelete(),softDeleteFilter(), andincludeDeletedQuerySchemaagainst the realdb. The typecheck suite now exercises a live soft-delete call, so this regression can't silently return.Context
The soft-delete feature for issue #53 (schema column, query filters,
softDelete,?include_deleted, skill docs, tests) already landed in #103. This PR was originally opened in parallel as a duplicate; it has been rescoped down to the one genuine gap that work left behind — the helper wasn't callable with a typed client, and nothing in the typecheck suite invoked it.Refs #53. Complements #103.
🤖 Generated with Claude Code