TypeScript Type Transformation with Schema Encoding and Decoding
what is the correct way to do the following, I am trying to replace the original
rarity object with a string and adding a color string. However, when encoding back, I merge these back into the rarity object. But TypeScript isn't sure that this reconstructed object matches the original A's rarity structure, especially if 'A' has more properties in rarity than just name and color, and surely the following is not correctly done, so what is the right way?