I'm pretty sure that TypeId is meant to be used as an opaque type - you can't serialize it.
You would have to downcast to a concrete type, then deserialize that type.
I think what you're trying to do isn't possible in the sense that you need to know the type(s) you're expecting to deserialize into a priori. It could be a selection of types (either static or dynamic dispatch) but it can't be completely generic. Others may correct me.
Enums serialize well because they will include a tag to denote the variant. This is how I would handle what you're trying to do.
You might be able to set something up using typetag and a custom trait, but I think you'll still run into the problem of not being able to inspect a TypeId.