I wrote a test in protractor where i want to get a list of DOM elements in a reversed position.
Here is the code i wrote :
var buttons = element.all(by.js(() => {
var arr = document.querySelectorAll('.md-table-toolbar md-icon');
return Array.prototype.reverse.apply(arr);
}));
But typescript throws me the following error
Argument of type '(WebDriver: WebDriver) => Promise' is not assignable to type "Locator"
What is wrong about my code ?
EDIT:
A coworker edited a file called custom.d.ts and inserted the following
declare namespace protractor {
interface IProtractorLocatorStrategy {
js: (script: any, ...var_args: any[]) => webdriver.Locator;
}
}
Im fairly new to TS and programming so i have no clue what he did maybe one of you can form an answer from that information.