TypeScript enum to object array : <p>I have an enum defined this way:</p>

<pre><code>export enum GoalProgressMeasurements {
    Percentage = 1,
    Numeric_Target = 2,
    Completed_Tasks = 3,
    Average_Milestone_Progress = 4,
    Not_Measured = 5
}
</code></pre>

<p>However, I'd like it to be represented as an object array/list from our API like below:</p>

<pre><code>[{id: 1, name: 'Percentage'}, 
 {id: 2, name: 'Numeric Target'},
 {id: 3, name: 'Completed Tasks'},
 {id: 4, name: 'Average Milestone Progress'},
 {id: 5, name: 'Not Measured'}]
</code></pre>

<p>Is there are easy and native way to do this or do I have to build a function that casts the enum to both an int and a string, and build the objects into an array?</p>
