title: How to export an array in typescript
body: <p>In an Angular4 app, I use a service to export some constants, enums and interfaces used all across the application. I'd like to export an array of strings whose keys are the keys in an anum. This is what I have right now:</p>
  
  <pre><code>export enum ContextMenus {
    ... (more options)
    OBJECT_COLOR_RED = 120,
    OBJECT_COLOR_GREEN = 121,
    OBJECT_COLOR_BLUE = 122
  }
  </code></pre>
  
  <p>I'd like to export an array of strings based on the values of the enum above, like this:</p>
  
  <pre><code>let ObjectStyles : string[];
  ObjectStyles[ContextMenus.OBJECT_COLOR_RED] = '#f00';
  ObjectStyles[ContextMenus.OBJECT_COLOR_GREEN] = '#0f0'
  ObjectStyles[ContextMenus.OBJECT_COLOR_BLUE] = '#00f';
  
  export ObjectStyles; // THIS IS WHAT I DON'T KNOW HOW TO WRITE
  </code></pre>
  
  <p>I've tried using <code>export default RulesStyles</code> as suggested in a forum, but when I try to import it from a component like this:</p>
  
  <pre><code>import { ContextMenus, ObjectStyles } from '../app-options.service';
  </code></pre>
  
  <p>The compiler complains that the module 'app-options.service has no exported member ObjectStyles'.</p>
  
  <p>Another proposed solution was to export ObjectStyles like this:</p>
  
  <pre><code>export { ObjectStyles };
  </code></pre>
  
  <p>In this case, the compiler doesn't complain, but the app crashes at runtime with the following error:</p>
  
  <pre><code>TypeError: ObjectStyles is undefined
  </code></pre>
  
  <p>How could I do what I want? Thanks!</p>