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
Sometimes two union types share a property; either by inheritance, spreading or coincidence. In these cases I would like to access the type of the shared field, as this operation should be well-defined.
I did not find any match for UnionExpression in the issues/discussion, so I hope this is not a dupe.
Hi @I-Al-Istannen, thanks for the bug report. Crashing here is definitely not something that should happen however that reference is not doing exactly what you think it is. Unlike in TypeScript where you could do that because it would reference the type of the foo property(string). In TypeSpec it does actually reference the property example playground. This distinction makes it a bit harder to get a meaningful type. We might still be able a virtual union here that is A.foo | B.foo but I think that would require some design.
Thanks! Yea, the ICE is not good in any case :P The union would work out in many cases, I assume (as properties with the same name tend to be of similar type and shape), but I am not sure it is worth the effort.
I don't quite grasp the type system of TypeSpec it seems, but I have opened a discussion for that. I don't think it has a real place in this issue :)
Describe the bug
Sometimes two union types share a property; either by inheritance, spreading or coincidence. In these cases I would like to access the type of the shared field, as this operation should be well-defined.
I did not find any match for
UnionExpression
in the issues/discussion, so I hope this is not a dupe.Reproduction
Playground or inline:
Checklist
The text was updated successfully, but these errors were encountered: