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

Incomplete externs in pouchdb #1902

Open
Jarzka opened this issue Jun 25, 2019 · 0 comments
Open

Incomplete externs in pouchdb #1902

Jarzka opened this issue Jun 25, 2019 · 0 comments

Comments

@Jarzka
Copy link

Jarzka commented Jun 25, 2019

Here is the current externs file of pouchdb:

https://github.com/cljsjs/packages/blob/master/pouchdb/resources/cljsjs/pouchdb/common/pouchdb.ext.js

I believe this file is incomplete as it seems to lack _id and _rev fields.

For example, if I call get to fetch a document:
(.get pouchdb id get-options)
I get a result object with _id and _rev properties. If I try to read these values directly:
(.-_id result)
(.-_rev result)
I get the correct result in dev build, but undefined in production build with advanced compilation.

However, I'm not sure if we should either update the externs file, or simply convert the result object into Clojure map in application code every time we use get, as it seems that reading any field value from the result object results undefined in advanced compilation. This problem can be avoided altogether by doing the conversion first. On the other hand, I can read id and rev directly in advanced compilation without problem, and _id and _rev are part of pouchdb's default fields, so they should probably be included in the externs file

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

No branches or pull requests

1 participant