import { openDB, type DBSchema, type IDBPDatabase } from "idb"; import type { CompiledGuideType } from "./schemas"; export interface MyDB extends DBSchema { guides: { key: string; value: CompiledGuideType; }; } export type AppDB = IDBPDatabase; export function initDB(): Promise { return openDB("my-guides", 1, { upgrade(db) { db.createObjectStore("guides", { keyPath: "id" }); }, }); }