title: How to define a class variable in Flow so that it extends another type?
body: <pre class="lang-js prettyprint-override"><code>// @flow
  class Demo {
      SomeError: Error
    
      constructor() {
          this.SomeError = class extends Error {
              constructor(message: string) {
                  super(message)
                  this.name = 'SomeError'
              }
          }
      }
  }
  </code></pre>
  <p>I have been trying to do something like that. But flow gives an error: <code>Cannot assign 'class { ... }' to 'this.SomeError' because class '&lt;&lt;anonymous class&gt;&gt;' [1] is incompatible with 'Error'</code>. The temporary and ugly solution for me to write the class variable as:</p>
  <pre class="lang-js prettyprint-override"><code>// ...
  ErrorClass: Object
  // ...
  </code></pre>
  <p>I don't understand why it accepts Object as a type but not Error. Is there any solution for this problem?</p>