I have the following configuration set up in an Angular5 project using Angular-cli 1.5
within typings.d.ts
declare interface String {
toSentenceCase(): string;
}
declare function _debug(o, message?, type?): void;
inside app/core/common.ts
String.prototype.toSentenceCase = function () {
return this.substring(0, 1).toUpperCase() + this.substring(1);
};
function _debug(o, message?, type?) {
console.log(o);
}
within main.ts
import './app/core/common';
Now when I use these in my component
console.log('something'.toSentenceCase()); // works
_debug(data); // ERROR ReferenceError: _debug is not defined
What could be the reason for the prototype declaration being successful while the function was not recognized?