title: TypeScript Unexpected token, A constructor, method, accessor or property was expected
body: <p>Just trying to write a function within a class using typescript.</p>
  
  <pre><code>class Test 
  {
      function add(x: number, y: number): number {
          return x + y;
      }
  }
  </code></pre>
  
  <p>This results in the following error:</p>
  
  <blockquote>
    <p>TypeScript Unexpected token, A constructor, method, accessor or
    property was expected.</p>
  </blockquote>
  
  <p>I copied the example from: <a href="https://www.typescriptlang.org/docs/handbook/functions.html" rel="noreferrer">https://www.typescriptlang.org/docs/handbook/functions.html</a></p>
  
  <p>Am I missing something? I'm confused!</p>