title: firebase function organization using typescript
body: <p>i am using typescript for my firebase functions and bit stuck on code organization. I do not need to move trigger functions at this point and ok to keep them in index.ts file. All i need is the help to put other utility functions away from index.ts. </p>
  
  <p>so current index.ts is</p>
  
  <pre><code>import * as functions from 'firebase-functions';
  import * as rp from "request-promise-native";
  import * as admin from 'firebase-admin';
  
  
  admin.initializeApp(functions.config().firebase)
  
  async function func1(){
    return 'blaw'
  }
  
  async function func2(){
    return 'blaw2'
  }
  
  module.exports = func1
  module.exports = func2
  
  </code></pre>
  
  <p>index.ts
  import { func1, func2 } from './comoncode'</p>
  
  <pre><code>export const on_plan_upgrade_request = functions.database.ref("plan_upgrades/{id}").onWrite(async (change, context) =&gt; {
      console.log("start of on_feedback_received")
  
      const rsp = await func1()
      const rsp2 = await func2()
  
      const command = change.after.val();
      const data = {
          from: from,
          subject: "Plan upgrade request received",
          html: "Hi " + command.name + "&lt;br/&gt;Thank you for your for your upgrade request.&lt;br/&gt;&lt;br/&gt;We will get back to you shortly." +
          "&lt;br/&gt;&lt;br/&gt;Moblize.IT LLC&lt;br/&gt;http://moblize.it",
          templateId: 'f9f96c8d-7515-40fb-ba34-787f0d34693e',
          to: command.email,
          cc: cc
      }
  
      sendEmail(data)
  
      return ""
  });
  
  </code></pre>
  
  <p>from above code i want to take func1() and func2() in another file say utility_code.ts  </p>
  
  <p>what would the utility_code.ts will look like and how they will be referenced in index.ts.  </p>
  
  <p>UPDATE: now i get error commoncode.ts is not a module</p>