<p dir="auto">Router in Next 8 supports url objects <code class="notranslate">{ pathname: ... }</code> but types support only string. It's bug or that feature was removed?</p>
<h1 dir="auto">Bug report</h1>
<h2 dir="auto">Describe the bug</h2>
<p dir="auto">After upgrading to next canary (future v9) from 8.1.1, I got a few TypeScript errors when calling <code class="notranslate">Router.push(url)</code> and <code class="notranslate">Router.replace(url)</code> with object-like URLs.</p>
<p dir="auto">This seems like a regression in built-in typings compared to the third-party ones (<code class="notranslate">@types/*</code>). Related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="420481869" data-permission-text="Title is private" data-url="https://github.com/vercel/next.js/issues/6644" data-hovercard-type="pull_request" data-hovercard-url="/vercel/next.js/pull/6644/hovercard" href="https://github.com/vercel/next.js/pull/6644">#6644</a>.</p>
<h2 dir="auto">To Reproduce</h2>
<div class="highlight highlight-source-tsx notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import { Router, useRouter } from &quot;next/router&quot;;

const router: Router = useRouter();

// 👍
router.push(&quot;/about&quot;);
router.replace(&quot;/about&quot;);

// ❌ Argument of type '{ pathname: string; }' is not assignable to parameter of type 'string'.ts(2345)
router.push({ pathname: &quot;/about&quot; });
router.replace({ pathname: &quot;/about&quot; });"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-smi">Router</span><span class="pl-kos">,</span> <span class="pl-s1">useRouter</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">"next/router"</span><span class="pl-kos">;</span>

<span class="pl-k">const</span> <span class="pl-s1">router</span>: <span class="pl-smi">Router</span> <span class="pl-c1">=</span> <span class="pl-en">useRouter</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">// 👍</span>
<span class="pl-s1">router</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-s">"/about"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">router</span><span class="pl-kos">.</span><span class="pl-en">replace</span><span class="pl-kos">(</span><span class="pl-s">"/about"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">// ❌ Argument of type '{ pathname: string; }' is not assignable to parameter of type 'string'.ts(2345)</span>
<span class="pl-s1">router</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">pathname</span>: <span class="pl-s">"/about"</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">router</span><span class="pl-kos">.</span><span class="pl-en">replace</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">pathname</span>: <span class="pl-s">"/about"</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">I expected url-like objects to be still acceptable. Not sure if new typings are simply incomplete or objects are arguments are being deprecated.</p>
<p dir="auto"><a href="https://github.com/zeit/next.js/blob/cc497568b4b226498069c9a7adbdc03e689b8526/packages/next-server/lib/router/router.ts#L208-L226">https://github.com/zeit/next.js/blob/cc497568b4b226498069c9a7adbdc03e689b8526/packages/next-server/lib/router/router.ts#L208-L226</a></p>
<p dir="auto">Typings in <code class="notranslate">@types/next-server</code>:</p>
<ul dir="auto">
<li><a href="https://github.com/DefinitelyTyped/DefinitelyTyped/blob/132720a17e15cdfcffade54dd4a23a21c1e16831/types/next-server/router.d.ts#L19">Definition of <code class="notranslate">UrlLike</code> type</a></li>
<li><a href="https://github.com/DefinitelyTyped/DefinitelyTyped/blob/132720a17e15cdfcffade54dd4a23a21c1e16831/types/next-server/router.d.ts#L48-L58">Usage in <code class="notranslate">push() and</code> <code class="notranslate">replace()</code></a></li>
</ul>
<p dir="auto">There exists a local <code class="notranslate">Url</code> type in <code class="notranslate">next/client</code>, which seems like what's needed. Should it be moved to <code class="notranslate">next-server/router</code>?</p>
<p dir="auto"><a href="https://github.com/zeit/next.js/blob/b60985b2be964dcac436d025a1943ded6454deaf/packages/next/client/link.tsx#L24">https://github.com/zeit/next.js/blob/b60985b2be964dcac436d025a1943ded6454deaf/packages/next/client/link.tsx#L24</a></p>
<p dir="auto">It's already <a href="https://github.com/zeit/next.js/blob/b60985b2be964dcac436d025a1943ded6454deaf/packages/next/client/link.tsx#L49-L50">used in <code class="notranslate">&lt;Link /&gt;</code> prop types</a>.</p>
<hr>
<p dir="auto">One more thing: <code class="notranslate">useRouter()</code> returns <code class="notranslate">any</code> because of how  <code class="notranslate">RouterContext</code> is typed 🤔<br>
<a href="https://github.com/zeit/next.js/blob/cc497568b4b226498069c9a7adbdc03e689b8526/packages/next/client/router.ts#L125-L127">https://github.com/zeit/next.js/blob/cc497568b4b226498069c9a7adbdc03e689b8526/packages/next/client/router.ts#L125-L127</a><br>
<a href="https://github.com/zeit/next.js/blob/b1fdffec75a7a7ce24693e4e1974714ac7733551/packages/next-server/lib/router-context.ts#L3">https://github.com/zeit/next.js/blob/b1fdffec75a7a7ce24693e4e1974714ac7733551/packages/next-server/lib/router-context.ts#L3</a></p>
<h2 dir="auto">System information</h2>
<ul dir="auto">
<li>Version of Next.js: <code class="notranslate">8.1.1-canary.69</code></li>
</ul>