Skip to content

Incomplete externs in pouchdb #1902

Description

@Jarzka

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions