I got an error of error TS2339: Property 'endsWith' does not exist on type 'string' while transpile ts to js.
When I search on google about it, I got an answer of 'endsWith' is ES6 function, target ts compiler to ES6".
I did the same, error gone. ES6 code generated.
the command was: tsc file-name.ts --target ES6
BUT if I did not target ES6, the error came, & still code transpile.
And I get valid ES.
As far as I know, until now, typescript is being transpile to ES5.
So, I get ES5 code because I did not target to ES6 at time of transpile.
the command was: tsc file-name.ts
Note: I removed the old .js file.
Then how 'endsWith' and other string functions are being generated in ES5 code? As they are ES6 function, and I did not target ES6.