Skip to content

Commit 32916c5

Browse files
committed
Correct parameter type
1 parent 4fb1fc1 commit 32916c5

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

lib/parameter.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const rclnodejs = require('bindings')('rclnodejs');
3434
const DEFAULT_NUMERIC_RANGE_TOLERANCE = 1e-6;
3535

3636
const PARAMETER_SEPARATOR = '.';
37+
const PARAMETER_BYTE = 10;
3738

3839
/**
3940
* Enum for ParameterType
@@ -61,8 +62,6 @@ const ParameterType = {
6162
PARAMETER_DOUBLE_ARRAY: 8,
6263
/** @member {number} */
6364
PARAMETER_STRING_ARRAY: 9,
64-
/** @member {number} */
65-
PARAMETER_BYTE: 10,
6665
};
6766

6867
/**
@@ -676,8 +675,6 @@ class IntegerRange extends Range {
676675
*/
677676
isValidType(parameterType) {
678677
const result =
679-
parameterType === ParameterType.PARAMETER_BYTE ||
680-
parameterType === ParameterType.PARAMETER_BYTE_ARRAY ||
681678
parameterType === ParameterType.PARAMETER_INTEGER ||
682679
parameterType === ParameterType.PARAMETER_INTEGER_ARRAY;
683680
return result;
@@ -770,7 +767,7 @@ function validValue(value, type) {
770767
result = typeof value === 'string';
771768
break;
772769
case ParameterType.PARAMETER_DOUBLE:
773-
case ParameterType.PARAMETER_BYTE:
770+
case PARAMETER_BYTE:
774771
result = typeof value === 'number';
775772
break;
776773
case ParameterType.PARAMETER_INTEGER:
@@ -798,7 +795,7 @@ function _validArray(values, type) {
798795
if (type === ParameterType.PARAMETER_BOOL_ARRAY) {
799796
arrayElementType = ParameterType.PARAMETER_BOOL;
800797
} else if (type === ParameterType.PARAMETER_BYTE_ARRAY) {
801-
arrayElementType = ParameterType.PARAMETER_BYTE;
798+
arrayElementType = PARAMETER_BYTE;
802799
}
803800
if (type === ParameterType.PARAMETER_INTEGER_ARRAY) {
804801
arrayElementType = ParameterType.PARAMETER_INTEGER;

types/parameter.d.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ declare module 'rclnodejs' {
4545
*
4646
* @param name - The parameter name, must be a valid name.
4747
* @param type - The type identifier.
48-
* @param {value - The parameter value.
48+
* @param value - The parameter value.
4949
*/
5050
constructor(name: string, type: ParameterType, value?: any);
5151

@@ -265,15 +265,11 @@ declare module 'rclnodejs' {
265265
/**
266266
* Create a new instance.
267267
* @constructor
268-
* @param {bigint|number} fromValue - The lowest inclusive value in range
269-
* @param {bigint|number} toValue - The highest inclusive value in range
270-
* @param {bigint|number} step - The internal unit size.
268+
* @param {bigint} fromValue - The lowest inclusive value in range
269+
* @param {bigint} toValue - The highest inclusive value in range
270+
* @param {bigint} step - The internal unit size.
271271
*/
272-
constructor(
273-
from: bigint | number,
274-
to: bigint | number,
275-
step?: bigint | number
276-
);
272+
constructor(from: bigint, to: bigint, step?: bigint);
277273

278274
/**
279275
* Determine if a ParameterType is compatible.

0 commit comments

Comments
 (0)