'How I can convert TypeScript type?

I have the code

interface IProps {
  name: string;
  age: number;
}

I want to get

type Result = {
  key: 'name',
  value: string
} | {
  key: 'age',
  value: number
}

Is there any good way?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source