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 type declarations #29

Closed
wants to merge 1 commit into from
Closed

add type declarations #29

wants to merge 1 commit into from

Conversation

mcshaz
Copy link

@mcshaz mcshaz commented Mar 28, 2019

since the project is in Typescript, it should be easy to export a .d.ts file as well - this will make it much easier for others using your library with typescript.

@mcshaz
Copy link
Author

mcshaz commented Mar 28, 2019

it is failing on Travis and my machine (above), but it would not build for me before I made the changes.

@dumbmatter
Copy link
Owner

dumbmatter commented Mar 29, 2019

I imagine this would only cover the main entry point, which is not optimal because a lot of other people import things like FDBKeyRange.

Also, an alternative idea would be to simply declare these variables to have the same type as the native IndexedDB ones. I haven't tried that, but the API is identical, so it should work I guess... might be easier than fighting TypeScript to get it to output things correctly.

EDIT: I just saw your comment on #23 saying exactly this lol.

@mcshaz
Copy link
Author

mcshaz commented Mar 29, 2019

actually ignore - looking at the code it is just polyfilling the window (/global/self) object and doesnt actually export anything

@mcshaz mcshaz closed this Mar 29, 2019
@yankeeinlondon
Copy link

What happened to this thread? I am eager to use this in conjunction with my Dexie testing but simply adding:

import 'fake-indexeddb/auto';

is not getting Dexie to pick up the API:

indexedDB API not found. If using IE10+, make sure to run your code on a server URL (not locally). If using old Safari versions, make sure to include indexedDB polyfill.

Usually when this happens I then try to dig into things with the help of TypeScript. Sadly it would appear that we didn't quite get to the finish line in exporting the symbols.

@dumbmatter
Copy link
Owner

TypeScript types don't have any affect at runtime, so it's probably unrelated to your error.

@yankeeinlondon
Copy link

That is true of course but I find typed interface a very efficient way of exploring a new API or library :)

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

Successfully merging this pull request may close these issues.

3 participants