title: Private "functions" in TypeScript
body: <p>Is it possible to create a private "function" (method) within a TypeScript class? Let's assume we have the following <code>Person.ts</code> TypeScript file:</p>
  
  <pre><code>class Person {
      constructor(public firstName: string, public lastName: string) {
      }
  
      public shout(phrase: string) {
          alert(phrase);
      }
  
      private whisper(phrase: string) {
          console.log(phrase);
      }
  }
  </code></pre>
  
  <p>Which when compiled is being transformed to the following:</p>
  
  <pre><code>var Person = (function () {
      function Person(firstName, lastName) {
          this.firstName = firstName;
          this.lastName = lastName;
      }
      Person.prototype.shout = function (phrase) {
          alert(phrase);
      };
      Person.prototype.whisper = function (phrase) {
          console.log(phrase);
      };
      return Person;
  })();
  </code></pre>
  
  <h2>Observations</h2>
  
  <p>I was expecting the <code>whisper</code> function to be declared within the closure, but not on the prototype? Essentially this makes the <code>whisper</code> function public when compiled?</p>