You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find that there are many API's written in rust with an enum variant parameter that I would write in TypeScript with a discriminated union or an overload
As far as I can tell this isn't possible with napi-rs today. Would this be easy to implement? Seems like it should be possible for structured enums as long as every member is a JsValue. Functions could support either overload and union style while recursive JsValues would always generate a discriminated union. The union would use the enum name as the type and the discriminating field type could be overriden. The identifiers could be overriden as well with js_name.
BTW thanks for developing this project
The text was updated successfully, but these errors were encountered:
I find that there are many API's written in rust with an enum variant parameter that I would write in TypeScript with a discriminated union or an overload
Discriminated union
Overload
As far as I can tell this isn't possible with napi-rs today. Would this be easy to implement? Seems like it should be possible for structured enums as long as every member is a JsValue. Functions could support either overload and union style while recursive JsValues would always generate a discriminated union. The union would use the enum name as the type and the discriminating field
type
could be overriden. The identifiers could be overriden as well with js_name.BTW thanks for developing this project
The text was updated successfully, but these errors were encountered: