title: Using nested objects with Flow in React state
body: <p>I have a question regarding nested state objects with flow … </p>
  
  <p>So let’s say I want a conditional parameter <code>close</code> inside an object in the state in my React component. </p>
  
  <pre><code>class Appearance extends React.Component {
    state: {
      house: {
        open: number,
        close?:number,
      },
    };
    constructor(props) {
      super(props);
      const house = {
        open: 0,
      };
      if (props.door) {
        house.close = 0;
      }
      this.state = {
        house,
      };
    }
  </code></pre>
  
  <p>This seems to give me an error <code>close. Property not found in object literal</code>
  Am I doing something wrong or can I do this another way?</p>