title: Use enum with TypeScript, with methods on each enumeration
body: <p>I have this TypeScript file:</p>
  
  <pre><code>export type TSumanToString = () =&gt; string;
  
  export interface ISumanEvent {
    explanation: string,
    toString: TSumanToString
  }
  
  export interface ISumanEvents{
    [key: string]: ISumanEvent
  }
  
  export const events: ISumanEvents = Object.freeze({
  
    // runner events
    TEST_FILE_CHILD_PROCESS_EXITED: {
      explanation: 'runner is started, fires before any test child processes are started.',
      toString: makeToString('TEST_FILE_CHILD_PROCESS_EXITED')
    },
  
    RUNNER_EXIT_CODE: {
      explanation: 'runner is started, fires before any test child processes are started.',
      toString: makeToString('RUNNER_EXIT_CODE')
    },
  
    RUNNER_EXIT_SIGNAL: {
      explanation: 'runner is started, fires before any test child processes are started.',
      toString: makeToString('RUNNER_EXIT_SIGNAL')
    },
  
    RUNNER_HIT_DIRECTORY_BUT_NOT_RECURSIVE: {
      explanation: 'runner is started, fires before any test child processes are started.',
      toString: makeToString('RUNNER_HIT_DIRECTORY_BUT_NOT_RECURSIVE')
    },
  
    RUNNER_EXIT_CODE_IS_ZERO: {
      explanation: 'runner is started, fires before any test child processes are started.',
      toString: makeToString('RUNNER_EXIT_CODE_IS_ZERO')
    },
  
    RUNNER_TEST_PATHS_CONFIRMATION: {
      explanation: 'runner is started, fires before any test child processes are started.',
      toString: makeToString('RUNNER_TEST_PATHS_CONFIRMATION')
    },
  
    // there are a lot more entries
  
  })
  </code></pre>
  
  <p>this produces a .d.ts file like so:</p>
  
  <pre><code>export declare type TSumanToString = () =&gt; string;
  export interface ISumanEvent {
      explanation: string;
      toString: TSumanToString;
  }
  export interface ISumanEvents {
      [key: string]: ISumanEvent;
  }
  export declare const events: ISumanEvents;
  </code></pre>
  
  <p>but I need to include each property on events as a constant or an enumeration. I could use an interface to do that, but that would require me to duplicate everything, which seems like a waste.</p>
  
  <p>In other words, I <strong>don't want</strong> to do this, because this simply duplicates what's in my const, which is a waste, and could easily become out-of-sync:</p>
  
  <pre><code>export interface ISumanEvents {
  
    TEST_FILE_CHILD_PROCESS_EXITED: ISumanEvent,
    RUNNER_EXIT_CODE: ISumanEvent,
    RUNNER_EXIT_SIGNAL: ISumanEvent,
    RUNNER_HIT_DIRECTORY_BUT_NOT_RECURSIVE: ISumanEvent;
    RUNNER_EXIT_CODE_IS_ZERO: ISumanEvent,
    RUNNER_TEST_PATHS_CONFIRMATION: ISumanEvent
  
  }
  </code></pre>
  
  <p><em>is there a way to create a enum so that I don't have to create an interface that just duplicates everything in the actual object?</em></p>
  
  <p><em>The problem is I don't know how to define methods on an enum.</em></p>