Suppose i want to extend String.prototype, so i have this in ext/string.ts for example:
interface String {
contains(sub: string): boolean;
}
String.prototype.contains = function (sub:string):boolean {
if (sub === "") {
return false;
}
return (this.indexOf(sub) !== -1);
};
When i do import * as string from 'ext/string.ts'
it fails with this error:
error TS2306: File 'ext/string.ts' is not a module
and this is supposed behavior , i didn't write export. But how do i tell to Typescript that i want to extend String.prototype then?