Skip to content

Commit

Permalink
fix: action server ExecuteCallback and GoalCallback definitions (#831)
Browse files Browse the repository at this point in the history
* fix: ExecuteCallback and GoalCallback definitions
* fix register execute callback return

Co-authored-by: Filipe Pinheiro <dev@fampinheiro.dev>
  • Loading branch information
2 people authored and minggangw committed Apr 2, 2022
1 parent 2344369 commit f699e79
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions types/action_server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ declare module 'rclnodejs' {

type ExecuteCallback<T extends TypeClass<ActionTypeClassName>> = (
goalHandle: ServerGoalHandle<T>
) => ActionResult<T>;
type GoalCallback = () => GoalResponse;
) => Promise<ActionResult<T>> | ActionResult<T>;
type GoalCallback<T extends TypeClass<ActionTypeClassName>> = (
goalHandle: ServerGoalHandle<T>
) => GoalResponse;
type HandleAcceptedCallback<T extends TypeClass<ActionTypeClassName>> = (
goalHandle: ServerGoalHandle<T>
) => void;
Expand Down Expand Up @@ -112,7 +114,7 @@ declare module 'rclnodejs' {
typeClass: T,
actionName: string,
executeCallback: ExecuteCallback<T>,
goalCallback?: GoalCallback,
goalCallback?: GoalCallback<T>,
handleAcceptedCallback?: HandleAcceptedCallback<T>,
cancelCallback?: CancelCallback,
options?: ActionServerOptions
Expand Down Expand Up @@ -144,7 +146,7 @@ declare module 'rclnodejs' {
*
* @param goalCallback - Callback function, if not provided, then unregisters any previously registered callback.
*/
registerGoalCallback(goalCallback?: GoalCallback): void;
registerGoalCallback(goalCallback?: GoalCallback<T>): void;

/**
* Register a callback for handling cancel requests.
Expand Down

0 comments on commit f699e79

Please sign in to comment.