<p dir="auto">I'm interested in writing a typescript transform that rewrites all of the Import declarations to named identifiers and outputs an import map.  The idea being that this could be the basis for a frontend dependency management tool that could handle semver resolution and deduping transitive dependencies.  As far as I can tell there's no way to pass transforms via the Compiler API.  Adding the ability to do so could potentially open up a wide range of output customizations.</p>
<p dir="auto">Alternatively I could write a tool that does that before deno is called, but I'd prefer the above approach because aking multiple passes at the source code would be slower than making a single pass</p>
<p dir="auto">In regular TypeScript projects, within a <code class="notranslate">.js</code> file with type checking enabled via <code class="notranslate">// @ts-check</code> you can import types from other files within JSDoc comments. For example…</p>
<p dir="auto">In <code class="notranslate">a.js</code>:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// @ts-check

/**
 * Description for A.
 * @param {import(&quot;./b.js&quot;).default} b The B.
 */
export default function a(b) {
  return b;
}"><pre class="notranslate"><span class="pl-c">// <span class="pl-k">@ts</span>-check</span>

<span class="pl-c">/**</span>
<span class="pl-c"> * Description for A.</span>
<span class="pl-c"> * <span class="pl-k">@param</span> {<span class="pl-smi">import("./b.js").default</span>} b The B.</span>
<span class="pl-c"> */</span>
<span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-k">function</span> <span class="pl-en">a</span><span class="pl-kos">(</span><span class="pl-s1">b</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">return</span> <span class="pl-s1">b</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">In <code class="notranslate">b.js</code>:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// @ts-check

/**
 * Description for B.
 * @type {boolean}
 */
export default true;"><pre class="notranslate"><span class="pl-c">// <span class="pl-k">@ts</span>-check</span>

<span class="pl-c">/**</span>
<span class="pl-c"> * Description for B.</span>
<span class="pl-c"> * <span class="pl-k">@type</span> {boolean}</span>
<span class="pl-c"> */</span>
<span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-c1">true</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Note that the parameter type is able to be imported and checked:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1754873/125215375-b1f31300-e2fe-11eb-868d-579603538688.png"><img width="453" alt="Screen Shot 2021-07-12 at 10 43 26 am" src="https://user-images.githubusercontent.com/1754873/125215375-b1f31300-e2fe-11eb-868d-579603538688.png" style="max-width: 100%;"></a></p>
<p dir="auto">With exactly the same setup in a Deno project, the parameter type cannot be imported or checked:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1754873/125215443-db13a380-e2fe-11eb-9705-318b642ce12b.png"><img width="447" alt="Screen Shot 2021-07-12 at 10 43 07 am" src="https://user-images.githubusercontent.com/1754873/125215443-db13a380-e2fe-11eb-9705-318b642ce12b.png" style="max-width: 100%;"></a></p>
<p dir="auto">This not working in Deno, with no open issues about it has really made the past few days trying to get an isomorphic codebase with a mixture of <code class="notranslate">.ts</code>, <code class="notranslate">.tsx</code>, and <code class="notranslate">.js</code> files a nightmare, because it's hard to tell if it's you or Deno that's doing the wrong thing. I <em>think</em> if this Deno bug were fixed I'd finally have a workable solution!</p>