title: TypeScript: implicitly type 'any' because of no type annotation and direct or indirect reference in its own initializer
body: <p>With the following code snippet I'm getting the following error: 
  <code>TypeScript error: 'route' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.  TS7022</code></p>
  
  <pre class="lang-js prettyprint-override"><code>const store = configureStore()
  
  const renderWithRouter = (
    ui: any,
    {
      route = '/', /* ERROR HERE */
      history = createMemoryHistory({ initialEntries: [route] }),
    } = {},
  ) =&gt; {
    return {
      ...render(
        &lt;Provider store={store}&gt;
          &lt;Router history={history}&gt;{ui}&lt;/Router&gt;
        &lt;/Provider&gt;,
      ),
      history,
    }
  }
  
  export default renderWithRouter
  </code></pre>
  
  <p>I was working in a completely section of the code and had to upgrade a package, and then all of a sudden this started complaining. (The packages were <code>react-router-dom</code> and <code>@types/react-router-dom</code>). </p>
  
  <p>I'm not exactly sure how to get past this, and furthermore I'm a little confused by what's going on with the second parameter in the function. it looks like they were trying to identify a default empty parameter, however they've filled in values on the left hand side for <code>route</code> and <code>history</code>. </p>
  
  <p>edit:
  I have resolved the issue by adding the following:</p>
  
  <pre class="lang-js prettyprint-override"><code>interface IRenderParams {
    route: string | undefined;
    history: MemoryHistory&lt;any&gt;
  }
  ...
  {
      route = '/', /* ERROR HERE */
      history = createMemoryHistory({ initialEntries: [route] }),
    } = {} as IRenderParams
  ...
  </code></pre>
  
  <p>This resolves the issue, however, I still am not sure exactly why is this defined like this.</p>