I have the following code:
Object.prototype.custom = function() {
return this
}
It works just fine in JavaScript, but when I put it in TypeScript, I get this error:
Property 'custom' does not exist on type 'Object'.ts(2339)
How can I bypass or solve this complaint?
Object.prototype! Especially, don't make it enumerable!!! (Your code will add that property to every single object in existence, not even only the ones you manually create, and will even show up as a key infor..inloops, which is bad. Like, very bad. Doing that in your project is shooting yourself in the foot. Doing that in a library is shooting everyone in the foot.)