Objects from file compiled with angular2 can't be found by other files during compilation
<p><strong>Background</strong></p>

<p>I'm converting a decent-sized project from Angular 1.3 to Angular 2. I'm using Visual Studio 2015 Update 2 as my builder, including NPM for the package management. I'm not using Gulp, and have no plans to convert to it, because I'm updating this project piecemeal.</p>

<p>The original layout of the project was a top-level Typescript project, plus several child Typescript projects. As part of the update, I deleted all of the child project files, included everything under the top-level project, and used tsconfig files to break up the compilation into separate segments. (This part worked fine, and the website works just like it did before I put everything under the top-level project.)</p>

<p>I'm using Visual Studio 2015 Update 2, a Nuget package of Typescript 1.8, and ReSharper Ultimate 2016.1.2</p>

<p><strong>The Problem</strong></p>

<p>My problem is with using the UpgradeAdapter (on advice from <a href="http://blog.thoughtram.io/angular/2015/10/24/upgrading-apps-to-angular-2-using-ngupgrade.html" rel="nofollow">here</a>). I started by adding this to the top of the bootstrapping file (angularengine.ts in my project): </p>

<pre><code>import { UpgradeAdapter } from "@angular/upgrade";
</code></pre>

<p>When compiling, I immediately get errors &ndash; but <em>not</em> from the file I edited! Instead, any other file that references classes/interfaces from angularengine.ts can't find those classes. The errors are coming from the compiler, and they look like this: </p>

<pre><code>CommonControls/1.1.0/js/controls/measurechartcontrol.ts(83,39): error TS2304: Cannot find name 'AngularWatcherCallback'.
CommonControls/1.1.0/js/core/bootstrap.ts(45,71): error TS2339: Property 'AngularEngine' does not exist on type 'typeof Web'.
mc.common/1.0.0/js/common.ts(8,39): error TS2304: Cannot find name 'AngularEngine'.
</code></pre>

<p>Note that there are zero errors about compiling angularengine.ts itself - it just can't be found elsewhere. I've tried running tsc.exe from the command line and gotten exactly the same results - no errors inside angularengine.ts, errors finding its classes.</p>

<p>(The class is Domain.Web.AngularEngine, the interface is Domain.Web.AngularWatcherCallback.)</p>

<p>Again: my main problem is that this <strong>will not compile via tsc</strong>. I'm aware that I still need to include the various scripts in the HTML.</p>

<p><strong>More Detailed Configuration</strong></p>

<p>Here's the tsconfig.json. (Typings/commoncontrols has a manually-created .d.ts file used by other projects; it's omitted to avoid duplicate identifiers. TypescriptModules is where those other projects live.)</p>

<pre><code>{
  "compileOnSave": true,
  "compilerOptions": {
    "target": "es5",
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "wwwroot",
    "TypescriptModules",
    "Typings/commoncontrols"
  ]
}
</code></pre>

<p>package.json (a clone of the <a href="https://angular.io/docs/ts/latest/quickstart.html" rel="nofollow">Angular 2 Quickstart</a>, minus the tasks &amp; dev-dependencies, which are handled by Visual Studio 2015 Update 2 plus a Nuget package of Typescript 1.8.):</p>

<pre><code>{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/forms": "0.2.0",
    "@angular/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/router": "3.0.0-beta.1",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.4",
    "systemjs": "0.19.27",
    "core-js": "^2.4.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12",
    "angular2-in-memory-web-api": "0.0.14",
    "bootstrap": "^3.3.6"
  }
}
</code></pre>

<p>Summary of angularengine.ts (It's creating a simplified interface to Angular watches):</p>

<pre><code>import { UpgradeAdapter } from "@angular/upgrade"; // The mere *existence* of this line means the classes in this file cannot be found.
module Domain.Web {
    export class AngularEngine {
        private appName = "uifxApp";
        private controllerName = "uifxController";
        private app: any = null;
        constructor(otherModules: string[]) {
            this.app = angular.module(this.appName, otherModules);

            this.app.controller(this.controllerName, ["$scope", function ($scope: any) {
                $scope.$mcConfigs = $mcConfigs;
                $scope.$mcConfigs.$page = (&lt;any&gt;Domain.Web).Page;
            }]);
        }
        public Initialize(callback: Function) {
            var elem = document.body;
            elem.setAttribute("ng-controller", this.controllerName);

            $.when(angular.bootstrap(elem, [this.appName])).done($.proxy(function () {
                 // do more stuff
            });
        }
    }
    export interface AngularWatcherCallback {
        (newVal: string,
            oldVal?: string,
            path?: string[],
            expression?: string): void
    }
}
</code></pre>

<p>Summary of bootstrap.ts, which uses the AngularEngine class after the Domain and Domain.Web objects get created:</p>

<pre><code>///&lt;reference path="./angularengine.ts"/&gt;     // It's in the same directory.
$(document).ready(function() {
    var callback = function() {
        var renderer = new Domain.Web.RenderEngine();
        renderer.renderAll();
    }

    Domain.Web.angularEngineInstance = new Domain.Web.AngularEngine();
    Domain.Web.angularEngineInstance.Initialize(callback);
});
</code></pre>

<p><strong>What I've tried</strong></p>

<ol>
<li>Switching the module around in tsconfig.json. commonjs, umd, amd, and system all have the same problem. (es6 and es2015 both tell me that I can't compile with ES5 and expect to use ES6 modules, which I find perfectly reasonable.)</li>
<li>Actually using the UpgradeAdapter to bootstramp Angular. Adding more code doesn't help.</li>
<li>Fiddling with the <code>&lt;reference&gt;</code> nodes in other files. "./angularengine.ts", "angularengine.ts", removing the references, etc.</li>
<li>Reading some other answers about "cannot find module angular2/core", which I had earlier but is now working correctly since I fixed the tsconfig.</li>
</ol>

<p>Is there something I'm missing about how imports work in TypeScript 1.8, that changes something significant about how other files are linked?</p>