why is when I attempt the code
declare interface String {
testsdfsdffds();
}
String.prototype.testsdfsdffds = () => {
};
it works, but substituting Object
for String
causes errors. I thought you could extend Object without issues?
My goal really is to mimic the Kotlin apply
and let
extension functions - but I would like to understand the how/why you can/cant extend objects?