apache / couchdb-nano

Nano: The official Apache CouchDB library for Node.js
https://www.npmjs.com/package/nano
Apache License 2.0
651 stars 165 forks source link

Types differ from real data. Again. #222

Open akopchinskiy opened 4 years ago

akopchinskiy commented 4 years ago

Changes type:

// http://docs.couchdb.org/en/latest/api/database/changes.html#get--db-_changes
  interface DatabaseChangesResultItem {
    // List of document’s leaves with single field rev.
    changes: Array<{ rev: string }>;

    // Document ID.
    id: string;

    // Update sequence.
    seq: any;

    // true if the document is deleted.
    deleted: boolean;
  }

Real data: image

There is a doc property, however it's not in the interface. Also there's no deleted property, despite it's set as required. Please fix.

Your Environment

navanshu commented 3 years ago

Is there any better alternative from nano realy types are giving me a bad time.

glynnbird commented 3 years ago

You could try the IBM Cloudant SDK which was built with typescript in mind from day one.

Alternatively, Nano is open source and pull requests that improve its typescript support for couchdb's large api surface would be welcome.

On Sun, 13 Jun 2021, 11:53 navanshu, @.***> wrote:

Is there any better alternative from nano realy types are giving me a bad time.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/apache/couchdb-nano/issues/222#issuecomment-860190908, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFKMRN34AXYHBTE4X6MRRLTSSEZ7ANCNFSM4M3DO3FQ .

navanshu commented 3 years ago

One cannot improve this further without including breaking changes. I am considering making my own lib than using this. Nano is written in JS and that would be a lot of debuggin time.