emscripten-core / emscripten-core/emscripten
[RFC] Rework embind_gen.js to be able to improve typings based on actual Emscripten settings
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
As of today, TypeScript typings generation is a bit limited by the fact that-to run the JS wrapper script that generates the typings-the settings provided to Emscripten need to be tweaked (see https://github.com/emscripten-core/emscripten/blob/main/tools/link.py#L1907-L1955).
TS generation is also limited by the current approach to accessing settings in the scripts, that doesn't allow e.g. to iterate over the exported runtime methods to decide what to expose on the typings side.
I'm not sure what the best approach would be, but it would be great to make the script receive the original settings as native JS object somehow.
To demonstrate what I mean, I created a PoC branch on my fork (see https://github.com/emscripten-core/emscripten/compare/main...Dabolus:feat/better-output-types), where I successfully managed to create more reliable types by providing the original settings as a base64 encoded arg to the JS script (I know this isn't ideal, but again, it's just to better explain my point).
Contributor guide
Assessment
This issue has not been assessed yet.