I wanted to create a new class extending from an existing class-like JavaScript function
function MyFunctionClass() { }
MyFunctionClass.prototype.myMethod = function(str) {
console.log(str);
};
I wrote this simple piece of code
class Test extends MyFunctionClass {
constructor() {
super();
}
}
let t = new Test();
t.myMethod('Test');
And surprisingly it does work, as it prints Test and no runtime errors are raised.
However, the TypeScript playground tells me
Type '() => void' is not a constructor function type.
Can I safely ignore this error and use that code in production?