-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(typings): #6458 use a more suitable return type for waitUntil #6574
docs(typings): #6458 use a more suitable return type for waitUntil #6574
Conversation
cec23d1
to
9780313
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waitUntil
returns everything that will be successfully resolved by the promise from the condition function (not only true
). Therefor I assume it should be any | void
.
Thanks for checking @christian-bromann ! Not quite sure I follow though... The jsdocs say Can i request for an example where it would return a value other than true please? |
Sure, I think the comments are wrong then, I double checked: › browser.waitUntil(() => 'foobar')
'foobar'
› browser.waitUntil(() => 123)
123 |
i see, thanks! this is actually what i meant by - one thing we can do is change the arg type to truthy instead of boolean, then combine it with generics to use the same arg type as the return type. it's not gonna be straightforward but it will be more accurate. personally, i've mixed feelings about this...thoughts? |
@@ -50,7 +50,7 @@ export default function waitUntil( | |||
interval = this.options.waitforInterval, | |||
timeoutMsg | |||
}: Partial<WaitUntilOptions> = {} | |||
) { | |||
): true | void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
): true | void { | |
): Promise<true | void> { |
That would be my preference given that this is how it actually works, regardless of the types. Also I can see that user would like to use the value returned by |
Noted, thanks! Lemme see what i can do! |
…ngs and this accidentally got added
3b13e91
to
6f44c2b
Compare
i tried this approach and bumped into the limitation that was highlighted -- samples:
for now i kept the changes minimal, as per last requests. thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 thank you so much!
Proposed changes
waitUntil
#6458Types of changes
Checklist
Further comments
Reviewers: @webdriverio/project-committers