Typescript compile errors when importing C3 and D3
<p>I am playing with the graphing library <code>C3</code> in an Ionic2/Angular2 typescript project. I have installed <code>C3</code> via <code>npm</code>, and the type definitions via <code>tsd</code>.</p>

<p>I have imported when into my own ts file as follows..</p>

<pre><code>import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import * as C3 from 'c3';
import * as D3 from 'd3';

@Component({
   templateUrl: 'build/pages/graphs-page/graphs-page.html'
 ....
})
</code></pre>

<p>All appears fine. I can see the typings for the C3 (and dependant D3), and also when I run everything seems to work.</p>

<p>However, when the application builds (when I run <code>ionic serve</code>), I always get the following typescript compile errors...</p>

<pre><code>TypeScript error: D:/dev/ionic2/testcomonents/app/pages/graphs-page/graphs-page.ts(3,21): Error TS2307: Cannot find module 'c3'.
TypeScript error: D:/dev/ionic2/testcomonents/app/pages/graphs-page/graphs-page.ts(4,21): Error TS2307: Cannot find module 'd3'.
</code></pre>

<p>Does anyone have any ideas why I am getting these errors at build time, when I get no errors in the IDE (I am using <code>vscode</code>), and everything seems to work fine?</p>

<p>[EDIT]</p>

<p>I have since installed typescipt 2 and run with the <code>--traceResolution</code> flag. I can see that <code>tsc</code> only seems to look under various levels of <code>node_modules</code> and never looks under <code>typings</code> folder, which is where <code>vscode</code> is looking.</p>

<p>More confusing (to me) is how the c3.js source is included, when this is located under the node_modules/c3 folder. I have not specifically added any reference to <code>c3.js</code>, yet the graphs show up.</p>

<p>The settings in the <code>tsconfig.json</code> are</p>

<pre><code>{
   "compilerOptions": {
   "target": "es5",
   "module": "commonjs",
   "emitDecoratorMetadata": true,
   "experimentalDecorators": true
 },

"filesGlob": [
   "**/*.ts",
   "!node_modules/**/*"
 ],
 "exclude": [
   "node_modules",
   "typings/main",
   "typings/main.d.ts"
  ],
 "compileOnSave": false,
 "atom": {
   "rewriteTsconfig": false
 }
}
</code></pre>

<p>I have tried various edits in the above <code>tsconfig.json</code> but cannot get it to look in the typings folder.</p>

<p>So my questions now become</p>

<ol>
<li>How to make Typscript look in the typings folder</li>
<li>How does the the actual c3.js file located at node_modules\c3\c3.js get included in the Ionic bundle (since I have not added a reference to it anywhere)</li>
</ol>