You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even though I am well aware that this bug is not one of the most pressing issues at hand and that it is actually not a real problem at all, since all arrays will already produce a truthy value in the first part of the if-clause, I still think that it could lead to some confusion at first glance. I tried my best finding a post mentioning this very specific bug, but I couldn't.
Expected behavior: Error: Property does not exist on type 'never'
Since Array.isArray(...) will, to the best of my knowledge, never produce a truthy value when given something of type undefined. However, it should produce an Error: Property does not exist on type 'never' error, since the second part of the clause will never be evaluated with something of type array (because that would already be truthy in the first half).
Actual behavior: Error: Object is possibly 'undefined'
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered:
Even though I am well aware that this bug is not one of the most pressing issues at hand and that it is actually not a real problem at all, since all arrays will already produce a truthy value in the first part of the if-clause, I still think that it could lead to some confusion at first glance. I tried my best finding a post mentioning this very specific bug, but I couldn't.
TypeScript Version: 3.7.5
Search Terms: Array.isArray undefined
Code
Expected behavior:
Error: Property does not exist on type 'never'
Since
Array.isArray(...)
will, to the best of my knowledge, never produce a truthy value when given something of typeundefined
. However, it should produce anError: Property does not exist on type 'never'
error, since the second part of the clause will never be evaluated with something of typearray
(because that would already be truthy in the first half).Actual behavior:
Error: Object is possibly 'undefined'
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: