title: Flow - maybe type incompatible with union types
body: <p>Flow code can be <a href="https://flow.org/try/#0C4TwDgpgBAaghgGwK4QCrmgXilAzsAJwEsA7AcygB8oSkBbAIwgKqgYHt2FXaFvqAbuyIATANwAoUJCgB5BgCsIAY2CyAZvGQRcUbAG8A2vmLkAugC5YiFOkgBfCeqQlVRdiShkIwLSgBiBOx08kqqGn46ABTsiipqmjY6VqHxEUm4ADQ0cHQQViakZACUVpF20PoSOAQ+SASesWEJkbiGJLkQZpKOElIYUADKwRCRAOpEwAAWAHJIfHAMCBCDhEV6UFU4uCMACkGQBKBWAPyF5BK9Ti5uHl4+kVBRO3mpqlbDeeOTs-MIi8tVqYSptqlBasB6p5vL4koFgm8WhlniNEdkAOQvCD7diHUDo4o9IA" rel="nofollow noreferrer">run here.</a></p>
  
  <p>Using flow, I have a function that takes a key value pair object and gets a value for it - the value it gets should be a string, number or boolean.</p>
  
  <pre><code>type ValueType =  string | number | bool | null | void;
  type ObjectOfValues = {[string]: ValueType}
  function getValueFromObjectOfValues(objectOfValues: ObjectOfValues, name: string): ValueType {
    return objectOfValues[name];
  }
  </code></pre>
  
  <p>I define some object type that has a property that's a <code>maybe</code> string:</p>
  
  <pre><code>type SomeValueWithNullableString = {
    someProperty: ?string
  }
  </code></pre>
  
  <p>Then I create a function that takes my specific object type and calls the function to get a value from it:</p>
  
  <pre><code>function getValue (someObject: SomeValueWithNullableString) {
    return getValueFromObjectOfValues(someObject, 'someProperty');
  }
  </code></pre>
  
  <p>This results in a flow error:</p>
  
  <blockquote>
    <p>type ObjectOfValues = {[string]: ValueType}
                                        ^ boolean. This type is incompatible with the expected param type of someProperty:
    ?string                    ^ string 2: type ObjectOfValues =
    {[string]: ValueType}
                                        ^ number. This type is incompatible with the expected param type of 9:   someProperty:
    ?string                    ^ string</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>