title: Is there some way to "spread" object properties to parameters of a function definition?
body: <p>Best explained in code:</p>
  <pre><code>const ROUTE_PARAMS = {
    userId: 'userId',
    companyId: 'companyId',
  };
  
  // Is this somehow possible?
  // `typeof` is obviously not the right tool here, just used as an example.
  function buildRoute(typeof ROUTE_PARAMS): string;
  
  // Result should be similar to:
  function buildRoute2(userId: string, companyId: string): string;
  
  //  The function should be called like this:
  buildRoute('some-user-id', 'some-company-id');
  
  //  I don't want the function to accept only 1 object like this:
  buildRoute({ userId: 'some-user-id', companyId: 'some-company-id' });
  </code></pre>
  <p>The idea is to have the route params of <code>buildRoute</code> somehow dynamically &quot;bound&quot; to the object.
  When defining the function params &quot;manually&quot; (like in <code>buildRoute2</code>), I always have to keep them in sync when changing properties of <code>ROUTE_PARAMS</code>...</p>
  <hr />
  <p><strong>Additional Info</strong></p>
  <p>I'll try to add some information as my question above does not seem to be sufficiently clear:</p>
  <ul>
  <li>I'm explicitly looking for a way to &quot;type&quot; this function from an <strong>object</strong> like the one shown above (<code>ROUTE_PARAMS</code>).</li>
  <li>I can't change this to some other structure (tuple type, some kind of array, ...) as that would require refactoring of other parts in my code which work with the object <code>ROUTE_PARAMS</code>.</li>
  <li>The function should except each object property as a single input parameter (i.e. function arity === number of object properties).<br />
  I <strong>don't</strong> want the function to accept all properties packed into 1 object ( &amp;  examples above).</li>
  </ul>