-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Erronous then function signature definition ElementArrayFinder #3696
Comments
It's nice that you have corrected a part of the problem with your commit @mgiambalvo but as I specified earlier the return type of element.then is wrong, putting wdpromise.Promise<any[]> forces the output to be an array, that causes a typescript error if you return anything in the .then that is different from any[]. for example |
Fixes angular#3696. Also clean up the restart spec test.
Fixes #3696. Also clean up the restart spec test.
I'm curious, the documentation for jsDoc for
|
@laurence-myers I hope this is can help you understand the issue, In this example, if we use static test(): Promise <void>{
return element.all(by.css('.items li')).then(
(arr) => { console.log('test'); }
);
} but if we use |
When trying to use the
.then
function available forElementArrayFinder
by passing a callback in which I don't return anything, the typescript compiler signals it as an error, and the output isbelow a test function taken from the documentation that will replicate the problem.
For me the problem comes from the type definition in lib/element.ts line 482 and 483 instead of
it should be
since what is returned by the callback passed in the .then may or may not be an array.
As a suggestion maybe the .then typing definition should be inspired by the typing definition of ES2015 by the TypeScript team.
2.0.3
6.9.1
4.0.10
1.5.0
The text was updated successfully, but these errors were encountered: