-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Closed
Copy link
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingFix AvailableA PR has been opened for this issueA PR has been opened for this issueFixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do this
Milestone
Description
TypeScript Version: 3.0.0-dev.20180623
Search Terms:
Code
function foo(x: [number]) {
return x.length === 0;
}
Bug:
The error message is: Operator '===' cannot be applied to types '1' and '0'.
I found this error very confusing. It took me a while to understand that the error meant that the type on the left hand side was 1
.
In this case, I think we should instead report that the condition always evaluates to false.
Related Issues:
/cc @chrisdias
GenweiWu
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingFix AvailableA PR has been opened for this issueA PR has been opened for this issueFixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do this