dart-archive / js_facade_gen

Generates package:js Javascript interop facades for arbitrary TypeScript libraries
Apache License 2.0
161 stars 29 forks source link

Merge variables whose types are aliases of types with constructors #68

Open derekxu16 opened 4 years ago

derekxu16 commented 4 years ago
declare interface XType {
  a: string;
  b: number;
  c(): boolean;
}
declare type X = {
  prototype: XType,
  new(a: string, b: number): XType
}
declare type Y = X;
declare var Y: Y;

In this case we should emit a class declaration of Y with the members of XType and the constructor of X:

@JS()
class Y {
  // @Ignore
  Y.fakeConstructor$();
  external String get a;
  external set a(String v);
  external num get b;
  external set b(num v);
  external bool c();
  external factory Y(String a, num b);
}`);