Enum members and union types
See original GitHub issueenum ParseResult {
case Trees(xs: List[Int])
case Errors(xs: List[String])
case Incomplete
case Exit
}
import ParseResult._
type Fine = Trees | Errors
type NotFine0 = Trees | Incomplete
type NotFine1 = Trees | Errors | Incomplete
type NotFine2 = Trees | Errors | Exit
I’m assuming this is due to Incomplete
and Exit
getting desugared into:
final case val Exit: Test.ParseResult = Test.ParseResult.$new(3, "Exit")
ping @odersky
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Union Types vs. Enums in TypeScript
Conceptually, enums can be a subset of union types with numeric or string values. Numeric enums are less safe. If you call updateStatus(20)...
Read more >TypeScript | Union Types vs Enums
Learn the difference between using union types and enums in TypeScript with simple examples, as well as understanding when to use one or...
Read more >Should You Use Enums or Union Types in Typescript?
There's only one way to use union types, while with enums you can use ButtonStatus. · If code uniformity matters to you, it's...
Read more >Handbook - Enums - TypeScript
Union enums and enum member types. There is a special subset of constant enum members that aren't calculated: literal enum members. A literal...
Read more >Typescript has unions, so are enums redundant?
Enums can be seen conceptually as a subset of union types, dedicated to int and/or string ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@japgolly - there was some breakage a while back, where at the time, we decided that fixing the breakage was more important than allowing singleton types in unions.
I’m hoping that we can get back to enabling this again, but so far other things have taken priority. If you’re interested in helping out on this, we’re more than happy to help you get started 😃
oh god… please tell me that’s going to change at some point.