cloudant / nodejs-cloudant

Cloudant Node.js client library
Apache License 2.0
255 stars 90 forks source link

Typesript nano types incorrect #355

Closed rhyshort closed 5 years ago

rhyshort commented 5 years ago

Bug Description

1. Steps to reproduce and the simplest code sample possible to demonstrate the issue

When attempting to use the default promise return type from @cloudant/cloudant, I get type errors when compiling, this is because of https://github.com/cloudant/nodejs-cloudant/blob/master/package.json#L26

code example of compilation failure:

import * as cloudant from '@cloudant/cloudant';

export function test(): Promise<any> {
    //cloudant object creation and db.use omitted
    return database.bulk({docs: [{foo: "bar"}]})
}

2. What you expected to happen

Complies successfully.

3. What actually happened

error TS2739: Type 'Request' is missing the following properties from type 'Promise<any[]>': then, catch, [Symbol.toStringTag]

Environment details