di.js icon indicating copy to clipboard operation
di.js copied to clipboard

annotate helper and SuperConstructor doesn't work

Open markuz-gj opened this issue 11 years ago • 1 comments

While this works:

@Inject(Foo)
class Parent {
  constructor(foo) {
    this.parentFoo = foo;
  }
}

@Inject(SuperConstructor, Foo)
class Child extends Parent {
  constructor(superConstructor, foo) {
    superConstructor();
    this.childFoo = foo;
  }
}

this doesn't,

class Parent {
  constructor(foo) {
    this.parentFoo = foo;
  }
}
annotate(Parent, new Inject(Foo))

class Child extends Parent {
  constructor(superConstructor, foo) {
    superConstructor();
    this.childFoo = foo;
  }
}
annotate(Child, new Inject(SuperConstructor, Foo))

with the following error message: injector SuperConstructor should support "super" to call multiple parent constructors with annotate helper FAILED

markuz-gj avatar Dec 15 '14 16:12 markuz-gj

The fix is simple and I'm about to submit a PR

markuz-gj avatar Dec 15 '14 16:12 markuz-gj