crystalfp opened a new issue #247:
URL: https://github.com/apache/couchdb-nano/issues/247


   <!--- Provide a general summary of the issue in the Title above -->
   When I use `nano` from typescript I cannot specify, for example, only 
`timeout`. I should specify all three `timeout, agent, headers` or not use 
`requestDefaults` at all.
   
   ## Expected Behavior
   <!--- If you're describing a bug, tell us what should happen -->
   <!--- If you're suggesting a change/improvement, tell us how it should work 
-->
   In a previous version (8?) the following code was valid:
   ```
                const nano = Nano({
                        url: databaseURL,
                        requestDefaults: {timeout: 60000}
                });
   ```
   ## Current Behavior
   <!--- If describing a bug, tell us what happens instead of the expected 
behavior -->
   <!--- If suggesting a change/improvement, explain the difference from 
current behavior -->
   The call generates the following error message during typescript compilation:
   ```
   Type '{ timeout: any; }' is missing the following properties from type 
'requestDefaultsOptions': agent, headers ts(2739)
   ```
   ## Possible Solution
   <!--- Not obligatory, but suggest a fix/reason for the bug, -->
   <!--- or ideas how to implement the addition or change -->
   In `nano.d.ts` change the interface requestDefaultsOptions to:
   ```
     interface requestDefaultsOptions {
       timeout?: number;
       agent?: any;
       headers?: object;
     }
   ```
   
   ## Steps to Reproduce (for bugs)
   <!--- Provide a link to a live example, or an unambiguous set of steps to -->
   <!--- reproduce this bug. Include code to reproduce, if relevant -->
   1. Create a `bug.ts` file containing `import Nano from "nano";` and the Nano 
instantiation above.
   2. Put anything as `databaseURL`
   2. Compile it
   3. Look at the error being generated
   
   ## Context
   <!--- 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 -->
   I simply don't specify a timeout hoping for the best.
   
   ## Your Environment
   <!--- Include as many relevant details about the environment you experienced 
the bug in -->
   * Version used: 9.0.1
   * Browser Name and version:  not significant
   * Operating System and version (desktop or mobile): Windows 10 64 bits 
desktop
   * typescript: 4.1.2
   * Link to your project: not public
   


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


Reply via email to