// extensions.ts
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Element
{
foo(): this;
}
Element.prototype.foo = function()
{
return this;
};
// other-file.ts
import "./extensions.js";
new Element().foo();
This works, but it has two problems:
- You don't get any compile-time error even if you forget to implement foo().
- You don't get any compile-time error even if you forget to import the file.
Are there any remedies to these issues?