Fix: Enforce serializers to only produce valid target types
All serializers were already required (by the specification) to only produce
valid target types. However, this restriction hasn't been enforced so far and
can cause unexpected errors during deserialization if custom serializers are
involved.
This fix constitutes a breaking change if you have custom serializers that
don't follow the spec. The output of serializers is now checked during
serialization; if it's not of a valid target type, an exception is thrown.