-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
I know that this repository is JavaScript by choice and I'm definitely not proposing to rewrite it in TypeScript. However, most modern IDEs leverage type definitions to show tooltips and hints even for developers using pure JavaScript. In the ideal case scenario, one doesn't even have to open the documentation, because they see everything in their editor:
The mathjs source code contains all the important information: the methods are strongly typed thanks to typed-function, every method has a jsDoc comment with complete specification attached to it. But currently, none of this information is exported as type definitions. For types we're dependent on DefinitelyTyped which has to be manually fixed every time a new version comes out, and is prone to misunderstanding and mistakes in transcribtion.
This code duplication is unfortunate and could be avoided. TypeScript supports generating type definitions from js files. If mathjs were just a traditional ES6 module, setting up type generation would be trivial. But since there appears to be some complicated interdependency between the files, it might be a bit trickier.
EDIT: I'm attaching a link to a string matching trick for TypeScript, so that I can find it here if I need it.
@josdejong I'm willing to invest some of my time to investigate this issue further, but I don't want to waste my time, so please let me know if you'd be interested in this.
Also, I'd like to ask, why does mathjs have a custom dependency loader (utils/factory.js). Aren't the already existing mechanisms of ES6 modules enough?
