mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
fix(database): wrap placeholder in sql template for prepared favorite update
Drizzle's .set() expects a column-typed value or an SQL fragment, not a
bare Placeholder. The earlier prepared-statement refactor (313230ab)
passed sql.placeholder('position') directly, which compiled clean under
ts-jest's isolated-modules mode but failed the full type check during
nx build:
TS2322: Type 'Placeholder<"position", any>' is not assignable to
type 'number | SQL<unknown> | SQLiteColumn<...>'
Wrap the placeholder in sql<number>\`...\` so it resolves to SQL<number>
at compile time. Behavior at runtime is identical — the placeholder is
still bound at execute() time per chunk.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 746d41da84ff
This commit is contained in:
1 parent
880163ca7a
commit
66cd3d5c4f
1 file changed
+3
-1
@@ -168,9 +168,11 @@ export async function reorderGlobalFavorites(
|
||||
let current = 0;
|
||||
const total = updates.length;
|
||||
|
||||
// Drizzle's .set() doesn't accept a bare Placeholder — wrap it in an
|
||||
// sql template so the value resolves to SQL<number> at compile time.
|
||||
const updateFavoritePosition = db
|
||||
.update(schema.favorites)
|
||||
.set({ position: sql.placeholder('position') })
|
||||
.set({ position: sql<number>`${sql.placeholder('position')}` })
|
||||
.where(eq(schema.favorites.contentId, sql.placeholder('contentId')))
|
||||
.prepare();
|
||||
|
||||
|
||||
Reference in new issue
Block a user