This PR implements a fix on Value.Cast to dereference Union variants before scoring them. This is required as the current Union differentiation algorithm only works on instances of TObject and where fall through cases (for example TRef) would blindly score referenced objects with a binary 0 or 1 value.
It was observed that in fall through cases where no variants match the value, the first union variant was selected.
This PR implements a fix on Value.Cast to dereference Union variants before scoring them. This is required as the current Union differentiation algorithm only works on instances of TObject and where fall through cases (for example TRef) would blindly score referenced objects with a binary 0 or 1 value.
It was observed that in fall through cases where no variants match the value, the first union variant was selected.
Fixes https://github.com/sinclairzx81/typebox/issues/880