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

Generate no-arg static constructor for union type of empty value #895

Open
gatesn opened this issue May 13, 2020 · 1 comment
Open

Generate no-arg static constructor for union type of empty value #895

gatesn opened this issue May 13, 2020 · 1 comment

Comments

@gatesn
Copy link

gatesn commented May 13, 2020

What happened?

Given the definition:

NoneType:
  fields: {}
SomeType:
  fields:
    val: any
MyUnion:
  union:
    none: NoneType
    some: SomeType

I want to be able to write MyUnion.none() instead of MyUnion.none(NoneType.of())

I've found it common to have "empty types" as part of a union

@gatesn
Copy link
Author

gatesn commented May 13, 2020

Better yet, MyUnion.some("value")

Or builders, MyUnion.some().value("value").build()

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

1 participant