You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2022/10/27 00:11:54 UTC

[GitHub] [couchdb-nano] Kaspanoombro opened a new issue, #308: Cannot acces the document content using typescript

Kaspanoombro opened a new issue, #308:
URL: https://github.com/apache/couchdb-nano/issues/308

   ## Expected Behavior
   TS keeps giving error, although it works. 
   
   ## Steps to Reproduce
   1. nano.db
   	.use('mydatabase')
   	.get("docidxxxxx") //return a type DocumentGetResponse
           .then(result=>{
               console.log(result); //correctly prints the document (not a DocumentGetResponse)
              const prop1=result.prop1; //Ts gives the error Property 'prop1' does not exist on type 'DocumentGetResponse'.ts(2339)
              const { prop1, _id } = result; //gives the same error
           }                     
   
   this .get() does not have .pipe() which i could use to deconstruct the object with the map.
   How can i access correctly to the document properties using TS?
   Thank you.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb-nano] Kaspanoombro closed issue #308: Cannot acces the document content using typescript

Posted by GitBox <gi...@apache.org>.
Kaspanoombro closed issue #308: Cannot acces the document content using typescript
URL: https://github.com/apache/couchdb-nano/issues/308


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb-nano] Kaspanoombro commented on issue #308: Cannot acces the document content using typescript

Posted by GitBox <gi...@apache.org>.
Kaspanoombro commented on issue #308:
URL: https://github.com/apache/couchdb-nano/issues/308#issuecomment-1292801429

   The solution was 
   
   .then(result=>{
   	const converted = results as mydocModel;
           const prop1=converted.prop1; //now works
   }


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org