I have a curious question, because I'm gonna build a class, which should return the same value all the time when I call another method. I will show you an example:
class Vendor {
sendSignal() {
return 'Sent';
}
[key: string]: Function;
}
let vendor = new Vendor();
Now I call a non-existent method like:
vendor.sendRocket() //Output: 'Sent'
vendor.sendCovfefe(); //Output 'Sent'
And you see how it should work, even if I didn't place those methods in my class, they should return the value from the sendSignal method.
I know it might not work in Typescript so well. So does it work at all?