I get this error on the code block below.
error TS2339: Property 'endsWith' does not exist on type 'string'
let myList = angular.element(elem).attr("href").split("/");
let last = _.last<string>(myList);
if (last.endsWith("something")) {
return last;
}
I have also discovered this link that shows that there is a function endsWith(...)
.
http://definitelytyped.org/docs/typescript-services--typescriptServices/classes/typescript.stringutilities.html
Do I miss some .d.ts
file or what?
While compiling your typescript code, please point the target to ES6.
tsc --target ES6 "filename"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With