Object.keys return value treated different than other functions returning Array<string> #7857
Labels
bug
Closed: duplicate
Typing: soundness
No false negatives (type checker claims that there is no error in the incorrect program)
Flow version: 0.102.0
Expected behavior
Flow should treat the return type of
Object.keys
the same way as other functions returningArray<string>
. The return type forObject.keys
isArray<string>
as defined by https://github.com/facebook/flow/blob/master/lib/core.js#L71.Actual behavior
Currently flow allows pushing non-string elements to the arrays return by
Object.keys
, but does not allow pushing of non-string to arrays returned by other functions.Example
If we want the return value of
Object.keys
to be treated differently it should be typed differently.The text was updated successfully, but these errors were encountered: