-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
TypeScript Version: master branch
Code
class EVE extends HTMLElement {
constructor() {
return document.createElement("sn-eve"); // Error
}
}
let eve: EVE;
eve = document.createElement("sn-eve"); // No errorExpected behavior:
It should work if a constructor function return an object which is structurally compatible with the declared class.
Actual behavior:
Error: Constructors for derived classes must contain a 'super' call.
Workaround:
class EVE extends HTMLElement {
constructor() {
if ({} === undefined) {
super();
}
return document.createElement("sn-eve");
}
}Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created