index.ts:93:30 - error TS2769: No overload matches this call.
Overload 1 of 2, '(storeNames: "ZoteroSerialized" | "ZoteroSerializedTouched" | "ExportCacheContext" | "BetterBibLaTeX" | "BetterBibTeX" | "BetterCSLJSON" | "BetterCSLYAML" | "metadata", mode?: "readwrite" | undefined, options?: IDBTransactionOptions | undefined): IDBPTransaction<...>', gave the following error.
Argument of type 'string' is not assignable to parameter of type '"ZoteroSerialized" | "ZoteroSerializedTouched" | "ExportCacheContext" | "BetterBibLaTeX" | "BetterBibTeX" | "BetterCSLJSON" | "BetterCSLYAML" | "metadata"'.
Overload 2 of 2, '(storeNames: ArrayLike<"ZoteroSerialized" | "ZoteroSerializedTouched" | "ExportCacheContext" | "BetterBibLaTeX" | "BetterBibTeX" | "BetterCSLJSON" | "BetterCSLYAML" | "metadata">, mode?: "readwrite" | undefined, options?: IDBTransactionOptions | undefined): IDBPTransaction<...>', gave the following error.
Argument of type 'string' is not assignable to parameter of type 'ArrayLike<"ZoteroSerialized" | "ZoteroSerializedTouched" | "ExportCacheContext" | "BetterBibLaTeX" | "BetterBibTeX" | "BetterCSLJSON" | "BetterCSLYAML" | "metadata">'.
93 const tx = $db.transaction(name, 'readwrite')
~~~~
index.ts:94:32 - error TS2345: Argument of type 'string' is not assignable to parameter of type '"ZoteroSerialized" | "ZoteroSerializedTouched" | "ExportCacheContext" | "BetterBibLaTeX" | "BetterBibTeX" | "BetterCSLJSON" | "BetterCSLYAML" | "metadata"'.
94 const store = tx.objectStore(name)
~~~~
index.ts:95:29 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
95 const index = store.index('itemID')
if I replace name with the constant 'BetterBibTeX' the error goes away
with the code below, I get
if I replace
name
with the constant'BetterBibTeX'
the error goes awaycode -- click to show
``` import { openDB, IDBPDatabase, DBSchema } from 'idb' export type ExportContext = { context: string id: number } export type ExportCacheContent = { context: number itemID: number entry: string } type Serialized = { itemID: number title: string } interface Schema extends DBSchema { ZoteroSerialized: { value: Serialized key: number } ZoteroSerializedTouched: { value: boolean key: number } ExportCacheContext: { value: ExportContext key: number indexes: { context: string } } BetterBibLaTeX: { value: ExportCacheContent key: [number, number] indexes: { context: number, itemID: number, 'context-itemID': [ number, number ] } } BetterBibTeX: { value: ExportCacheContent key: [number, number] indexes: { context: number, itemID: number, 'context-itemID': [ number, number ] } } BetterCSLJSON: { value: ExportCacheContent key: [number, number] indexes: { context: number, itemID: number, 'context-itemID': [ number, number ] } } BetterCSLYAML: { value: ExportCacheContent key: [number, number] indexes: { context: number, itemID: number, 'context-itemID': [ number, number ] } } metadata: { value: { key: string, value: string | number } key: string } } async function main() { const $db = await openDB