title: Mongoose Import for TypeScript Doesn't Work
body: <p>New to Node and Typescript.  I am getting an error that mongoose.connect is not a function when I run tsc.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>import express = require('express');
  import * as mongoose from "mongoose";
  
  /** Routes for the app */
  import apiUserRouter from "./api/user"
  
  class App{
  
     public express :express.Application
  
  
      constructor() {
          this.express = express()
          this.setupDb();
      }
  
      private setupDb() : void {
          var mongoDb = 'mongodb://127.0.0.1/my_database';
          mongoose.connect(mongoDb);
          var db = mongoose.connection;
          db.on('error', console.error.bind(console, 'MongoDB Connection error'));
      }
  }
  </code></pre>
  
  <p>If I change</p>
  
  <pre><code>import * as mongoose from "mongoose"
  </code></pre>
  
  <p>to</p>
  
  <pre><code>import mongoose = require('mongoose');
  </code></pre>
  
  <p>Then everything works fine.</p>
  
  <p>I have run the following npm command for types as my understanding is that this should have fixed the issue. </p>
  
  <pre><code>npm install @types/mongoose --save
  </code></pre>
  
  <p>Edit: Adding my packages.json</p>
  
  <pre><code>{
      "name": "nodejs-ts-test2",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
          "test": "echo \"Error: no test specified\" &amp;&amp; exit 1"
      },
      "author": "",
      "license": "ISC",
      "devDependencies": {
          "@types/express": "^4.11.1",
          "@types/mongoose": "^5.0.3",
          "typescript": "^2.7.2"
      },
      "dependencies": {
          "express": "^4.16.2",
          "mongoose": "^5.0.7"
      }
  }
  </code></pre>
  
  <p>and tsconfig.json:</p>
  
  <pre><code>{
      "compilerOptions": {
          "target": "es2015",
          "module": "commonjs",
          "outDir": "dist",
          "strict": true,
          "noImplicitAny": false,
          "esModuleInterop": true,
          "allowSyntheticDefaultImports": true
      }
  }
  </code></pre>