Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion test/types/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ const actionServer = new rclnodejs.ActionServer(
node,
'example_interfaces/action/Fibonacci',
'fibonacci',
executeCallback
executeCallback,
goalCallback
Copy link

Copilot AI Jul 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The goalCallback parameter is being passed to the ActionServer constructor but is defined after its usage. Consider moving the goalCallback function definition before the ActionServer instantiation to improve code readability and follow the pattern used with executeCallback.

Copilot uses AI. Check for mistakes.
);
expectType<rclnodejs.ActionServer<'example_interfaces/action/Fibonacci'>>(
actionServer
Expand All @@ -403,6 +404,13 @@ expectType<void>(
);
expectType<void>(actionServer.destroy());

function goalCallback(
goal: rclnodejs.ActionGoal<'example_interfaces/action/Fibonacci'>
): rclnodejs.GoalResponse {
expectType<number>(goal.order);
return rclnodejs.GoalResponse.ACCEPT;
}

function executeCallback(
goalHandle: rclnodejs.ServerGoalHandle<'example_interfaces/action/Fibonacci'>
) {
Expand Down
2 changes: 1 addition & 1 deletion types/action_server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ declare module 'rclnodejs' {
goalHandle: ServerGoalHandle<T>
) => Promise<ActionResult<T>> | ActionResult<T>;
type GoalCallback<T extends TypeClass<ActionTypeClassName>> = (
goalHandle: ServerGoalHandle<T>
goal: ActionGoal<T>
) => GoalResponse;
type HandleAcceptedCallback<T extends TypeClass<ActionTypeClassName>> = (
goalHandle: ServerGoalHandle<T>
Expand Down
Loading