You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by gl...@apache.org on 2020/02/27 10:51:57 UTC

[couchdb-nano] 01/01: fixed TypeScript definitions for follow functions - fixes issue #194

This is an automated email from the ASF dual-hosted git repository.

glynnbird pushed a commit to branch issue194
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git

commit d868f45900366d80c8d091d777ae732fdc8749ef
Author: Glynn Bird <gl...@gmail.com>
AuthorDate: Thu Feb 27 10:51:39 2020 +0000

    fixed TypeScript definitions for follow functions - fixes issue #194
---
 lib/nano.d.ts | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/lib/nano.d.ts b/lib/nano.d.ts
index e287643..9f5d29f 100644
--- a/lib/nano.d.ts
+++ b/lib/nano.d.ts
@@ -44,11 +44,16 @@ declare namespace nano {
     updates(callback?: Callback<DatabaseUpdatesResponse>): Promise<DatabaseUpdatesResponse>;
     // http://docs.couchdb.org/en/latest/api/server/common.html#get--_db_updates
     updates(params: UpdatesParams, callback?: Callback<DatabaseUpdatesResponse>): Promise<DatabaseUpdatesResponse>;
-    followUpdates(callback?: Callback<any>): EventEmitter;
-    followUpdates(params: any, callback?: Callback<any>): EventEmitter;
+    followUpdates(params?: any): FollowEmitter;
+    followUpdates(callback: Callback<any>);
+    followUpdates(params: any, callback: Callback<any>);
     uuids(num: number, callback?: Callback<any>): Promise<UUIDObject>;
   }
 
+  interface FollowEmitter extends EventEmitter {
+    follow();
+  }
+  
   interface UUIDObject {
     uuids: string[]
   }
@@ -99,9 +104,11 @@ declare namespace nano {
     changesAsStream(name: string): Request;
     // http://docs.couchdb.org/en/latest/api/database/compact.html#post--db-_compact
     changesAsStream(name: string, params: DatabaseChangesParams): Request;
-    follow(source: string, callback?: Callback<any>): EventEmitter;
-    follow(source: string, params: DatabaseScopeFollowUpdatesParams, callback?: Callback<any>): EventEmitter;
-    followUpdates(params?: any, callback?: Callback<any>): EventEmitter;
+    follow(source: string, params?: DatabaseScopeFollowUpdatesParams): FollowEmitter;
+    follow(source: string, params: DatabaseScopeFollowUpdatesParams, callback: Callback<any>);
+    followUpdates(params?: any): FollowEmitter;
+    followUpdates(params: DatabaseScopeFollowUpdatesParams, callback: Callback<any>);
+    followUpdates(callback: Callback<any>);
     // http://docs.couchdb.org/en/latest/api/server/common.html#get--_db_updates
     updates(callback?: Callback<DatabaseUpdatesResponse>): Promise<DatabaseUpdatesResponse>;
     // http://docs.couchdb.org/en/latest/api/server/common.html#get--_db_updates
@@ -129,8 +136,9 @@ declare namespace nano {
     changes(callback?: Callback<DatabaseChangesResponse>): Promise<DatabaseChangesResponse>;
     // http://docs.couchdb.org/en/latest/api/database/changes.html#get--db-_changes
     changes(params: DatabaseChangesParams, callback?: Callback<DatabaseChangesResponse>): Promise<DatabaseChangesResponse>;
-    follow(callback?: Callback<any>): EventEmitter;
-    follow(params: DocumentScopeFollowUpdatesParams, callback?: Callback<any>): EventEmitter;
+    follow(params?: DocumentScopeFollowUpdatesParams): FollowEmitter;
+    follow(params: DocumentScopeFollowUpdatesParams, callback: Callback<any>);
+    follow(callback: Callback<any>);
     // http://docs.couchdb.org/en/latest/api/server/authn.html#cookie-authentication
     auth(username: string, userpass: string, callback?: Callback<DatabaseAuthResponse>): Promise<DatabaseAuthResponse>;
     // http://docs.couchdb.org/en/latest/api/server/authn.html#get--_session