title: Get all the values of a namespace in Typescript?
body: <p><strong>Node Version:</strong> 6.11.3</p>
  
  <p><strong>Typescript Version:</strong> 2.1.6</p>
  
  <p>We have a bunch of enums in our project that mostly look like this:</p>
  
  <pre><code>export type ThingType = "thing1" | "thing2";
  
  export namespace ThingType {
      export const THING_ONE = "thing1";
      export const THING_TWO = "thing2";
  }
  </code></pre>
  
  <p>I want to expose these values in an endpoint for consumers of the endpoints that require these string values. So I've made an endpoint that looks like this:</p>
  
  <pre><code>const enums = {
      thingType: ThingType,
      ...
  }
  </code></pre>
  
  <p>Which returns json looking like:</p>
  
  <pre><code>"data": {
      "thingType": {
          "THING_ONE": "thing1",
          "THING_TWO": "thing2"
      }
  }
  </code></pre>
  
  <p>I want it to be output like:</p>
  
  <pre><code>"data": {
      "thingType": ["thing1", "thing2"]
  }
  </code></pre>
  
  <p>For a plain javascript object, that would be fairly easy, I'd just add <code>values()</code> to the end of <code>ThingType</code> in my endpoint. But <code>values()</code> does not exist on namespaces or enums in TS. I haven't found anything in the <a href="https://www.typescriptlang.org/docs/handbook/namespaces-and-modules.html" rel="nofollow noreferrer">docs on namespaces in Typescript</a> but I feel there's gotta be something that would let me get the enum values easily. </p>