You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While enabling wotan for a project of mine, I found this gem:
awaitthis.observeGroupsAndScenes;// Unnecessary 'await' of a non-Promise value. [await-only-promise]
where observeGroupsAndScenes is a function that returns a promise. While wotan helped me find this, (and the --fix option removed the await 😨), I think it could be smarter - in this case I forgot the parentheses:
awaitthis.observeGroupsAndScenes();// correct
Would it be possible to detect this and provide both errors?
Like "Unnecessary 'await' of a non-Promise value" OR "Did you forget parentheses?"
The text was updated successfully, but these errors were encountered:
It's possible to detect this in most cases. If the return value is determined by an argument passed to the function, this won't be detected because obviously there are no arguments to infer the return type from.
The proposed behavior would check if the awaited expression is callable and if one of its call signatures (regardless of the parameters) is a valid PromiseLike. A return type of any and type parameters are not considered as PromiseLike.
and the --fix option removed the await 😨
Sorry for that.
I'm still planning to land #316 soon. This enables downgrading some fixes to suggested refactorings, which means they are not automatically applied. You could only use them through tools like the TypeScript LanguageService Plugin (which currently doesn't suggest fixes/refactorings at all).
After that is implemented all existing fixes need to be revisited and converted to a CodeAction.
While enabling
wotan
for a project of mine, I found this gem:where
observeGroupsAndScenes
is a function that returns a promise. Whilewotan
helped me find this, (and the--fix
option removed theawait
😨), I think it could be smarter - in this case I forgot the parentheses:Would it be possible to detect this and provide both errors?
Like
"Unnecessary 'await' of a non-Promise value" OR "Did you forget parentheses?"
The text was updated successfully, but these errors were encountered: