Typescript cannot find local es6 module; error TS2307: Cannot find module
<p>I am having a hard time getting typescript to recognize the shape of a local es6 module:</p>

<p><strong>convert-time.js</strong></p>

<pre><code>export const minutes = sec =&gt; sec * 60
export const hours = sec =&gt; minutes(sec) * 60
export const days = sec =&gt; hours(sec) * 24
export const weeks = sec =&gt; days(sec) * 24
export const years = sec =&gt; days(sec) * 365
</code></pre>

<p><em>Note: I would like to figure out how to get this to work without just changing <code>convert-time.js</code> to a typescript file.</em></p>

<p>Here is the file I am trying to import it into:</p>

<p><strong>index.ts</strong></p>

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

import { minutes, days } from '../test/helpers/convert-time'
</code></pre>

<p>Here is the type definition file I created:</p>

<p><strong>convert-time.d.ts:</strong></p>

<pre><code>declare module "convert-time" {
  export function minutes(sec: number): number;
  export function hours(sec: number): number;
  export function days(sec: number): number;
  export function weeks(sec: number): number;
  export function years(sec: number): number;
}
</code></pre>

<p>And here is my tsconfig:</p>

<p><strong>tsconfig.json</strong></p>

<pre><code>{
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitAny": false,
    "removeComments": true,
    "preserveConstEnums": true,
    "sourceMap": true,
    "jsx": "react"
  },
  "files": [
    "typings/index.d.ts",
    "typings/convert-time.d.ts"
  ],
  "exclude": [
    "node_modules"
  ]
}
</code></pre>

<p><strong>Steps tried:</strong></p>

<ul>
<li>Searched StackOverflow for <code>error TS2307: Cannot find module</code>. Most questions are regarding external modules which have type definitions. I couldn't find an example of a local module.</li>
<li>Read <a href="https://www.typescriptlang.org/docs/handbook/modules.html" rel="noreferrer">https://www.typescriptlang.org/docs/handbook/modules.html</a></li>
<li>Read <a href="https://www.typescriptlang.org/docs/handbook/module-resolution.html" rel="noreferrer">https://www.typescriptlang.org/docs/handbook/module-resolution.html</a></li>
<li>Added <code>typings/convert-time.d.ts</code> to the <code>files</code> section in <code>tsconfig.json</code>.</li>
<li>Added <code>/// &lt;reference path='../../typings/convert-time.d.ts' /&gt;</code> to <code>index.ts</code></li>
</ul>

<p>None of the above worked! What dark magic must I learn to get this to work? Thanks!</p>