title: Typescript - Using an abstract class to simple share a function
body: <p>Using Typescript, I have 2 functions, within them they have the exact same function code. Therefore I decided to take that common function out into its own file.</p>
  
  <p>However I've done it like below - and wonder should I instead be creating an abstract class which has that function (others will go in there soon). Or is it just as <code>nice</code> to keep it as I've done at the moment.</p>
  
  <p>So file 1:</p>
  
  <pre><code>import { sharedFunction } from "../common/actions";
  
  export async function onTrigger(context: Context, documents: Resource[] | null): Promise&lt;void&gt; {
     sharedFunction(aParamFile1, bParamFile1)
  }
  </code></pre>
  
  <p>file 2:</p>
  
  <pre><code>import { sharedFunction } from "../common/actions";
  
  export async function onTrigger(context: Context, documents: Resource[] | null): Promise&lt;void&gt; {
     sharedFunction(aParamFile2, bParamFile2)
  }
  </code></pre>
  
  <p>actions file with shared function:</p>
  
  <pre><code>export async function sharedFunction(input1: someType, input2: someType){
     //Do something
  }}
  </code></pre>
  
  <p>The reason I wonder if it should be an abstract class is say I have several functions I want to use in <code>file1</code> or <code>file2</code> I'd need to list them all in the <code>import</code> lines at the top. Is that seen as <code>untidy</code> design or is it acceptable? 
  I was wondering whether it could be avoided so instead do <code>myAbstractClass.sharedFunction</code>?</p>
  
  <p>But on the other hand I don't see how that <code>onTrigger</code> function can extend that abstract class being a function.</p>
  
  <p>Any ideas/advice appreciated.</p>
  
  <p>Thanks.</p>