Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork57
BridgeJS: Enum export support for case / raw / empty enums#418
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks! I'lll take a closer look tomorrow but meanwhile would you mind adding runtime test in Tests/BridgeJSRuntimeTests? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Overall approach looks good to me!
Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.d.tsShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
da01493 to0ef902dCompare79a9c1b intoswiftwasm:mainUh oh!
There was an error while loading.Please reload this page.
Introduction
This PR adds basic enum export support to the BridgeJS plugin.
Feature Overview
Supported Enum Types
Enum Output Styles
New
@JS(enumStyle: .tsEnum)parameter allows choosing between:.const(default): Generates const objects with union types for maximum compatibility.tsEnum: Generates native TypeScript enum declarations (available for case enums and raw value enums with String or numeric raw types only)Examples
Case Enum with Both Styles
Generated TypeScript:
Raw Value Enum
Namespace Enum
What's Not Supported
Testing
EnumCase.swift- Case enum tests with both output stylesEnumRawType.swift- Raw value enum tests for all supported typesEnumNamespace.swift- Namespace enums with mixing same namespace as enum and@JS(namespace)Docs
Docs updated with example for each enum type, new macro parameter and basic relevant usage guide.