Suggestion xml2typescript tooling
🔍 Search Terms
xml2typescript, xml to typescript, type definition from XML, XML convert to typescript, typescript from xml
✅ Viability Checklist
- [X] This wouldn't be a breaking change in existing TypeScript/JavaScript code
- [X] This wouldn't change the runtime behavior of existing JavaScript code
- [X] This could be implemented without emitting different JS based on the types of the expressions
- [X] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- [X] This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- [X] This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
XML is widely used for documentation for projects ( doxygen or other auto-documented solutions) They all rely on the same XML schema with a different number of actual member types etc.
It would be beneficial to extend the functionality of typescript and add support for the generation of typescript definitions from XML directory ( main index.xml and referenced XML files).
The exact issue and proposal is described here: https://github.com/opencv/opencv/issues/15306
I am eager to hear your thoughts on this topic.
📃 Motivating Example
Generation of typescript definitions from XML Issue: https://github.com/opencv/opencv/issues/15306 Solution: generate any opencv.js configuration with Doxygen XML flag enabled and simply use xml2typescipt to build type definitions.
💻 Use Cases
- What do you want to use this for?
Primarily - we are in the process of converting a native project which to modern js ( using ts, electron and opencv) and we need to generate types from opencv Doxygen XML.
- What shortcomings exist with current approaches?
There are no actively maintained or working repos for this functionality. And we need all types\functions to be declared.
- What workarounds are you using in the meantime?
There is an obsolete repo with npm from contributors of DefinitelyTyped for manual type definitions (types/opencvts). But it is obsolete and not suitable for wasm configuration ( or any different configuration), as we need to rebuild opencv from cpp sources directly, which limits opencv_wasm API severely, which is expected and Doxygen provides all the generated API. It is a global issue of missing types for opencv, but thankfully we can always build Doxygen docs.
### Tasks
- [ ] Add xml2typescript tool
This sounds more like something some third-party tooling should provide, not TypeScript itself.
From the non-goals:
Provide an end-to-end build pipeline. Instead, make the system extensible so that external tools can use the compiler for more complex build workflows.
I think it would be better to have it under the Microsoft umbrella, as "third-party tooling" such as packages are prompted to obsoletion and frequently abandoned. I hope somebody from Microsoft will see this and it will spark interest. XML is de facto standard for all sorts of things.
as "third-party tooling" such as packages are prompted to obsoletion and frequently abandoned
That sounds like there's just not much interest in such tooling for the "de facto standard" to justify the time and resource investment. 🤷♂️ Just my two cents.
This doesn’t fit within TypeScript’s design goals, but sounds like a good fit for a third party open source tool.