Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your <code>server.ts</code> dependencies need to be modules that export their surface area with top-level <code>export</code> directives, and <code>server.ts</code> should load them using <code>import</code> directives. The root cause here is that TypeScript has two different sorts of universes for compilation.</p> <p>The first is the default one that you'd use for regular webpages, where some simple loader takes 1 or more source files in some fixed order and executes them in that order, and you're on your own for dependency ordering. This is called "<em>program</em>" compilation. In program compilation, you might do side-by-side compilation (a.ts => a.js, b.ts => b.js), or you might do concatenated compilation using <code>--out</code> ((a.ts + b.ts) => out.js).</p> <p>In <em>program</em> compilation, you refer to your references using <code>///&lt;reference&gt;</code> tags. If those references are to source files (<code>.ts</code>), they'll get concatenated in to the output if using <code>--out</code>, or emitted as a side-by-side <code>.js</code> file otherwise. If those references are to a declaration file (<code>.d.ts</code>), you're basically saying you will be getting definitions for those files loaded via the external loader (i.e. a <code>&lt;script&gt;</code> tag in the browser).</p> <p>The second is the kind of compilation you'd use for node.js or other environments that do asynchronous or idempotent module loading with runtime dependency resolution. This called "<em>module</em>" compilation. Here, the <code>--module</code> flag you pass to <code>tsc</code> matters, and the only valid thing to do is side-by-side compilation, because loading a single file as a module is (generally) how the module loaders in node.js, etc work.</p> <p>In <em>module</em> compilation, you use the <code>export</code> keyword on a top-level object (function, class, module, interface, or var) to control what's available to code that refers to you using <code>import</code>. You should only ever have <code>/// &lt;reference&gt;</code> tags that point to <code>.d.ts</code> declaration files, because the module-based runtime loaders don't have a notion of loading a naked JS file. You won't compile with <code>--out</code>.</p> <p>You <strong>never</strong> want to mix and match these compilation modes, because it simply is not going to work. In fact, in 0.8.2.0, <code>tsc</code> will simply issue an error if you try to do this.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload