Sequelize under Angular2 w/ Typescript
<p>I'm brand new to Angular and just getting started on getting my head wrapped around how it works. Please, Internet, be gentle...</p>

<p>I've completed the Angular2 5 min Quickstart through Tour of Heroes and have that working without an issue. Now I'm trying get connectivity to my local MS SQL server as I have a SQL-based project coming where Angular2 is the required platform. I've been banging my head against the wall for days on getting Sequelize to work and could really use some help.</p>

<p>What I've done so far based on different things I've read:</p>

<ul>
<li>Used npm to install sequelize and verified that sequelize and the dependencies of lodash, bluebird and validator all exist under node_modules</li>
<li>Downloaded bluebird.d.ts, lodash.d.ts, sequelize.d.ts and validator.d.ts from the DefinitelyTyped project on GitHub and put them in my typings folder</li>
<li>In tsConfig.json, I changed the compilerOptions --> target from es5 to es6</li>
<li>Created a simple db.component.ts file (see below)</li>
<li>Updated app.component.ts to import the db.component and added a route to it</li>
</ul>

<p>At this point the simple page comes up, but I am unable to figure out how to get Sequelize working.</p>

<p>Script errors I'm seeing (based on using Visual Studio Code as my editor):</p>

<ul>
<li>When I open sequelize.d.ts, there is an error on the line '<em>declare module "sequelize" {</em>' stating that "Ambient modules cannot be nested other modules"</li>
<li>When I open lodash.d.ts, there are errors on lines 239 and 240 (the underscores) that states "<em>Duplicate Identifier '_'</em>"</li>
</ul>

<p>I've tried a number of different approaches (guesses) on how to get sequelize to connect to my database and just cannot get anything to work. I understand that I need either (both?) an import and/or a require in the db.component.ts file, but only end up with errors either in the IDE as bad syntax or in the browser (Chrome).</p>

<p>I do understand that in the long run, my route/config/etc that I'm testing with here is not going to be the "right" way to do it, but I just need to get past the basic proof-of-concept that I can do something with the database before I re-engineer it (e.g. - can I connect to the database and query a table)</p>

<p><strong>app.component.ts</strong></p>

<pre><code>import { Component }            from 'angular2/core';
import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from 'angular2/router';

import { DashboardComponent }   from './dashboard.component';
import { HeroService }          from './hero.service';
import { HeroesComponent }      from './heroes.component';
import { HeroDetailComponent }  from './hero-detail.component';

import { dbComponent }          from './db.component';

@Component({
    selector: 'my-app',
    template: `
        &lt;h1&gt;{{title}}&lt;/h1&gt;
        &lt;nav&gt;
            &lt;a [routerLink]="['Dashboard']"&gt;Dashboard&lt;/a&gt;
            &lt;a [routerLink]="['Heroes']"&gt;Heroes&lt;/a&gt;
        &lt;/nav&gt;
        &lt;router-outlet&gt;&lt;/router-outlet&gt;
    `,
    styleUrls: ['app/app.component.css']
    directives: [ROUTER_DIRECTIVES],
    providers: [
        ROUTER_PROVIDERS,
        HeroService
    ]
})

@RouteConfig([
    {
        path: '/dashboard',
        name: 'Dashboard',
        component: DashboardComponent,
        useAsDefault: true
    },
    {
        path: '/heroes',
        name: 'Heroes',
        component: HeroesComponent
    },
    {
        path: '/detail/:id',
        name: 'HeroDetail',
        component: HeroDetailComponent
    },
    {
        path: '/sql',
        name: 'SqlTest',
        component: dbComponent
    }   
])

export class AppComponent {
  title = 'Sample App';
}
</code></pre>

<p><strong>db.component.ts</strong></p>

<pre><code>/// &lt;reference path="../typings/sequelize.d.ts" /&gt;

import { Component, OnInit }            from 'angular2/core';
import Sequelize = require('sequelize');  &lt;-- I dont know if this is doing anything

//- This just errors out with require not being found (tds@latest installed)
//var Sequelize = require("sequelize");

//- I know this goes somewhere, but I have no idea where
//var sql = new Sequelize('dbName', 'uName', 'pw', {
//  host: "127.0.0.1",
//  dialect: 'mssql',
//  port: 1433 &lt;-- SqlExpress
//});

@Component({
    selector: 'my-sql',
    template:`
        &lt;h1&gt;SQL Test&lt;/h1&gt;
    `
})

export class dbComponent implements OnInit {

    constructor(
    ) { }

    auth() {
        console.log('auth');
        //sql.authenticate().then(function(errors) { console.log(errors) });
    }

    ngOnInit() {
        console.log('onInit');
        this.auth();
    }
}
</code></pre>

<p>My console.log message are coming up so I believe that I have the core functionality basically working, but I'm at a loss on what I need to do to get Sequelize functional.</p>

<p>There's a piece of the puzzle that I'm missing and I'm at my wits end on this. Thanks in advance for any direction...</p>