title: Can't resolve type declarations despite having found the type declarations
body: <p>When I run <code>tsc</code> on my project, it reports</p>
  
  <pre><code>src/app/home-behavior.ts(8,30): error TS7016: Could not find a declaration file for module 'jqueryui'. 'C:/myProjectPath/src/lib/jquery-ui/jquery-ui.js' implicitly has an 'any' type.
  Try `npm install @types/jqueryui` if it exists or add a new declaration (.d.ts) file containing `declare module 'jqueryui';`
  </code></pre>
  
  <p>But I already have @types/jqueryui installed, and <code>tsc --traceResolution</code> even shows</p>
  
  <pre><code>======== Resolving type reference directive 'jqueryui', containing file 'C:/myProjectPath/__inferred type names__.ts', root directory 'C:/myProjectPath/node_modules/@types'. ========
  Resolving with primary search path 'C:/myProjectPath/node_modules/@types'.
  Found 'package.json' at 'C:/myProjectPath/node_modules/@types/jqueryui/package.json'.
  'package.json' does not have a 'typings' field.
  'package.json' does not have a 'types' field.
  File 'C:/myProjectPath/node_modules/@types/jqueryui/index.d.ts' exist - use it as a name resolution result.
  Resolving real path for 'C:/myProjectPath/node_modules/@types/jqueryui/index.d.ts', result 'C:/myProjectPath/node_modules/@types/jqueryui/index.d.ts'.
  ======== Type reference directive 'jqueryui' was successfully resolved to 'C:/myProjectPath/node_modules/@types/jqueryui/index.d.ts', primary: true. ========
  </code></pre>
  
  <p>So it resolved the definition but still can't find the definition?</p>
  
  <hr>
  
  <p>Typescript version 2.4.1. Using AMD-style loading with requirejs. My jquery-ui typings are from npm module <code>@types/jqueryui</code>. My directory structure is</p>
  
  <pre><code>projectroot
  + src
  | + app
  | | + home-behavior.ts
  | + lib
  |   + jquery
  |   | + dist
  |   |   + jquery.js
  |   + jquery-ui
  |     + jquery-ui.js
  + node_modules
  | + @types
  |   + jquery
  |   | + index.d.ts
  |   + jqueryui
  |     + index.d.ts
  + tsconfig.json
  </code></pre>
  
  <p>My tsconfig.json is</p>
  
  <pre><code>{
    "compilerOptions": {
      "alwaysStrict": true,
      "baseUrl": ".",
      "lib": [ "es2015", "dom" ],
      "module": "commonjs",
      "moduleResolution": "classic",
      "noEmit": true,
      "noImplicitAny": true,
      "paths": {
        "jqueryui": [
          "src/lib/jquery-ui/jquery-ui.js"
        ],
        "*": [
          "src/lib/*"
        ]
      },
      "sourceMap": false,
      "strictNullChecks": true,
      "target": "es5"
    },
    "include": [
      "src/app"
    ]
  }  
  </code></pre>
  
  <p>The reference in home-behavior.ts is</p>
  
  <pre><code>import { Autocomplete } from "jqueryui";
  </code></pre>
  
  <p>(Originally I referred to the module as "jquery-ui/jquery-ui", but since tsc was already resolving "jqueryui" I changed the module name to match, on the theory that that would help.)</p>