title: Inconclusive error message when using union type in typescript
body: <p>I'm trying to describe a union type of a Firestore value:</p>
  
  <pre><code>interface StringValue {
      stringValue: string;
  }
  
  interface BooleanValue {
      booleanValue: boolean;
  }
  
  type ValueType = StringValue | BooleanValue;
  var value: ValueType = { booleanValue: false, stringValue: "null" }; // [1]
  
  if (value.booleanValue) console.log(value); // [2]
  
  </code></pre>
  
  <p>I'm getting an error at [2]:</p>
  
  <pre><code>Property 'booleanValue' does not exist on type 'ValueType'.
    Property 'booleanValue' does not exist on type 'StringValue'.(2339)
  </code></pre>
  
  <p>though I'd expect to error at line [1], where is an incorrect assignment happens. So, why [2] and not [1]?</p>
  
  <p><a href="https://www.typescriptlang.org/play/index.html?ssl=1&amp;ssc=1&amp;pln=13&amp;pc=1#code/JYOwLgpgTgZghgYwgAgMpiqA5gNTgGwFcUBvAWAChlrkBnDbPIiALjoZCwG5KBfSyqEixEKAEIB7CfghwQTYsnJUaAIyky5C1snXTZIHhX4VKYAJ4AHFNoAqVlAF40HXAUUAfZJP1b3EIwA3OChkYOY2OwdkZxJdDQNtNnh8WggAGnZMTiTkACIQQnx8POReI0EYZAAKcOIAOj1NeX8ASmQECRBafXr8CSxatqMgA" rel="nofollow noreferrer">https://www.typescriptlang.org/play/index.html?ssl=1&amp;ssc=1&amp;pln=13&amp;pc=1#code/JYOwLgpgTgZghgYwgAgMpiqA5gNTgGwFcUBvAWAChlrkBnDbPIiALjoZCwG5KBfSyqEixEKAEIB7CfghwQTYsnJUaAIyky5C1snXTZIHhX4VKYAJ4AHFNoAqVlAF40HXAUUAfZJP1b3EIwA3OChkYOY2OwdkZxJdDQNtNnh8WggAGnZMTiTkACIQQnx8POReI0EYZAAKcOIAOj1NeX8ASmQECRBafXr8CSxatqMgA</a></p>