Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object.keys return value treated different than other functions returning Array<string> #7857

Closed
kevinbarabash opened this issue Jun 27, 2019 · 3 comments
Labels
bug Closed: duplicate Typing: soundness No false negatives (type checker claims that there is no error in the incorrect program)

Comments

@kevinbarabash
Copy link

kevinbarabash commented Jun 27, 2019

Flow version: 0.102.0

Expected behavior

Flow should treat the return type of Object.keys the same way as other functions returning Array<string>. The return type for Object.keys is Array<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.

@goodmind goodmind added the Typing: soundness No false negatives (type checker claims that there is no error in the incorrect program) label Jun 27, 2019
@goodmind
Copy link
Contributor

Related #6927

@kevinbarabash
Copy link
Author

I'm going close this as a dupe of that ticket. Thanks for linking to that.

@goodmind
Copy link
Contributor

goodmind commented Jul 5, 2019

Duplicate of #6927

@goodmind goodmind marked this as a duplicate of #6927 Jul 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Closed: duplicate Typing: soundness No false negatives (type checker claims that there is no error in the incorrect program)
Projects
None yet
Development

No branches or pull requests

2 participants