Skip to content

Commit 4635acd

Browse files
authored
Treat warnings as errors in typedoc, expose missing public APIs to fix (#1073)
* Treat warnings as errors in Typedoc * Clean up dead links in README, remove unsupported JSDoc annotations * Export all missing types from public API
1 parent fd8efab commit 4635acd

File tree

5 files changed

+38
-22
lines changed

5 files changed

+38
-22
lines changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,19 @@ Install roslibjs with any NPM-compatible package manager via, for example,
1818
npm install roslib
1919
```
2020

21-
~Pre-built files can be found in either [roslib.js](build/roslib.js) or [roslib.min.js](build/roslib.min.js).~
22-
23-
As we are updating to v2, we don't provide pre-built files anymore in the repo.
24-
25-
Alternatively, you can use the v1 release via the [JsDelivr](https://www.jsdelivr.com/) CDN: ([full](https://cdn.jsdelivr.net/npm/roslib@1/build/roslib.js)) | ([min](https://cdn.jsdelivr.net/npm/roslib@1/build/roslib.min.js))
26-
2721
## Troubleshooting
2822

2923
1. Check that connection is established. You can listen to error and
3024
connection events to report them to console. See
3125
examples/simple.html for a complete example:
3226

3327
```js
34-
ros.on('error', function(error) { console.log( error ); });
35-
ros.on('connection', function() { console.log('Connection made!'); });
28+
ros.on("error", function (error) {
29+
console.log(error);
30+
});
31+
ros.on("connection", function () {
32+
console.log("Connection made!");
33+
});
3634
```
3735

3836
2. Check that you have the websocket server is running on

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
},
5858
"scripts": {
5959
"build": "vite build",
60-
"doc": "typedoc src/RosLib.ts",
60+
"doc": "typedoc src/RosLib.ts --treatWarningsAsErrors",
6161
"lint": "eslint .",
6262
"test": "vitest",
6363
"prepublishOnly": "npm run test",

src/RosLib.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/**
2-
* @fileOverview
32
* @author Russell Toris - rctoris@wpi.edu
43
*/
54

6-
/** @description Library version */
5+
/** Library version */
76
export const REVISION = import.meta.env.VITE_ROSLIBJS_VERSION;
87

98
// Core exports
10-
export { default as Ros } from "./core/Ros.js";
9+
export { default as Ros, type TypeDefDict } from "./core/Ros.js";
1110
export { default as Topic } from "./core/Topic.js";
1211
export { default as Param } from "./core/Param.js";
1312
export { default as Service } from "./core/Service.js";
1413
export { default as Action } from "./core/Action.js";
14+
export { type GoalStatus } from "./core/GoalStatus.js";
1515

1616
// Core Transport exports
1717
export {
@@ -54,10 +54,28 @@ export {
5454
default as UrdfVisual,
5555
type UrdfGeometryLike,
5656
} from "./urdf/UrdfVisual.js";
57+
export { default as UrdfJoint } from "./urdf/UrdfJoint.js";
5758

5859
export {
5960
UrdfAttrs,
6061
UrdfType,
6162
type UrdfDefaultOptions,
6263
} from "./urdf/UrdfTypes.js";
6364
export { isElement, parseUrdfOrigin } from "./urdf/UrdfUtils.js";
65+
66+
// only export the types that typedoc requires us to export - those are our public interfaces
67+
export { type actionlib_msgs } from "./types/actionlib_msgs.js";
68+
export { type tf2_web_republisher } from "./types/tf2_web_republisher.js";
69+
export { type rosapi } from "./types/rosapi.js";
70+
export { type std_msgs } from "./types/std_msgs.js";
71+
export { type tf2_msgs } from "./types/tf2_msgs.js";
72+
export { type geometry_msgs } from "./types/geometry_msgs.js";
73+
export type { Nullable, PartialNullable } from "./types/interface-types.js";
74+
export {
75+
type RosbridgeMessage,
76+
isRosbridgeMessage,
77+
type RosbridgeAdvertiseMessage,
78+
isRosbridgeAdvertiseMessage,
79+
type RosbridgeSubscribeMessage,
80+
isRosbridgeSubscribeMessage,
81+
} from "./types/protocol.js";

src/core/Ros.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import type {
3333
} from "./transport/Transport.js";
3434
import { WebSocketTransportFactory } from "./transport/WebSocketTransportFactory.ts";
3535

36-
interface TypeDefDict {
36+
export interface TypeDefDict {
3737
[key: string]: string | string[] | TypeDefDict | TypeDefDict[];
3838
}
3939

src/types/rosapi.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ export namespace rosapi {
3030
name: string;
3131
default?: string;
3232
}
33-
interface GetParamResponsePreJazzy {
33+
export interface GetParamResponsePreJazzy {
3434
value: string;
3535
}
36-
interface GetParamResponseFailedPostJazzy {
36+
export interface GetParamResponseFailedPostJazzy {
3737
value: never;
3838
successful: false;
3939
reason: string;
4040
}
41-
interface GetParamResponseSuccessPostJazzy {
41+
export interface GetParamResponseSuccessPostJazzy {
4242
value: string;
4343
successful: true;
4444
reason: never;
@@ -51,12 +51,12 @@ export namespace rosapi {
5151
name: string;
5252
value: string;
5353
}
54-
type SetParamResponsePreJazzy = Record<never, never>;
55-
interface FailedSetParamResponsePostJazzy {
54+
export type SetParamResponsePreJazzy = Record<never, never>;
55+
export interface FailedSetParamResponsePostJazzy {
5656
successful: false;
5757
reason: string;
5858
}
59-
interface SuccessfulSetParamResponsePostJazzy {
59+
export interface SuccessfulSetParamResponsePostJazzy {
6060
successful: true;
6161
reason: never;
6262
}
@@ -67,12 +67,12 @@ export namespace rosapi {
6767
export interface DeleteParamRequest {
6868
name: string;
6969
}
70-
type DeleteParamResponsePreJazzy = Record<never, never>;
71-
interface FailedDeleteParamResponsePostJazzy {
70+
export type DeleteParamResponsePreJazzy = Record<never, never>;
71+
export interface FailedDeleteParamResponsePostJazzy {
7272
successful: false;
7373
reason: string;
7474
}
75-
interface SuccessfulDeleteParamResponsePostJazzy {
75+
export interface SuccessfulDeleteParamResponsePostJazzy {
7676
successful: true;
7777
reason: never;
7878
}

0 commit comments

Comments
 (0)