josdejong / mathjs

An extensive math library for JavaScript and Node.js
https://mathjs.org
Apache License 2.0
14.32k stars 1.24k forks source link

Testing: add check that every function is mentioned in types/index.d.ts #2472

Open gwhitney opened 2 years ago

gwhitney commented 2 years ago

A mild thorn in the side of mathjs has been frequent need to update the TypeScript typings. #2448 if merged will make some progress toward stabilizing this, as the TypeScript "exercising" of mathjs in the tests increases over time (as well as allow the ability to make changes to those typings with confidence that existing use won't be broken).

Another piece of the puzzle would simply be a check that at least every function (perhaps with some exception list) exported by mathjs is at least mentioned in both types/index.d.ts and types/index.ts, so that there's at least a chance it is both declared and tested. That should at least prevent the (so far relatively common) case of "I added a function but oops forgot to type it."

My feeling is this should likely be another step in the new test:types script created if #2448 is merged, if possible.

josdejong commented 2 years ago

Good idea, makes sense!