Non-nullable promises shouldn't be allowable in conditions #34717
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Search Terms
Promise, conditions, if, truthiness, coercsion, known-true
Related
#9041, #33178
Suggestion
Non-nullable promises should not be implicitly converted to truthy inside of conditions.
Use Cases
This helps prevent common bugs where promises aren't
await
-ed (see below).Examples
should result in an error since
isAllowedToDoTheSuperSecretThing
returns a non-nullable promise and is never falsey.Checklist
My suggestion meets these guidelines:
This definitely falls into the camp of goal one:
Statically identify constructs that are likely to be errors.
This would be breaking but so is #33178.
The text was updated successfully, but these errors were encountered: