microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
99.01k stars 12.29k forks source link

Suggestion xml2typescript tooling #59076

Closed studentutu closed 2 days ago

studentutu commented 3 days ago

🔍 Search Terms

xml2typescript, xml to typescript, type definition from XML, XML convert to typescript, typescript from xml

✅ Viability Checklist

⭐ 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

  1. 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.

  1. 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.

  1. 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
MartinJohns commented 3 days ago

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.

studentutu commented 3 days ago

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.

MartinJohns commented 3 days ago

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.

andrewbranch commented 2 days ago

This doesn’t fit within TypeScript’s design goals, but sounds like a good fit for a third party open source tool.