RobotWebTools / rclnodejs

Node.js version of ROS 2.0 client
https://docs.ros.org/en/humble/Concepts/Basic/About-Client-Libraries.html?highlight=rclnodejs#community-maintained
Apache License 2.0
319 stars 70 forks source link

Improve typing support for services #708

Closed wayneparrott closed 3 years ago

wayneparrott commented 3 years ago

Problem When working with Services in TypeScript the type definitions use semi-ambiguous Message[T] rather than the more precise MessageType. @mattrichard implementation of action typing demonstrate how to create unambiguous typing definitions. A similar technique could be used to improve the typing definitions of Services and Clients.

Proposal This enhancement request proposes to apply the generics patterns used in the action typings to improve the Service and Client and related callback and handler definitions. The changes should should be backward compatible.

Expected outcome The results should be much more precise service and client typings that smart typescript editors (e.g., VSCode) can employ to assist developers create clean, unambiguous services and clients.