Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IDBFactory.databases() method to lib.DOM #36706

Closed
4 of 5 tasks
nathanblair opened this issue Feb 9, 2020 · 6 comments
Closed
4 of 5 tasks

Add IDBFactory.databases() method to lib.DOM #36706

nathanblair opened this issue Feb 9, 2020 · 6 comments
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Milestone

Comments

@nathanblair
Copy link

Search Terms

idbfactory databases

Suggestion

interface IDBFactory {

Should be adjusted to include the databases() method specified in:

Use Cases

Getting a list of all IndexedDB databases controlled by a window

Examples

console.log(`Removing obselete databases...`)
const databases = await indexedDB.databases()
for (const eachDatabase in databases) {
  if (eachDatabase.name !== DB_NAME) indexedDB.deleteDatabase(eachDatabase.name)
}

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.
@thomaschampagne
Copy link

Indeed it's missing. I had to do this as temporary workaround

declare global {
    interface IDBFactory {
        databases: () => Promise<{ name: string, version: number }[]>;
    }
}

@RyanCavanaugh RyanCavanaugh added Help Wanted You can do this Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Apr 20, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Apr 20, 2020
@nathanblair
Copy link
Author

It appears there was an issue opened related to this already, #37317. If you feel it is appropriate, @RyanCavanaugh , feel free to close it and defer to that issue.

It looks like a PR was made by @fritzschoff, but they made changes to some generated files and the PR ended up closed without merge.

I've got the changes done myself to the lib/dom file (not the generated one), but it seems this:

a) would need coordinated with the TS-Generated repo? To get the generated declaration files updated from the lib/dom file changes made in my local
b) is being held up potentially for reasons related to how early-adoption it is. I can confirm it works in FF v75, at least. And definitely Chrome/Chromium.

I'll throw up my PR nonetheless and if no one likes it yet, feel free to cut it down :D

@fritzschoff
Copy link

I guess Firefox is the bottleneck here

@nathanblair
Copy link
Author

It looks like my PR got auto-closed for a similar reason as yours, @fritzschoff. Even though I didn't even touch the /src/lib/.generated files?

So, 🤷 I'm over it.

@t3chguy
Copy link

t3chguy commented Apr 26, 2023

This got added in 9ebe11c

image

@jakebailey
Copy link
Member

As noted above, this was fixed in #44684.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants