-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add generic to Object.entries #7717
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
This is unsound given inexact objects. |
How many PRs adding this were made? Same for Object.keys, maybe docs should explain soundness better? |
It would be nice if |
@lyleunderwood @goodmind By the way, @goodmind, why dont you use "Exact" ? |
@goodmind Just be honest and say you never use Object.values/.entries/.keys together with flow and that's why you just don't see a problem with that.
Same thing with Again: I don't know why you refuse to understand that. You always bring up the same argument, "this breaks with inexact objects", well, yeah, thank you very much, we know that too. There are a lot of good suggestions by a lot of people, a lot of pull requests and issues were opened, but they all get closed for no reason, one after another. For more than 3 years now. And now the most popular typechecking library isn't able to properly typecheck objects. Congrats. And we can't even override flowlib definitions? What the hell? TIHI. |
@nnmrts you don't need to be so negative here, I understand your frustration, I'm just a user too. This just goes against Flow goal to be as sound as possible, Flow never had completeness in mind. EDIT: Collaborator badge just means I have rights to label issues, I don't work for Facebook or Flow team related |
Ye, sorry. I don't want to attack anyone personally here, but the fact that flow is missing this feature is just mind-boggling to me. Because just not fixing it and not letting others try to fix it, is not a solution, Facebook. Every other library I know would give you an option to opt-in for a feature, when the developers think the idea of it is "flawed" but the feature still "just works" for most of the users.
That's not a completeness issue tho, sorry. Flow is described as "a static typechecker for JavaScript." and this is a direct quote from the website:
Turns out it doesn't understand common JavaScript patterns. I would understand the completeness argument if we are talking about async/await stuff, experimental es7 stuff, generator stuff, even class stuff. No sane person would complain about that, because it's acceptable that a typechecker can't understand language syntax that was basically released yesterday. But:
A typechecker that doesn't support basic, 8 years old features of a language isn't "incomplete", it's useless. |
What I'm referring to |
@goodmind Thanks, I've already read those comments, however we got no reaction to them. This whole problem is ignored since 2016, at least here on GitHub. |
With b9aae51, object types that have an indexer and no explicit properties (e.g. |
In my humble opinion there is one strong problem, in
Object.entries()
typings .Me and many other developers cannot use this perfect API because we should "fight" with this
mixed
Tuple second value type, and as the result, flow wins, this method keeps being unused.Here is simple implementation of the problem