Skip to content

Conversation

@SethFalco
Copy link
Member

@SethFalco SethFalco commented Oct 30, 2025

Description

I opted to spin this off into its own PR because I make some substantial (and potentially controversial) additions.

While contributing to this repository, it wasn't a pleasant experience without the strong type checking that I'm used to. Axel Navarro did the first stage to addressing this (not sure if intentionally) by adding JSDoc types.

This pushes that forward, applies all feedback that was given, makes some minor revisions, reformats the placement of types to fit the JSDoc conventions, and finally, enforces the type.

I'll like to emphasize that the commit message and PR title say type checking, not TypeScript. I do propose that we add the typescript package to our dev dependencies, but we would not be adopting the TypeScript language.

TypeScript (or rather the tool, tsc) is capable of type checking JavaScript through JSDoc type annotations. (We can use TypeScript for real if people want, but I'm actually not a big fan of *.ts, I just like using tsc in my plain-old JavaScript files.)

This has already allowed us to catch a few small bugs:

  • Math.log doesn't take a second argument. We should've been using Math.log10, not Math.log(_, 10).
  • glob doesn't take a callback, it's a Promise only API. Though we never used the third parameter anyway, so I don't think this changed anything.

This will add stronger code completion and type checking in most editors and enforce correct use of types in CI. Some types can definitely be improved, but I wanted to minimize code changes for now.

Feedback welcome!

Checklist

Please review this checklist before submitting a pull request.

  • Code compiles correctly
  • Created tests, if possible
  • All tests passing (npm run test:all)
  • Extended the README / documentation, if necessary

Related

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