feliperoberto opened a new issue #191: invalid typescript type definition for view's built-in reduce functions as params URL: https://github.com/apache/couchdb-nano/issues/191 <!--- Provide a general summary of the issue in the Title above --> The nano.d.ts file defines that a view's reduction params must be a function, but couchdb offer the option to use a built-in reduce function. But the reduce property must be a string. ## Expected Behavior A ViewDocument should accept the reduce property as string <!--- If you're describing a bug, tell us what should happen --> <!--- If you're suggesting a change/improvement, tell us how it should work --> ## Current Behavior Only a function is accepted. It is not working as defined by CouchDB api <!--- If describing a bug, tell us what happens instead of the expected behavior --> <!--- If suggesting a change/improvement, explain the difference from current behavior --> ## Possible Solution Modify the nano.d.ts file to accomplish that <!--- Not obligatory, but suggest a fix/reason for the bug, --> <!--- or ideas how to implement the addition or change --> ## Steps to Reproduce (for bugs) const db = nano.use<nano.ViewDocument<{seller_id: number;id: number}>>(dbName) await db.insert({ _id: '_design/item', views: { docsBySeller: { map: function (doc: nano.ViewDocument<{seller_id: number;id: number}>) { emit(doc.seller_id, doc.id) } }, countBySeller: { reduce: '_count', map: function (doc: nano.ViewDocument<{seller_id: number;id: number}>) { emit(doc.seller_id, 1) } } } <!--- Provide a link to a live example, or an unambiguous set of steps to --> <!--- reproduce this bug. Include code to reproduce, if relevant --> ## Context I was trying to create a view that use a built-in reduce function <!--- How has this issue affected you? What are you trying to accomplish? --> <!--- Providing context helps us come up with a solution that is most useful in the real world --> ## Your Environment <!--- Include as many relevant details about the environment you experienced the bug in --> * Version used: ^8.1.0 * Browser Name and version: nodejs v10.9.0 * Operating System and version (desktop or mobile): Docker version 19.03.5, build 633a0ea838
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
