I\'d like to know if there\'s a way to modify a function in TypeScript and access the original function within. This is an example of how I got it to work:
le
When you assign a new function to an existing object that like you lose the reference to the old value.
But if you use classes, you do have have access to overloaded methods via super.
class ObjA {
shout() {
console.log('AHHHHH!')
}
}
class ObjB extends ObjA {
shout() {
super.shout()
console.log("I'm going to shout.")
}
}
const obj = new ObjB()
obj.shout() //-> "I'm going to shout", "AHHHHH!"