-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
Consider the following code (try):
class C {
constructor() {
this.method = this.method.bind(this);
}
//method: () => void; // uncomment this line
method() {}
}
Which generates the following error:
3: this.method = this.method.bind(this);
^ property `method`. Covariant property `method` incompatible with contravariant use in
3: this.method = this.method.bind(this);
^ assignment of property `method`
As noted in the code, if you add a separate property type declaration, the error is gone. IMO, it does not really make sense to enforce a separate declaration here as the method definition should be enough?
pedrommuller, mleg, fikriauliya, RomanGalochkin, ufukomer and 3 more
Metadata
Metadata
Assignees
Labels
No labels