I use babel-polyfill with typescript.
When I use the string.includes () function, I get an error
Error TS2339: Property 'includes' does not exist in type 'string'
There is a similar question in stack overflow: error TS2339: property 'endsWith' does not exist in type 'string'
The answer is to extend the String user interface
interface String {
endsWith(searchString: string, endPosition?: number): boolean;
};
I don't like this idea too much because it means that I will have to fix every es6 polyfill function this way.
Is there a way to tell typescript that it should use es6 definitions but translate to es5?