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
typeO={a: 1,b: 2};typeK1='a'|'b';// should be equivalent to K1typeK2=$Keys<O>;// gives incompatible-cast (expected)('ab'.split(''): $ReadOnlyArray<K1>);// gives props-missing (???)('ab'.split(''): $ReadOnlyArray<K2>);
Expected behavior
I'd expect the ('ab'.split(''): $ReadOnlyArray<K2>); cast above to throw an incompatible-cast error, like the first one does.
Actual behavior
A prop-missing error is given instead:
12: ('ab'.split(''): $ReadOnlyArray<K2>);
^ Cannot cast `'ab'.split(...)` to read-only array type because an index signature declaring the expected key / value type is missing in `O` [1] in array element. [prop-missing]
References:
12: ('ab'.split(''): $ReadOnlyArray<K2>);
^ [1]
I ran into this issue because I previously had a // $FlowIgnore[incompatible-cast] to suppress the first error, but that stopped working once I started using $Keys.
Flow version: 0.219.2
Expected behavior
I'd expect the
('ab'.split(''): $ReadOnlyArray<K2>);
cast above to throw an incompatible-cast error, like the first one does.Actual behavior
A prop-missing error is given instead:
I ran into this issue because I previously had a
// $FlowIgnore[incompatible-cast]
to suppress the first error, but that stopped working once I started using$Keys
.The text was updated successfully, but these errors were encountered: