Skip to content

Conversation

@Adam-Shea
Copy link

What problem does the pull request solve?

Hi, I was using the lib and thought it would be easier to work with if there were types. This pr adds types without making any changes to functionality. I checked the types against all of the tests to make sure they can be added into existing code without causing issues.
I bumped a minor version as if you are improperly using the lib, you could get some typescript bulid errors. Please let me know if you need any changes or tweaks.

Checklist

  • I’ve used the pull request template
  • I’ve written unit tests for these changes
  • I’ve updated the documentation in
  • I’ve bumped the version number in
    • package.json
  • I've added new environment variables in
    • CONTRIBUTING.md
    • notifications-node-client/scripts/generate_docker_env.sh

@quis
Copy link
Member

quis commented Dec 10, 2025

Hey @Adam-Shea thanks for raising this. It’s not the first time it’s come up so I think there is a need.

Is there a type checker we could add to our CI to make sure the types aren’t becoming outdated? None of us on the team regularly do Node JS development wouldn’t know what the go-to tools are.

@Adam-Shea
Copy link
Author

Hi!
I think if you wanted to check the types as part of your ci, you would need to convert your .js files to typescript files and add types there (you could also use JSDoc for this if you want to keep your js files). Then you could use tsc with strict mode in your ci to make sure there aren't any type errors.
This PR just contains declaration files which aren't directly tied the those js files so I don't think you could use them in ci. I did it this way as I thought not touching the js code would make it easier to get reviewed and merged :)

However if you're open to it, I can have a look over the next few weeks at updating the JSDoc definitions and getting them to generate types you can use in ci. This will have the benefit of your types being directly tied to code and failing builds if the JSDoc is out of sync. I have found this approach is gaining more traction as it means you don't need to compile ts into js which makes reading libs during development harder. What do you think?

Here's the documentation for using JSDoc with typescript https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html

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.

2 participants