Implement ReplaceKeys for union objects
Build ReplaceKeys<U, T, Y> that replaces keys T across each union member U according to mapping Y, preserving other fields.
Example:
Input: value = 42
Output: 42
Write a clean implementation and validate it with the provided test cases.
Examples:
Input 1:
{"value":1}Output 1:
1Input 2:
{"value":42}Output 2:
42Loading editor...
Run your code to see results
Click the Run button above