TypeScript custom declaration files for untyped npm modules : <p>I am consuming a React component called <a href="https://github.com/bsidelinger912/shiitake" rel="noreferrer">shiitake</a> from npm into my project where I use TypeScript. That library does not have TypeScript declarations so I thought I would write one. The declaration file looks like below (it may not be complete but don't worry about it too much):</p>

<pre><code>import * as React from 'react';

declare module 'shiitake' {

    export interface ShiitakeProps {
        lines: number;
    }

    export default class Shiitake extends React.Component&lt;ShiitakeProps, any&gt; { 
    }
}
</code></pre>

<p>I have put this inside <code>./typings/shiitake.d.ts</code> file and on VS Code, I am seeing the below error:</p>

<blockquote>
  <p>[ts] Invalid module name in augmentation. Module 'shiitake' resolves to an untyped module at 'd:/dev/foo/foobar.foo.Client.Web/node_modules/shiitake/dist/index.js', which cannot be augmented.</p>
</blockquote>

<p>On the consumption side, I am still getting the same error even if with the above declaration (since I have <code>noImplicitAny</code> compiler switch turned on):</p>

<pre><code>/// &lt;reference path="../../../../typings/shiitake.d.ts" /&gt;
import * as React from 'react';
import Shiitake from 'shiitake';
</code></pre>

<blockquote>
  <p>[ts] Could not find a declaration file for module 'shiitake'. 'd:/dev/foo/foobar.foo.Client.Web/node_modules/shiitake/dist/index.js' implicitly has an 'any' type.</p>
</blockquote>

<p>The standard why of acquiring declaration files for this type of modules is through <a href="https://blog.mariusschulz.com/2016/10/23/typescript-2-0-acquiring-type-declaration-files" rel="noreferrer"><code>@types/</code> way</a> and it works well. However, I cannot get the custom typings work. Any thoughts?</p>
