title: TS6137: Cannot import type declaration files when importing from @types
body: <p>I am working on lets say <strong>package A</strong> that is intended to be used in another <strong>package B</strong> (sort of as a plugin) but my <strong>package A</strong> depends on the types defined in <strong>package B</strong>. I am using Typescript 4.3.4</p>
  <p>My initial thought was to import just the types from <strong>package B</strong> into <strong>package A</strong> but that presented me with the following problem:</p>
  <ol>
  <li><p>I installed types to <code>node_modules/@types/packageA</code> inside <strong>packageB</strong> and when I tried to import with <code>import { someType } from '@types/packageA'</code> and build I got the following error: <code>TS6137: Cannot import type declaration files</code>.</p>
  </li>
  <li><p>Now if I instead installed types to <code>node_modules/packageA-types</code> inside <strong>packageB</strong> and import with <code>import { someType } from 'packageA-types'</code> it works and I do not get the error when I build.</p>
  </li>
  </ol>
  <p><strong>Why does the first method fail and why does the second method work?</strong></p>
  <p>I read a few other stackoverflow posts that talked about normal/local vs global/ambient Typescript modules but I didn't quite understand how that played into this situation.</p>