Q:

Typescript seems to behaves inconsistently when defining a function that returns an interface

When I have an interface with only one field (val)
interface ValObj  {
  val: number
}

creating an object with another field yields an error. 
const someObj: ValObj = {
  val: 5, 
  someStr:"hello"
}

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. 
const func: () => ValObj = 
  () => ({
    val: 5, 
    someStr: "sdf"
  })

Demo
Why does Typescript's type checking allow this? Is there any way around it? 

A:

The error you are seeing in the first example is a product of excess property checks. Excess propeties are checked only when an object literal is directly assigned to something of a given type.
In this case:
const func: () => ValObj = 
  () => ({
    val: 5, 
    someStr: "sdf"
  })

The way typing is done is to figure out the type of the arrow function first, which is () => { val: number, someStr: string } and then to check if this compatible with the given function signature () => ValObj which it is since { val: number, someStr: string } is a subtype of ValObj. Nowhere was the object literal directly assigned to ValObj.
You get an error if you are explicit about the return type of the arrow function:
const func: () => ValObj = 
  () : ValObj => ({
    val: 5, 
    someStr: "sdf"
  })

