Invalid 'await' of a non-Promise value for a WebElementPromise

254 views
Skip to first unread message

Erik Itland

unread,
May 9, 2018, 6:49:15 AM5/9/18
to SonarLint
When working on Protractor code SonarLint reports:

"await" should only be used with promises (typescript:S4123)


The code in question tries to await the result from a function that returns a WebElementPromise*.


Could this linting rule be updated to accept WebElementPromise as a promise?


-----

* The WebElementPromise implements then and catch as described here:

https://github.com/SeleniumHQ/selenium/blob/f16c3216dfc4b4fb91e10049c8603f6285774f76/javascript/node/selenium-webdriver/lib/webdriver.js#L2198



Regards,

Erik Itland

e...@computas.com

unread,
May 25, 2018, 8:37:33 AM5/25/18
to SonarLint
Bump.

diego...@gmail.com

unread,
May 29, 2018, 9:22:32 AM5/29/18
to SonarLint
same problem with AxiosPromise
interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>>

abenh...@arhia.fr

unread,
Jun 1, 2018, 4:48:09 PM6/1/18
to SonarLint
Same problem with Bluebird.

It's very annoying...

elena....@sonarsource.com

unread,
Jun 5, 2018, 4:17:06 AM6/5/18
to SonarLint
Hi everyone,

Thanks for reporting this problem, I've created the ticket https://github.com/SonarSource/SonarTS/issues/659

P.S. Next time you can report ts-related problems directly at https://github.com/SonarSource/SonarTS

Regards,
Elena
Reply all
Reply to author
Forward
0 new messages