title: Add fallback typings only of untyped modules
body: <p>I inherited a TypeScript project which uses some JavaScript dependencies which happen to not have any <code>@types</code> package available.</p>
  
  <p>I managed to write the typings for some of the modules, but right now I don't have enough time to do that for all modules.</p>
  
  <p>My current <code>tsconfig.json</code> uses the strict mode, so I have a problem when importing untyped modules:</p>
  
  <pre><code>&gt; Could not find a declaration file for module 'unfluff'. 
  &gt;     '[...]/node_modules/unfluff/lib/unfluff.js' implicitly has an 'any' type.
  </code></pre>
  
  <p>After poking around for a bit, I found this <a href="https://github.com/Microsoft/TypeScript/issues/13348" rel="nofollow noreferrer">issue</a> on TypeScript's Github.</p>
  
  <p>Then I created a file on my <code>src/types</code> directory with the following content:</p>
  
  <pre><code>declare module 'unfluff' {
      var _a: any;
      export = _a;
  }
  </code></pre>
  
  <p>However, since I have several modules with this problem, it would be very tedious having to write a new typings file for each one of them and any other I'd happen to need in the future.</p>
  
  <p>So I tried to create a <em>catch all</em> module as suggested in the same issue discussion:</p>
  
  <pre><code>// src/types/fallback.d.ts
  declare module '*' {
      var _a: any;
      export = _a;
  }
  </code></pre>
  
  <p>The problem now is that all typings declared in this <code>src/types</code> folder are ignored. For example, I've added typings for <code>ipfs-http-client</code> in that directory. <strong>After</strong> I created the <code>fallback.d.ts</code> file, when I do:</p>
  
  <pre><code>import ipfs, { IpfsClient } from 'ipfs-http-client';
  </code></pre>
  
  <p>Then I get the following error:</p>
  
  <pre><code>&gt; 2305[QF available]: Module '"*"' has no exported member 'IpfsClient'.
  </code></pre>
  
  <p>If I remove the <code>fallback.d.ts</code>, the import above works again, but then I'm stuck in the original problem.</p>
  
  <p>Is there a way of having a true <em>fallback</em> typing only for untyped modules?</p>
  
  <p>One caveat is that the packages are unrelated to each other, so is not something that can be solved with pattern matching:</p>
  
  <pre><code>declare module 'some-scope-*' {
      var _a: any;
      export = _a;
  }
  </code></pre>
  
  <h2>Edit:</h2>
  
  <p>If it is worth something, here's my <code>tsconfig.json</code>:</p>
  
  <pre><code>{
    "compilerOptions": {
      "composite": true,
      "declaration": true,
      "declarationMap": true,
      "sourceMap": true,
      "strict": true,
      "target": "es6",
      "module": "commonjs",
      "allowJs": false,
      "checkJs": false,
      "esModuleInterop": true,
      "experimentalDecorators": true,
      "emitDecoratorMetadata": true,
      "rootDir": "src",
      "outDir": "dist",
    },
    "include": [
      "src/**/*.ts"
    ],
    "exclude": [
      "node_modules",
      "**/*.test.ts"
    ],
    "lib": [
      "es6",
      "es2015",
      "dom"
    ],
    "typeRoots": [
      "node_modules/@types",
      "./src/types"
    ]
  }
  </code></pre>