jakearchibald / idb

IndexedDB, but with promises
https://www.npmjs.com/package/idb
ISC License
6.29k stars 353 forks source link

store delete typing shows string #175

Closed aakaul closed 3 years ago

aakaul commented 4 years ago

I am using IDBPDatabase with ts

async deleteIDB(key:string){
    const tx = this._db.transaction(this.dbName,"readwrite");
    const store = tx.objectStore(this.dbName);
    store.delete(key)
    return tx.done;
}

for the above code i had to keep key as string type because store.delete has (key: string | IDBKeyRange) typing but type string doesnt delete the entry..

the method store.delete works well with type number which is not assignable to store.delete

jakearchibald commented 3 years ago

I tried to recreate this but it works fine https://codesandbox.io/s/dank-silence-m4eld?file=/src/index.ts.

Please provide a minimal reproducible example of the issue.