Fixing non-obvious TypeInfo behaviour

Unit tests to show broken behaviour.
Original unit tests had config on the wrong object, so looked like the worked, but did not reflect reality.
Fixing non-obvious TypeInfo behaviour

Fix mishandling of TypeInfo config on serialization which caused it to be lost.
Merge remote-tracking branch 'origin/master'