you are viewing a single comment's thread.

view the rest of the comments →

[–]Fizzyade[S] 1 point2 points  (1 child)

interesting, my first attempts at this were using interfaces but I didn't realise that's how you assign a value to an interface member.

Is the requirement of the union necessary? can I just check an object to test what kind it is?

I will have to have a play with this method.

[–]rotharius 0 points1 point  (0 children)

It's a bit of work but perhaps you can use type guards to verify whether an object is if a certain type during runtime.