Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Constants as pure message type #8

Open
kbudin opened this issue Jun 17, 2022 · 0 comments
Open

BUG: Constants as pure message type #8

kbudin opened this issue Jun 17, 2022 · 0 comments

Comments

@kbudin
Copy link

kbudin commented Jun 17, 2022

  • I'm submitting a bug report when having nothing but constants in a message type
    [ X ] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    It is regarded as best practice to have constants and nothing but constants in their own custom message type and then referred to from main custom message type.
    But generated typescript appends Const keyword to enums but does not add Const keyword in the files referring to them, so generating invalid typescript code.

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Example:
RobotMode.msg file:
`
std_msgs/Header header

RobotModeConstants robot_mode_constant

int8 value
`

RobotModeConstants.msg file:
`

int8 DISCONNECTED=0
int8 BOOTING=1
int8 POWER_OFF=2
int8 POWER_ON=3
int8 IDLE=4
int8 RUNNING=5

`

Generated typescript file:
`
export enum IRosTypeRobotModeConstantsConst {
DISCONNECTED = 0,
BOOTING = 1,
POWER_OFF = 2,
POWER_ON = 3,
IDLE = 4,
RUNNING = 5,
}

export interface IRosTypeRobotMode {
header: IRosTypeStdMsgsHeader;
robot_mode_constant: IRosTypeRobotModeConstants;
value: number;
}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant