title: Typescript - import declarations in an internal module cannot reference an external module
body: <p>Whilst practicing TypeScript in VSCode, developing a Todo application, attempting to import the "todo" module, the vscode intellisense generates an error: 
  <strong>import declarations in an internal module cannot reference an external module</strong>
  The console also throws an error also: <strong>"TodoApp is not defined"</strong></p>
  
  <p>Please can anyone help? I presume the structure is incorrect, but cant seem to correct it. Ultimately my aim is to have the .ts files, preferably all compile into one js file "testApp.js".</p>
  
  <p>Heres my code:</p>
  
  <p>task.ts</p>
  
  <pre><code>module TodoApp {
  
      export enum TaskType { FrontEnd, BackEnd, Designer };
  
      interface Itask {
          Name: string;
          Description: string;
          TaskType: TaskType;
          Completed: boolean;
      }
  
      export class Task implements Itask {
          Name: string;
          Description: string;
          Completed: boolean = false;
          TaskType: TaskType;
  
          constructor(Name: string, Description: string, TaskType: TaskType) {
              this.Name = Name;
              this.Description = Description;
              this.TaskType = TaskType;
          } 
  
      }
  
  }
  </code></pre>
  
  <p>todo.ts</p>
  
  <pre><code>    ///&lt;reference path="task.ts" /&gt;
  ///&lt;reference path="../typings/jquery/jquery.d.ts" /&gt;
  
  module TodoApp {
      "use strict"
  
      interface IJson {
  
      }
  
      interface ITaskManager { 
          Tasks: Task[];
          GetTasks(t: any[]): void;
          AddTask(t: Task): void;
          UpdateTask(n: string, d: string, tt: TaskType): void;
          DeleteTask: {
              (i: number): void;
              (i: Task): void;
          }
      }
  
      export class TaskManager implements ITaskManager {
  
          public Tasks = new Array&lt;Task&gt;();
  
          constructor() {
  
          }
  
          GetTasks(d: any[]) { 
          }
  
          public AddTask(_task: Task) {
              this.Tasks.push(_task);
          }
  
          UpdateTask(_name: string, _desc: string, _taskType: TaskType) {
          }
  
          DeleteTask(i: any) {
              if (typeof i === typeof Task) {
                  //delete object
  
              } else {
                  //delete task of index
  
              }
          }
  
      }
  }
  </code></pre>
  
  <p>testApp.ts</p>
  
  <pre><code>module TestApp {
  
      import TodoApp = require("todo"); ///&lt;&lt; error occurs here
  
      export class ControlTodoApp { 
  
          static Start() {
  
              window.onload = function(e) {
                  var tm = new TodoApp.TaskManager();
                  var task = new TodoApp.Task("MyTask", "Task Description", TodoApp.TaskType.Designer);
                  tm.AddTask(task);
  
                  console.log(tm.Tasks);
              }
  
          }
      }
  }
  
  
  
  var ca = new TestApp.ControlTodoApp.Start();
  </code></pre>
  
  <p>index.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt; 
  &lt;div class="container"&gt; 
      &lt;div class="inner"&gt;
          &lt;div class="img-cont"&gt;
              &lt;img src="assets/images/myimg.png" alt="my img" /&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="content"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script src="assets/js/default/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="assets/js/ts/testApp.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>