There's no generic way to do this. `fields` and `fieldpairs` iterators can only iterate over objects fields with the same types.
But you can probably do this at compile-time with a custom macro. Also see the relevant discussion at [#6215](https://forum.nim-lang.org/t/6215) for ideas.
