title: How to change the state with React TypeScript 2.0?
body: <p>For such a small component created by React and TypeScript.</p>
  
  <pre><code>interface Props {
  }
  
  interface State {
    isOpen: boolean;
  }
  
  class App extends React.Component&lt;Props, State&gt; {
  
    constructor(props: Props) {
      super(props);
      this.state = { 
        isOpen: false
      };
    }
  
    private someHandler() {
      // I just want to turn on the flag. but compiler error occurs.
      this.state.isOpen = true;
      this.setState(this.state);
    }
  
  }
  </code></pre>
  
  <p>When I tried to upgrade TypeScript 1.8 to 2.0, then I got the compiler error like below.</p>
  
  <pre><code>error TS2540: Cannot assign to 'isOpen' because it is a constant or a read-only property.
  </code></pre>
  
  <p>I guess maybe it caused by this change.</p>
  
  <ul>
  <li><a href="https://github.com/Microsoft/TypeScript/wiki/FAQ#why-are-getters-without-setters-not-considered-read-only" rel="nofollow noreferrer">https://github.com/Microsoft/TypeScript/wiki/FAQ#why-are-getters-without-setters-not-considered-read-only</a></li>
  </ul>
  
  <p>so I just want to turn on the flag.</p>
  
  <p>What should I do? Does anyone know the workaround?</p>
  
  <p>Thanks.</p>
  
  <h1>update</h1>
  
  <p>the quick workaround is just doing like the below.</p>
  
  <pre><code>this.setState({ isOpen: true });
  </code></pre>