Closed mungojam closed 2 years ago
actually, check out this playground which shows that it interprets result
as never
(hover over result).
That's a bit of a shame as then consumers won't see the real type that they can then pass on to other functions that take it. I guess there isn't a workaround for that?
Closing to clear my PR list
The use of string in both the enum and the structure made it a bit ambiguous whether the two types needed to match or not. The instructions above make it clear, but I figure it's nice to have an example that is unambiguous by itself.
The bit I'm not 100% on is the very last comment in this section, because I found that the IDE would show 'never' as the intersection between
string
enum andnumber
but that the behaviour was still ok. So I didn't know if the comment was still valid for other structural types.The workaround worked great for me anyway though, so thanks for posting this great guide!