title: ES6 and Typescript, class function properties without constructor
body: <p>This is proper Typescript (or ES6 if you ignore the static typing):</p>
  
  <pre><code>class Greeter {
      greeting: string;
      constructor(message: string) {
          this.greeting = message;
      }
      greet() {
          return "Hello, " + this.greeting;
      }
  }
  
  var greeter = new Greeter("world");
  
  console.log( greeter.greet() ); //Hello world
  </code></pre>
  
  <p>But the following creates <code>Hello undefined</code>, how would you rewrite this in a way it would work? And, if that's not possible, what would be the alternative to achieve this?</p>
  
  <p>I'm looking into passing variables directly to functions.</p>
  
  <pre><code>class Greeter {
      greet(greeting: string) {
          return "Hello, " + this.greeting;
      }
  }
  
  var greeter = new Greeter();
  
  console.log( greeter.greet("world") ); //Hello undefined
  </code></pre>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>I'm referring to PHP like class usage like:</p>
  
  <pre><code>class Greeter {
      public function greet($greeting){
          return $greeting;
      }
  }
  </code></pre>