Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit correct types for emscripten enums in class namespaces #15

Open
isaac-mason opened this issue Apr 18, 2023 · 4 comments
Open

Emit correct types for emscripten enums in class namespaces #15

isaac-mason opened this issue Apr 18, 2023 · 4 comments

Comments

@isaac-mason
Copy link
Member

https://github.com/emscripten-core/emscripten/blob/dd6774a840872b0902e69cfcb20d553359f52374/tools/webidl_binder.py#L798

@regnaio
Copy link

regnaio commented Aug 22, 2024

@isaac-mason Thank you for all of your work on this repo

I was wondering if this issue is related to: https://github.com/pmndrs/webidl-dts-gen/blame/main/packages/webidl-dts-gen/src/convert-idl.ts#L546

Nowadays, is it possible in TypeScript to do Module.Enum.MemberName instead of just Module.Enum?

@isaac-mason
Copy link
Member Author

isaac-mason commented Aug 22, 2024

Hey @regnaio, this isn't related no, this tool generates types that match the output of the emscripten webidl binder.

This issue is for emitting correct types for enums under namespaces, e.g. Module.Namespace.MemberName, following current webidl binder behaviour.

For enums to be accessible via Module.Enum.MemberName changes to the webidl binder would be required.

There's a somewhat related issue on the emscripten repo for prefixing enums here: emscripten-core/emscripten#13243

You could comment on that issue or raise another on the emscripten repo if you'd like.

That said, if you'd like to see it happen, you'll probably need to contribute the change yourself :)

For a workaround, see: fabmax/PhysX#1

If you were to do this and still wanted to use webidl-dts-gen to generate types, you'd need to add types for those enums yourself.

@regnaio
Copy link

regnaio commented Aug 23, 2024

Thank you so much, @isaac-mason , for your links and pointers helping me in the right direction

I feel like you read my mind. Indeed, I was using pmndrs/webidl-dts-gen to generate types for fabmax/physx-js-webidl 😄

I've added a comment to emscripten-core/emscripten#13243

@isaac-mason
Copy link
Member Author

No worries @regnaio! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants