Skip to content

Conversation

@KTrain5169
Copy link
Contributor

using @types/json-schema for most type changes here, as well as adding @types/ws for tsc reasons (if this is not wanted then @types/ws can be moved to optionalDependency on package.json)

also now exports an ActionData interface for downstream projects to use, over at NeuroPilot we just made our own version of it but it'd be good to share this upstream.

all instances of the any type in the code has now been removed with this PR, should help typescript-supported compilers catch type errors better

result of all of the above is that types are now much clearer and people who want to strictly type their projects can do so just a tiny bit better.

one thing though is that the command type is now changed from string to specific strings, these are based on current specs + proposals, which means that these have to be updated in the code each time there's a change. currently this isn't that big of an issue since API spec changes aren't that common, but if they do get common this may need to be rethought about.
(the other commands also aren't currently handled at all and are treated as if they are unknown commands)

There are now also some type coercions in the code, not sure if this is a good idea so if not let me know and I can try to convert them to typed constants before merge.

Changes:

- Add @types/json-schema as a dependency
- Add a new ActionData interface to help type action data to downstream projects
- Add @types/ws as a dependency to add socket typing
- Strictly type action parameters (incoming or outgoing) instead of using `any`
@KTrain5169 KTrain5169 changed the title feat: more strictly type schemas feat: more strictly type [everything, really] Oct 4, 2025
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

Successfully merging this pull request may close these issues.

1 participant