I am working on an Angular 2 project using the CLI. Currently, I am trying to add a custom method to the String type as shown below.
interface String {
customMethod(): number;
}
String.prototype.customMethod = function() {
return 0;
}
Despite my efforts, the compiler is still throwing errors. Can anyone provide guidance on where I should place this code in the project for it to work correctly? Your help is greatly appreciated.