-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeIn DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version: 3.0.0-dev.20180626
Search Terms:
- await
- conditional
- diagnostics
Code
async function foo(): Promise<boolean> {
return false;
}
async function bar(): Promise<string> {
if (foo()) {
return 'true';
}
return 'false';
}
Expected behavior:
A warning or error or suggestion is generated in the if
conditional since it will always be true. The user almost certainly intended to await the result of foo
instead.
Possibly also have a quick fix to add the await
Actual behavior:
No errors or warnings. Code does unexpected things
yortus, AleksandrHovhannisyan, ftzi, bpasero, NotWearingPants and 5 morebagdonas
Metadata
Metadata
Assignees
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeIn DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript