Closed
Description
From #945
The first statement in the body of a constructor must be a super call if both of the following are true:
• The containing class is a derived class.
• The constructor declares parameter properties or the containing class declares instance member variables with initializers.
These don't seem to be the only two conditions.
Consider this:
class MyView extends Backbone.View {
private someProp:SomeType;
constructor(options:MyOptionsType) {
// I want to create my view with these configured events:
options.events = {
'click .btn-close': this.close
};
super(options);
this.someProp = new SomeType();
}
}
This results in a compiler error: error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.
The MyView
class does not contain initialized properties or parameter properties. What's going on here?