-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Add feature to indicate when calling an async method that has await key omitted #57359
Comments
TypeScript does not have the concept of warnings. There are only errors. |
Duplicate #13376 |
That's not a motivating example... motivational, yes, but not a motivating example.
Significantly more painful, though. |
This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
New feature request. Typescript adding warnings or code comments.
“Hey buddy, I see you didn’t add an await keyword to that function.
Sometimes code acts differently if you don’t have that. Just saying bro…”
…On Mon, Feb 12, 2024 at 7:25 PM TypeScript Bot ***@***.***> wrote:
Closed #57359 <#57359> as
not planned.
—
Reply to this email directly, view it on GitHub
<#57359 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIIVXZAA4BIQ35NLAN5MADYTK6IPAVCNFSM6AAAAABDCDKVE6VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRG44DEMJUG42DANY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
🔍 Search Terms
await async promise
✅ Viability Checklist
⭐ Suggestion
In a typescript project, after creating an async method the next step would be to use it. Adding an warning if await is not used is helpful for debugging.
But async methods have different behavior if you use the await keyword before hand.
Calling this function:
In the first call the program flow continues to the next line.
In the second call the program execution flow pauses.
Both cases are valid but having a warning (not an error) for the cases when the
await
keyword is missing would be very desirable.I don't know how many times my code has behaved unexpectedly and the unexpected behavior is due to a missing
await
keyword for anasync
function. Having a simple indication in typescript gives me an notice that maybe I need to add an await.📃 Motivating Example
"A new feature in Typescript will alert you when your code omits the await keyword when calling async methods, saving developers hours of time for hard to track bugs!"
💻 Use Cases
What shortcomings exist with current approaches?
if you don't use await on an async method there's no indication that the call is no longer waiting or pausing the execution flow. there's no way to tell when debugging if the function is inside of an async program execution
What workarounds are you using in the meantime?
pulling out my hair saves money on haircuts
The text was updated successfully, but these errors were encountered: