title: Typescript seems to behaves inconsistently when defining a function that returns an interface
body: <p>When I have an interface with only one field (<code>val</code>)</p>
  
  <pre><code>interface ValObj  {
    val: number
  }
  </code></pre>
  
  <p>creating an object with another field yields an error. </p>
  
  <pre><code>const someObj: ValObj = {
    val: 5, 
    someStr:"hello"
  }
  </code></pre>
  
  <p>But this principle isn't consistent when we return a value from a function. Defining a function to return that same interface, and returning the same object works. </p>
  
  <pre><code>const func: () =&gt; ValObj = 
    () =&gt; ({
      val: 5, 
      someStr: "sdf"
    })
  </code></pre>
  
  <p><a href="https://stackblitz.com/edit/typescript-8sogr6" rel="nofollow noreferrer">Demo</a></p>
  
  <p>Why does Typescript's type checking allow this? Is there any way around it? </p>