Finds the type from the given types that has the best match with the given preferences,
based on the calculated weight.
A ValuePreference containing the best match and the corresponding weight.
Undefined if there is no match.
Types for which we want to find the best match.
Preferences to match the types against.