There is no need to migrate to the
exports instead of
.cjs suffix when you need to write (or transpile) CommonJS format.
We don’t want to write Typescript, as it requires transpilation. Instead, we use JSDoc annotations that are validated by Typescript, but don’t make the actual code nonstandard. This has the added benefit of Intellisense, which helps with discoverability of your code.
To have the Typescript language server (in your IDE) validate a
.js file’s JSDocs, add:
near the top of the file. See the example/README.md to learn more.