Closed as not planned
Description
Proposal
In 0.239.x a change was made
Calling shift() and pop() on an Array will now return T | undefined. #8341
Which is great but I was wondering if it could be made a little bit smarter because it leads to checks and $FlowFixMe's that shouldn't be needed.
Use case
Example:
const a = someString.split(",").pop()
Here we know for certain that a is a string because split() will return a non-empty array of strings.
Example 2:
while (stringArray.length > 0) {
const a = stringArray.shift();
...
}
We have made sure that the array is not empty but Flow still insists that a could be undefined.
Activity