Typescript enum, used from implementation and interfaces
<p>I have the following, in CommandEnum.ts: </p>

<pre><code>export enum CommandEnum {
    createProject,
    renameProject,
    hablaBabla
}
</code></pre>

<p>in a module which I am able to reference from implementation code, using </p>

<pre><code>import {CommandEnum} from '../server/contracts/CommandEnum'

let x = CommmandEnum.hablaBabla
</code></pre>

<p>The enum file is compiled into a javascript function with export logic, in CommandEnum.js.</p>

<p>This now works fine, but I want to reference this enum in my interfaces as well, I try:</p>

<pre><code>/// &lt;reference path="../contracts/CommandEnum.ts" /&gt;
namespace ValueTypes {

    export interface Command {
        type : CommandEnum;
        referenceId : string;
    }
}
</code></pre>

<p>Now, this reference does not import the CommandEnum type, but some of the other combinations of modules / namespace / export default I have tried does.  <strong>I can get the reference syntax to work, but not the module syntax and the other way around - but not both.</strong></p>

<p>Is this actually possible? Using an enum from a pure definitions interface file seems like a very common scenario. But when the interface is implemented the enum must be available in "function form" and these two models does not seem to combine?</p>

<p>I had the same problem with classes, which I wanted to namespace, .Net-style - which I had to give up. Classes, however, are not referenced in my interfaces - enums are.</p>

<p>I work with node.js and compile to individual files, not a single concated output.</p>