janglad - I may be missinng something here or m...
I may be missinng something here or maybe it's a TS limitation but I would expect the last line to give a TS error saying that type can never be "LISTING" (since owner.type is company). Why is this not happening?
Solution:Jump to solution
Yeah, this is a typescript thing: an object's discriminant needs to be at the base level of that object.
3 Replies
Solution
Yeah, this is a typescript thing: an object's discriminant needs to be at the base level of that object.
I figured, thanks!
In other words, that first check only narrows the
test.owner
object, not the test
object.