fix(lint): type dynamic core imports in capture-critical-db-state test (#9985)

0ff0490ada (#10906) rewrote this suite keeping four module-level holders
typed as any for the dynamically imported src/lib/db/core.ts exports —
4 new unsuppressed @typescript-eslint/no-explicit-any errors that failed
the 'No new ESLint warnings' fast gate (npm run lint:json -- --max-warnings 0,
exit 1 on the pure tip; CI run 32403951361).

Replaces the any holders with a type-only CoreModule reference
(typeof import(...)), so the runtime dynamic-import timing that motivates
the pattern (DATA_DIR must be set before core.ts loads) stays untouched.
Purely typal: file lints clean and its 7 assertions still pass.
This commit is contained in:
Xiangzhe
2026-08-22 15:33:17 -03:00
parent 66f97968c4
commit 533a6c0ce4

View File

@@ -6,12 +6,13 @@ import path from "node:path";
// Shared across all tests — the module caches DATA_DIR / SQLITE_FILE at load time,
// so we must create the temp dir and import exactly once.
type CoreModule = typeof import("../../src/lib/db/core.ts");
let tempDir: string;
let originalDataDir: string | undefined;
let getDbInstance: any;
let resetDbInstance: any;
let ensureDbInitialized: any;
let closeDbInstance: any;
let getDbInstance: CoreModule["getDbInstance"];
let resetDbInstance: CoreModule["resetDbInstance"];
let ensureDbInitialized: CoreModule["ensureDbInitialized"];
let closeDbInstance: CoreModule["closeDbInstance"];
before(async () => {
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "omniroute-db-test-"));