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

use enums in function signatures within typescript definitions #2242

Closed

Conversation

Treeki
Copy link
Contributor

@Treeki Treeki commented Jul 16, 2020

This is an attempt at fixing #2154 by generating TypeScript definitions that use the correct type for enums within function arguments and return types rather than just number.

I’m quite unfamiliar with this codebase so it’s very possible that my approach will require further tweaks, but I hope it’s at least a good start.

I’ve adapted the backend crate’s codegen module to output the js_name for Enums within the descriptor and likewise adapted the cli-support crate to load that information. To have it appear in the TS definitions, I’ve added AdapterType::Enum(String) which compiles to the same adapter code but carries the name alongside it.

I’ve also added a new pair of files to the typescript_tests crate to handle these cases.

@SebastienGllmt
Copy link

SebastienGllmt commented Jan 2, 2022

Heads up this would conflict with #2631

@daxpedda
Copy link
Collaborator

daxpedda commented Jul 6, 2023

I'm happy to review this after a rebase.

@daxpedda daxpedda self-assigned this Jul 6, 2023
@daxpedda daxpedda added the waiting for author Waiting for author to respond label Jul 6, 2023
@stefnotch
Copy link

@Treeki Would you be interested in finishing this work, or should someone else take over? I'd love seeing this pull request being merged.

@thomasetter
Copy link
Contributor

The underlying issue #2154 seems to have been fixed in #3647.

This PR should therefore probably be closed as it is obsolete.

@daxpedda
Copy link
Collaborator

Indeed, thanks!

@daxpedda daxpedda closed this Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for author Waiting for author to respond
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants