-
-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
Union types (other than rawvalue which are already done) should be supported. The best way to do this is unclear to me so this issue functions as a discussion point.
Example:
export type Foo = { foo: string }
export type Bar = { bar: string }
export type Example = Foo | Bar
export function example(): ExampleCould maybe generate:
@JSClass struct Foo {
@JSGetter var foo: String
@JSSetter func setFoo(_ value: String) throws(JSException)
}
@JSClass struct Bar {
@JSGetter var bar: String
@JSSetter func setBar(_ value: String) throws(JSException)
}
@JSClass enum Example {
case foo(Foo)
case bar(Bar)
}
@JSFunction func example() throws(JSException) -> ExampleNote that ts unions can change dynamically eg if I set foo to null and bar to a string, the type changes from Foo to Bar, so idk if that works with an enum like this in Swift.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels