Skip to content

Convert library to Typescript Roadmap #904

@drewhoener

Description

@drewhoener

This is an issue for tracking the migration of RosLibJS to Typescript.

While the library has generated types through JSDoc, it lacks the robustness that TypeScript and typescript-eslint can provide. Among other things, a move to TS can provide greater intellisense throughout the project (e.g. typed event names in EventEmitter methods, etc).

In terms of other motivation, I've been contributing to RosReact for the past several years, to the point that I've forked it since the original dev doesn't seem to have much time for it currently. I use it in almost every project that I design a dev interface for, it's a big part of my workflow now.
I've ended up making a lot of type safe constructs to wrap around the RosLib objects and it would help my own development if the types I'm making on my end were reflected in this upstream library

Base

Migrate trivial modules

The following items can likely be migrated as-is without a ton of extra consideration for impact on the core modules, and likely have little to no extra refactoring work besides adding the types from docs.

Migrate Ros module & socket adapter

I have a good bit of this work completed from before I was requested to break the migration into parts, but it's a decent bit of refactoring of types.
A possible breakdown:

  • cbor array module in utils
  • SocketAdapter (dependant on cbor)
  • Add typings for EventEmitter events with their respective callback function types

Migrate modules that use Ros

Basically just a catch-all for anything I didn't list above, but once the refactor to the Ros class is done, everything in these modules should fall into place fairly easily since it'll just be updating type information.
This assumes that the overall API isn't changing much other than some generics or typing changes that need checking (which should be the case, I have some work done to support this as well since I started refactoring the above already).

  • Topic
  • Message
  • Param
  • Service
  • Action (ROS2)
  • Actionlib (ROS1)
  • tf module

Tests

My original PR #851 has most of the work for migrating tests already done, so that shouldn't be too much of an issue, not going to bother with a checklist, just noting that they need to be updated

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions