Skip to content

Commit d0b4b8d

Browse files
committed
fix: restore typed db in watcher.ts instead of widening to any
Replace db: any with proper BetterSqlite3.Database type annotation. Use typedDb alias for functions expecting the project's BetterSqlite3Database interface, avoiding untyped code paths.
1 parent 4a63243 commit d0b4b8d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/domain/graph/watcher.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export async function watchProject(rootDir: string, opts: { engine?: string } =
2424
throw new DbError('No graph.db found. Run `codegraph build` first.', { file: dbPath });
2525
}
2626

27-
// openDb comes from untyped JS — leave as `any` since consumers expect different DB types
28-
// biome-ignore lint/suspicious/noExplicitAny: openDb is untyped JS
29-
const db: any = openDb(dbPath);
27+
const db = openDb(dbPath) as import('better-sqlite3').Database;
28+
// Alias for functions expecting the project's BetterSqlite3Database interface
29+
const typedDb = db as unknown as import('../../types.js').BetterSqlite3Database;
3030
initSchema(db);
3131
const engineOpts = { engine: (opts.engine || 'auto') as import('../../types.js').EngineMode };
3232
const { name: engineName, version: engineVersion } = getActiveEngine(engineOpts);
@@ -47,7 +47,7 @@ export async function watchProject(rootDir: string, opts: { engine?: string } =
4747
),
4848
getNodeId: {
4949
get: (name: string, kind: string, file: string, line: number) => {
50-
const id = getNodeIdQuery(db, name, kind, file, line);
50+
const id = getNodeIdQuery(typedDb, name, kind, file, line);
5151
return id != null ? { id } : undefined;
5252
},
5353
},

0 commit comments

Comments
 (0)