<p dir="auto">const [errors, emitted] = await Deno.compile("./app.ts", undefined, {<br>
lib: ["es6","dom", "esnext", "deno.ns","scripthost","dom.iterable"], // include "deno.ns" for deno namespace<br>
outDir: "./",<br>
});</p>
<p dir="auto">if (errors) {<br>
console.log("There was an error:");<br>
console.log(errors);<br>
} else {<br>
console.log(emitted); // normally we would write the file<br>
}</p>
<p dir="auto">when i was use    Deno.compile    case error</p>
<p dir="auto">{<br>
message: "Argument of type 'string | URL' is not assignable to parameter of type 'string'.",<br>
messageChain: {<br>
message: "Argument of type 'string | URL' is not assignable to parameter of type 'string'.",<br>
code: 2345,<br>
category: 3,<br>
next: [Array]<br>
},<br>
code: 2345,<br>
category: 3,<br>
startPosition: 12702,<br>
endPosition: 12705,<br>
sourceLine: "  return new URL(url).pathname;",<br>
lineNumber: 432,<br>
scriptResourceName: "<a href="https://deno.land/std@0.51.0/path/posix.ts" rel="nofollow">https://deno.land/std@0.51.0/path/posix.ts</a>",<br>
startColumn: 17,<br>
endColumn: 20<br>
},<br>
{<br>
message: "Argument of type 'string | URL' is not assignable to parameter of type 'string'.",<br>
messageChain: {<br>
message: "Argument of type 'string | URL' is not assignable to parameter of type 'string'.",<br>
code: 2345,<br>
category: 3,<br>
next: [Array]<br>
},<br>
code: 2345,<br>
category: 3,<br>
startPosition: 27167,<br>
endPosition: 27170,<br>
sourceLine: "  return new URL(url).pathname",<br>
lineNumber: 910,<br>
scriptResourceName: "<a href="https://deno.land/std@0.51.0/path/win32.ts" rel="nofollow">https://deno.land/std@0.51.0/path/win32.ts</a>",<br>
startColumn: 17,<br>
endColumn: 20<br>
},<br>
{<br>
message: "Argument of type 'string | URL' is not assignable to parameter of type 'string'.",<br>
messageChain: {<br>
message: "Argument of type 'string | URL' is not assignable to parameter of type 'string'.",<br>
code: 2345,<br>
category: 3,<br>
next: [Array]<br>
},<br>
code: 2345,<br>
category: 3,<br>
startPosition: 12702,<br>
endPosition: 12705,<br>
sourceLine: "  return new URL(url).pathname;",<br>
lineNumber: 432,<br>
scriptResourceName: "<a href="https://deno.land/std@0.52.0/path/posix.ts" rel="nofollow">https://deno.land/std@0.52.0/path/posix.ts</a>",<br>
startColumn: 17,<br>
endColumn: 20<br>
},<br>
{<br>
message: "Argument of type 'string | URL' is not assignable to parameter of type 'string'.",<br>
messageChain: {<br>
message: "Argument of type 'string | URL' is not assignable to parameter of type 'string'.",<br>
code: 2345,<br>
category: 3,<br>
next: [Array]<br>
},<br>
code: 2345,<br>
category: 3,<br>
startPosition: 27167,<br>
endPosition: 27170,<br>
sourceLine: "  return new URL(url).pathname",<br>
lineNumber: 910,<br>
scriptResourceName: "<a href="https://deno.land/std@0.52.0/path/win32.ts" rel="nofollow">https://deno.land/std@0.52.0/path/win32.ts</a>",<br>
startColumn: 17,<br>
endColumn: 20<br>
}</p>
<p dir="auto">but if  i  use   deno.run     that was no problem ,  but i want to compile.  deno v 1.0.1</p>
<p dir="auto">The deno standard lib declaration of <code class="notranslate">URL</code> accepts <code class="notranslate">string | URL</code> as input: </p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/denoland/deno/blob/a08a4abac116eda498f8ad2df13b3816ec36c9ad/cli/js/lib.deno.shared_globals.d.ts#L1149">deno/cli/js/lib.deno.shared_globals.d.ts</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 1149
      in
      <a data-pjax="true" class="commit-tease-sha" href="/denoland/deno/commit/a08a4abac116eda498f8ad2df13b3816ec36c9ad">a08a4ab</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L1149" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1149"></td>
          <td id="LC1149" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">new</span> <span class="pl-kos">(</span><span class="pl-s1">url</span>: <span class="pl-smi">string</span> <span class="pl-c1">|</span> <span class="pl-smi">URL</span><span class="pl-kos">,</span> <span class="pl-s1">base</span>?: <span class="pl-smi">string</span> <span class="pl-c1">|</span> <span class="pl-smi">URL</span><span class="pl-kos">)</span>: <span class="pl-smi">URL</span><span class="pl-kos">;</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">However the TypeScript dom library declaration only accepts <code class="notranslate">string</code>:<br>
<a href="https://github.com/microsoft/TypeScript/blob/master/src/lib/dom.generated.d.ts#L15920">https://github.com/microsoft/TypeScript/blob/master/src/lib/dom.generated.d.ts#L15920</a></p>
<p dir="auto">When declaring "dom" in tsconfig.json like so:</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;lib&quot;: [&quot;dom&quot;, &quot;dom.iterable&quot;, &quot;esnext&quot;, &quot;deno.ns&quot;]"><pre class="notranslate"><span class="pl-ent">"lib"</span>: [<span class="pl-s"><span class="pl-pds">"</span>dom<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>dom.iterable<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>esnext<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>deno.ns<span class="pl-pds">"</span></span>]</pre></div>
<p dir="auto">deno throws the following 2 errors:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname;
                 ~~~
    at https://deno.land/std@0.51.0/path/posix.ts:433:18

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname
                 ~~~
    at https://deno.land/std@0.51.0/path/win32.ts:911:18

Found 2 errors."><pre class="notranslate"><code class="notranslate">error: TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname;
                 ~~~
    at https://deno.land/std@0.51.0/path/posix.ts:433:18

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname
                 ~~~
    at https://deno.land/std@0.51.0/path/win32.ts:911:18

Found 2 errors.
</code></pre></div>
<p dir="auto">Probably related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="574661526" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/4234" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/4234/hovercard" href="https://github.com/denoland/deno/issues/4234">#4234</a>.</p>