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(...).
endsWith(...)
http://definitelytyped.org/docs/typescript-services--typescriptServices/classes/typescript.stringutilities.html
Do I miss some .d.ts file or what?
.d.ts
While compiling your typescript code, please point the target to ES6.
tsc --target ES6 "filename"
2.1m questions
2.1m answers
60 comments
57.0k users