jakearchibald / idb

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

[Help] How to get list of database exist in app #216

Closed pranavwani closed 3 years ago

pranavwani commented 3 years ago
jakearchibald commented 3 years ago

Why do you need to do it via idb?

jakearchibald commented 3 years ago

Closing this, since it isn't a bug in the library, but I'll continue to provide support.

pranavwani commented 3 years ago

@jakearchibald In typescript throwing error on using raw API

Property 'databases' does not exist on type 'IDBFactory'.

70     const databases = await indexedDB.databases();
                                         ~~~~~~~~~
pranavwani commented 3 years ago

Why do you need to do it via idb?

Moving data from one database to another database if the old database exist

jakearchibald commented 3 years ago

TypeScript is wrong. https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/databases

However, Firefox doesn't support that method.

pranavwani commented 3 years ago

Exactly.

Currently building the app in electron.

pranavwani commented 3 years ago

I think I've to create a bug in the typescript repository

pranavwani commented 2 years ago

@jakearchibald in the latest version of the TypeScript added the definitions and fixed the issue by declaring global type in .d.ts

declare global {
    interface IDBFactory {
        databases: () => Promise<IDBDatabaseInfo[]>
    }
}
jakearchibald commented 2 years ago

Nice!