ARCHITECTURE: Migrate to TypeScript
See original GitHub issueTypeScript is a strict superset of JavaScript that adds optional static typing and that adopts the latest ECMAScript features before they are broadly deployed by browser vendors. It gets transpiled to JavaScript for deployment, and the support for debugging using sourcemaps is currently good.
The following steps need to happen:
- setup build system to use TypeScript and Rollup to bundle the (JavaScript) sources
- convert JavaScript files to TypeScript by adding type annotation, particularly for arguments and return values
- correct any errors that will be discovered as part of this process (mistyped property names is a common one)
- switch the test harness from
tape
tojest
Once completed, the codebase will be easier to maintain and the MathLive interface will have a “native” TypeScript interface (instead of the current one which is generated from JSDoc annotations and is not as expressive as desirable as a result). This will make the integration of MathLive in TypeScript projects easier. On the other hand, this should be transparent for JavaScript projects using MathLive, as the regular JavaScript API will still be available.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:10 (9 by maintainers)
Top GitHub Comments
It looks pretty good, but
options: any
is not helpful. It would be much more helpful to have a comment to explain the options or maybe better from a code correctness point of view, eliminate “any” and be specific about what the options really are from a type point of view.Similarly, “string” is not helpful – what values can the string take on?
I did spot a bug dealing with links on http://cortexjs.io/docs/mathlive/#("core"%3Anamespace).(ParseMode%3Atype):
One the webpage, that link is just plain text, not a clickable link.
Very Good