gbdrt commented on issue #72: Adding type definitions for typescript
URL: 
https://github.com/apache/incubator-openwhisk-client-js/pull/72#issuecomment-329480529
 
 
   There are some tools to generate the type definition from an API description 
which can give a rough first version, and help to maintain the project.
   
   Unfortunately the Openwhisk API description is not up-to-date with the 
implementation. 
   I generated the type definitions manually using both the API description and 
a lot of tests.
   Then I added the definitions for the shortcut that are documented here: 
https://github.com/apache/incubator-openwhisk-client-js/blob/master/README.md
   
   I also overload some methods with advanced type annotation that are very 
useful.
   For instance if I use:
   ```
   const res = ow.actions.invoke<In, Out>{
     name: 'xxxx',
     blocking: true,
     result: true,
     params: p
   }
   ```
   
   The compiler forces the parameter `p` to be of type `IN` and knows that the 
output is of type `Promise<Out>`.
   
   In the same vein there are multiple overloading of the `invoke` function 
because the output type depends on the value of the parameters `blocking` and 
`result`. 
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Reply via email to