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

objectStoreNames's type seems wrong #101

Closed
Ptival opened this issue Apr 15, 2019 · 7 comments · Fixed by #103 or #236
Closed

objectStoreNames's type seems wrong #101

Ptival opened this issue Apr 15, 2019 · 7 comments · Fixed by #103 or #236
Assignees

Comments

@Ptival
Copy link

Ptival commented Apr 15, 2019

readonly objectStoreNames: StoreNames<DBTypes>[];

As far as I can tell, within my browser, this method returns a DOMStringList, which is not an array.

In particular, it contains a method contains, and does not contain array methods such as indexOf, which leads to both static and run-time errors.

@jakearchibald
Copy link
Owner

Good point.

Ugh, fixing this isn't totally easy, as DOMStringList doesn't support types for its content.

(fwiw, in Edge, it does return an array, as this property is polyfilled. However I don't know how much I care about this difference, as I intend to remove EdgeHTML support in the next major version)

@jakearchibald jakearchibald self-assigned this Apr 15, 2019
@NotWoods
Copy link
Contributor

NotWoods commented Apr 17, 2019

I'd be interested in submitted a PR for this if @jakearchibald hasn't worked on it yet 😄.

@jakearchibald
Copy link
Owner

Go for it!

NotWoods added a commit to NotWoods/idb that referenced this issue Apr 17, 2019
Add typed version of DOMStringList
Fixes jakearchibald#101
jakearchibald pushed a commit that referenced this issue Apr 26, 2019
* Change `objectStoreNames` to DOMStringList

Add typed version of DOMStringList
Fixes #101

* Remove duplicate property
@shadow-light
Copy link

I think there's still an issue with objectStoreNames when it is accessed off a transaction:

readonly objectStoreNames: TxStores;

It is array like, rather than DOMStringList. Just got burnt by this in a migration where I used includes instead of contains 😞

@jakearchibald jakearchibald reopened this Sep 19, 2021
@jakearchibald
Copy link
Owner

I'll fix this tomorrow

@jakearchibald
Copy link
Owner

Fix published as 6.1.4.

@shadow-light
Copy link

Woohoo pipeline fixed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants