title: Missing methods in TypeScript class
body: <p>I have a TypeScript model which contains properties and functions like:</p>
  
  <pre><code>class Person {
  name: string
  sayHello(){ console.log(name); }
  }
  </code></pre>
  
  <p>When creating its instance I can make use of this <code>sayHello()</code> method as expected.</p>
  
  <p>The problem comes when I store and get the object from the local storage or an external web service.
  While the properties are still present the methods have disappeared. (obviously because it’s just text).</p>
  
  <p>Is there any way to restore the completeness of the object to be able to use its functions?</p>
  
  <p>Or otherwise, is there any other technique? For instance, helper class that can work with type.</p>