title: In Typescript, how to use a function before it's declared?
body: <p>I want to declare a function, pass it as a handler, then define it afterward, my code is like this:</p>
  
  <pre><code>type authenticateHandler = (req: Restify.Request, res: Restify.Response) =&gt; any;
  server.post("/authentication", authenticateHandler);
  server.post("/v1/authentication", authenticateHandler);
  
  const authenticateHandler: authenticateHandler = (req: Restify.Request, res: Restify.Response) =&gt; { ... };
  </code></pre>
  
  <p>I am getting this error when passing the function on line 2, what am I doing wrong?  </p>
  
  <blockquote>
    <p>TS2448: Block-scoped variable 'authenticateHandler' used before its
    declaration</p>
  </blockquote>