Belisarith opened a new issue #189: Typescript: MangoResponse - The type definition does not allow for accessing the "_id" an "_rev" fields. URL: https://github.com/apache/couchdb-nano/issues/189 <!--- Provide a general summary of the issue in the Title above --> This is only a problem when using typescript. When performing a mango query with the nano find method, the response contains a docs array which contains the different documents found in the DB. When making a console.log the different documents also contain the mandatory "_id" and "_rev" fields from the couchDB. However, when you want to access this fields at the moment, the type definition does not contain the id and rev field. Therefore, at the moment, if you want to use these fields you can only typescript to ignore the error, i.e. ``` // @ts-ignore: the mango response object does not allow to access id queryResult.docs[0]._id ``` works, but is quite inelegant. ## Possible Solution <!--- Not obligatory, but suggest a fix/reason for the bug, --> <!--- or ideas how to implement the addition or change --> In the type definition file nano.d.ts modify the `interface MangoResponse<D>`: ` docs: D[];` to ` docs: (D & {_id: string, _rev:string})[];`
---------------------------------------------------------------- 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
