title: How to use paths in tsconfig for a single module?
body: <p>This question is a follow-on from <a href="https://stackoverflow.com/q/43281741/49942">How to use paths in tsconfig.json?</a> except I want to do it for a single module.</p>
  
  <p>I have a module:</p>
  
  <ul>
  <li>It's implemented in <code>src/functions/foo.ts</code></li>
  <li><p>Its contents are:</p>
  
  <pre><code>export default interface Bar {
  }
  </code></pre></li>
  <li><p>It's imported by another module elsewhere using a non-relative path:</p>
  
  <pre><code>import * as Foo from "foo"
  </code></pre></li>
  </ul>
  
  <p>The compiler doesn't find it:</p>
  
  <pre><code>error TS2307: Cannot find module 'foo'
  </code></pre>
  
  <hr>
  
  <p>This tsconfig doesn't fix that problem ...</p>
  
  <p><code>
  {
      "compilerOptions": {
          "noEmit": true,
          "strict": true,
          "module": "commonjs",
          "target": "es2017",
          "noImplicitAny": true,
          "moduleResolution": "node",
          "sourceMap": true,
          "outDir": "build",
          "baseUrl": ".",
          "paths": {
              "foo": ["src/functions/*"],
              "*": [
                  "node_modules/*"
              ]
          }
      },
      "include": [
          "./src/**/*", "./typings/**/*", "./test/**/*", "./test-integration/**/*"
      ]
  }
  </code></p>
  
  <p>... but this does:</p>
  
  <p><code>
          "paths": {
              "*": [
                  "node_modules/*",
                  "src/functions/*"
              ]
          }
  </code></p>
  
  <hr>
  
  <p>Why didn't the first version of <code>paths</code> work --- what was I doing wrong, what can I do to ensure that <code>"src/functions/*"</code> is used only when importing <code>foo</code> (and not when importing <code>*</code>)?</p>
  
  <p>(I'm using tsc version 3.1.6 on Windows with Node.js).</p>