Closed sgodwin424 closed 8 years ago
Fast fix. Thanks!
I have a case such as the following:
let foo: Array<string|Type> = [ ];
for (let bar: string|Type of foo)
{
// ...
}
Where I receive the same error as before. I will take a look after Thanksgiving if you haven't gotten around to looking at it.
Thanks for the great plugin!
In the following example:
I get a runtime error that bar violates its contract as it
expected string got undefined
. This only happens when foo is an empty array, but it seems a bit silly for this to occur. Running the same code through Flowtype does not produce a warning or error.It is easy enough to just use
?string
but this requires an additional null/undefined check before usingbar
so that Flowtype will not complain about it as well.