this post was submitted on 23 Aug 2023
20 points (100.0% liked)

TypeScript

834 readers
1 users here now

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] kogasa 3 points 1 year ago (1 children)

Discriminated unions have been In The Works(tm) for quite a while. I believe they were cut from the C# 12 roadmap. But maybe C# 13?

I think a source-generation based approach similar to OneOf isn't unlikely.

[โ€“] Lmaydev 1 points 1 year ago

Yeah unfortunately tacking them onto a 20 year old language is not easy.

It's great to see it being worked on but there is a long way to go.