di.js
di.js copied to clipboard
Exception: Constructors of derived class must contain a super call when the memberVariables option is enabled
When the memberVariables option in traceur is enabled I get the following exception:
Uncaught exception: [ 'annotations.js:29:3: Constructors of derived class must contain a super call when the memberVariables option is enabled' ]
Tested with (Options: --annotations --types --member-variables):
import {Injector, Inject} from "di/src";
[...]
This would fix the problem:
[...]
class InjectPromise extends Inject {
constructor(...tokens) {
super(...tokens);
this.isPromise = true;
this.isLazy = false;
}
}
[...]
There were recent changes to Classes over the past few months, one of them is that there is now a TDZ on this, just like there is on let or const declarations, until the super-constructor is called. https://github.com/tc39/ecma262/blob/master/workingdocs/ES6-super-construct%3Dproposal.md (but there have been some more changes since) --- so, the traceur option is just sort of showing you how it's going to be