title: Typescript Apollo-Server Datasources knex type
body: <p>I'm developing a few helper functions that expect a knex variable to be implemented like this:</p>
  <pre><code>async getRecordByID(id) {
  if (!id) {
    throw new Error(&quot;ID must be provided to query RecordNode&quot;);
  }
  
  record = getEntryById('table_record', id, this.knex);
  
  
  return record;
  </code></pre>
  <p>}</p>
  <p>My issue being of course that I cannot access the type of this.knex, just implementing type &quot;any&quot; would be bad practice and if I just import the knex type from its library and assign it to the variable it just means that it will show error because the method .cache() doesn't exists by default inside the stock knex library.</p>
  <p>So before someone says I should place whatever code lives inside getEntryById inside getRecordByID, that's a no go due to code complexity and overhead, this is just repeating code that do some complex querying and that gets implemented over multiple endpoints by just changing the table name.</p>