TypeScript Version:
1.8.0
Code
Custom element classes often have constructors that just return document.createElement(), since HTMLElement doesn't have a callable constructor, but this generates an error in TypeScript:
class MyElement extends HTMLElement {
constructor() {
return document.createElement('my-element');
}
}
In general, it is completely valid ES2015 to not call super(), as long as you don't access this.
TypeScript Version:
1.8.0
Code
Custom element classes often have constructors that just return
document.createElement(), since HTMLElement doesn't have a callable constructor, but this generates an error in TypeScript:In general, it is completely valid ES2015 to not call
super(), as long as you don't accessthis.