title: typescript interface initialization
body: <p>My level of typescript is 'ABSOLUTE BEGINNER' but I have a good OOP background. I am building an with typescript that reference an external <code>t.ds</code> library that contains the following interface:</p>
  
  <pre><code>interface ISimpleObject {
      foo: string;
      bar?: any;
  }
  </code></pre>
  
  <p>Now, if I want to call a method that has an IRequestConfig parameter, how do I create one? I can see different options:</p>
  
  <ol>
  <li>Create a simple implementation of ISimpleObject. I don't like this approach because it looks like boilerplate code to me</li>
  <li><p>don't initialize the object (I fear this could break something...):</p>
  
  <p><code>var x :IsimpleObject;
  x.bar = 'xxx';
  callMethod(x);</code></p></li>
  <li><p>Cast a pojo:</p>
  
  <p><code>var x :IsimpleObject = &lt;IsimpleObject&gt;{foo: 'yyy', bar:'xxx'};</code></p>
  
  <p>I don't like this approach either because it doesn't enforce type safety...</p></li>
  </ol>
  
  <p>I guess this is a fairly trivial question and I am missing something trivial about typescript.</p>