title: Using Dart JS interop with ES6 classes
body: <p>JavaSscript:</p>
  
  <pre><code>class MyClass {
  
      constructor() {
          console.log("MyClass instance created");
          this.answer = 42;
      }
  }
  
  let example = new MyClass();
  console.log(example.answer);
  </code></pre>
  
  <p>Dart:</p>
  
  <pre><code>@JS()
  library interop_test;
  
  import 'package:js/js.dart';
  
  @JS()
  class MyClass {
    external int get answer;
    external set answer(int value);
  }
  </code></pre>
  
  <p>Creating an instance of the the interop class <code>MyClass</code> as </p>
  
  <pre><code>MyClass myClass = MyClass();
  </code></pre>
  
  <p>results in:</p>
  
  <blockquote>
    <p>EXCEPTION: TypeError: dart.global.MyClass is not a constructor</p>
  </blockquote>
  
  <p>I've also tried to add a <code>external MyClass();</code> and <code>external factory MyClass();</code> to the <code>@JS()</code> annotated class, but got the same message. If I add <code>@anonymous</code> annotation to the interop class, the exception goes away, but I can't access instance members. (But I don't see why this would need the anonymous annotation)</p>
  
  <p>I'm using <code>dart 2.0.0</code>, <code>angular 5.0.0</code>, <code>js 0.6.1+1</code> and <code>dartdevc</code> through <code>webdev</code>.</p>