title: TypeScript export/import function
body: <p>I have a module I wrote (which is installed via npm from a private repo) that the following structure:</p>
  
  <p>email.ts, utils.ts, index.ts, (some other files)</p>
  
  <p>On my email.ts I have the following function:</p>
  
  <pre><code>export default function sendEmail(toEmail: string, subject: string, content: string): any {
  
      let helper = SendGrid.mail;
  
      let from_email: any = new helper.Email(process.env.FROM_EMAIL);
      let to_email: any = new helper.Email(toEmail);
      let helperContent: any = new helper.Content("text/plain", content);
      let mail: any = new helper.Mail(from_email, subject, to_email, helperContent)
  
      var request = SendGrid.emptyRequest({
          method: "POST",
          path: "/v3/mail/send",
          body: mail.toJSON()
      });
  
      //This performs the request with a promise
      SendGrid.API(request).then((response: any) =&gt; {
          //Deal with output as needed
          console.log("email was sent!!");
      }).catch((err: any) =&gt; {
          //log.error(err);
      });
  }
  </code></pre>
  
  <p>Then, on my index.ts I have the following declarations:</p>
  
  <pre><code>export * from "./email";
  export * from "./errors";
  export * from "./logger";
  export * from "./objectUtils";
  export * from "./queryFilter";
  export * from "./templateEngine";
  export * from "./utils";
  </code></pre>
  
  <p>On the application where I import this module I import this as</p>
  
  <pre><code>import * as Utils from "my-utils";
  </code></pre>
  
  <p>Finally, whenever I want to use the sendEmail function, I call it by using this statement:</p>
  
  <pre><code>Utils.sendEmail(email, subject, content);
  </code></pre>
  
  <p>However this always throws an error stating that <code>"Cannot read property 'sendEmail' of undefined"</code>.</p>
  
  <p>Why is this happening? Shouldn't I be able to use this type of declarations when exporting this way?
  What is the solution for this?</p>
  
  <p>Best Regards</p>