-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Inconsistent missing await in conditional errors, invalid quick fix #43514
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
Comments
This example is unfortunate because the type of let thing: Promise<string> | undefined = cache[id]; EDIT: As pointed out in #43565, I screwed this example up ☝️. What I meant to write was let thing = cache[id] as Promise<string> | undefined;
The fact that the The duplicated comment is a bug. |
Thank you for very detailed explanation. The reason I found these behaviours "sketchy" to the point of filling out an issue is because from the perspective of someone who doesn't know these very specific details (and a sample of 1 such someone) the feature seems broken. I was expecting it to be more generic. Now that I went back and read 4.3 beta announcement again, everything checks out. It works just like advertised. |
How do you mean? The general idea is that doing |
Promise is just an object, special handling for something that is truthy in a ternary/if feels weird. Especially when use of such value in a condition operand results in typechecker error.
As twisted as my logic is, exactly for this reason. I'm so accustomed to never getting errors when checking values for their truthiness that getting one with this new feature feels weird. Again, just a feeling. |
🔎 Search Terms
🕗 Version & Regression Information
Since 4.3.0-dev
⏯ Playground Link
Playground link with relevant code
💻 Code
After applying quick fix to
getChachedThing3
error:Quick fixed code is invalid (
await
is added to non-async function). Also, comment gets duplicated.🙁 Actual behavior
🙂 Expected behavior
As a sidenote, I think the "missing await in conditional error" feature should be under a flag
The text was updated successfully, but these errors were encountered: