-
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
Move blob/v*/lib/react.js from this repository to flow-typed #5474
Comments
This is a Godsend: https://www.saltycrane.com/flow-type-cheat-sheet/latest/ |
It's depressing that the cheat sheet needs to exist in the first place but that will help me until this is resolved, thanks! |
Just try finding the definition of SyntheticEvents for flow-types in Google... just try |
You can download the file and place it in your flow typed folder. I did that for node |
@aikar That's still a temporary workaround, it doesn't resolve the actual issue that this information should not live in this repository... or flow-typed should be merged into this repository. |
Any update on this? I understand priorities / feature discussions happen internally. Was there any discussion on this point someone internally can share? |
Hello, following up again. Could we have someone from the FB comment here? |
I deleted this because I thought it was snarky but I'll put it back because it's funny |
Disclaimer: Not at FB, not a Flow maintainer, not part of any behind-the-scenes discussions. I think the main impediment to doing this is that In other words, as things stand, it's a matter of maintaining interdependent pieces of code in one place over moving one of them to another repo. Not that the dependency couldn't be refactored away in theory, but it's probably a big ask. |
Thanks for the extra context, definitely did not know about the |
Question for the maintainers, is this something you would be interested in investigating or possibly taking? |
cc: @avikchaudhuri |
cc: @gabelevi, @jbrown215, @samwgoldman, @nmote Following up again. Would someone from the Flow core team be willing to provide some context? Is this something they'd be willing to accept a PR for? |
Following up again. Would appreciate any additional context the core team could offer on this. |
Constantly bumping a ticket with a bunch of CCs on it is a great way to annoy the piss out of the maintainers and make sure this never happens. There's a huge backlog of issues and this is something that would require significant effort to make happen and offers only questionable benefit. Be patient and hope (or open a PR), but there's very little chance that this happens. |
I'm not annoyed, I just don't have much to add. We've talked about moving all the libdefs into flow-typed but nobody is actively working on it and I don't know what complications there might be. I can say that I'd be surprised if we moved React over and not the other builtins. |
Thanks for the info, @nmote. Apologies if my pings are annoying. That was not my intent. With that said, as it stands, it's still unclear if we did this work and submitted a PR if it would even be accepted. At the very least, would a PR be welcome? |
I really don't know what would be involved to do this correctly. As others have mentioned, quite a bit of React logic is baked into Flow, so I doubt it would be as simple as just moving the file over. And if we do end up moving all of the libdefs over we would need to make sure that the libdef installation process is seamless and well-documented. Because of this, a PR that simply removed the React libdefs in favor of a flow-typed copy would probably not be accepted. If somebody wanted to write up a project proposal that would be a good start, but I can't promise anything. The team is pretty busy so it might be hard to find time to properly review it. |
Specifically targeting React as an example: Would moving it's flow definitions into a *.js.flow into the React npm module instead of flow-typed be more acceptable? What are the chances of React being okay with that addition (asking since I'm not inside Facebook 😄)? |
@rickyp-uber I would create a separate issue on the react github project so that the react folks will see it. |
Just FYI, the react thread left off at a point I don't quite know how to refute.
The issue here (from what I get) isn't owning the types but it's more which version of flow-bin is required and having the type defined for that specific version of flow. This also is a curiousity as to how the *.js.flow files can define version compatibility ranges depending on what version of flow someone is running so if an older version of flow is running than what the definition defines, some error information or something occurs. Basically, I think this is a great conversation to have, I'm just not the person to have it due to lack of knowledge of the architecture of flow and the direction it wants to go. Is flow-typed the main use case flow wants to support or was *.js.flow added to alleviate that requirement? Is there a decent counter argument of "Well why wouldn't you keep flow-bin up to date no matter what" coming into this debate? |
I agree with that quote. I don't think this issue is specific to React -- I don't think that in general, it's a good idea to publish Flow types as part of a module, because then specific versions of that module can get pinned (inadvertently, through breaking changes to Flow) to specific versions of Flow. This is especially bad if your program uses multiple different libraries which are each pinned to a different Flow version. The solution is to publish all libdefs to flow-typed. That way, you can have as many (Flow version, library version) pairs available as are required, and people who are not involved with the library are able to contribute library definitions. The problem with this is that there is no way to take a library and automatically generate a libdef for it. This means that even if you already use Flow, you have to manually write your libdefs, which is a tedious and error-prone process. At some point we would like to provide such functionality, but we haven't been able to make it a priority yet. In the meantime, we created Bottom line: long term we would like to move all libdefs to flow-typed (both those that are currently built in and those for npm packages) and then make Flow stop even looking in the Hope this answers your questions. |
Yep thanks! Sounds like the goal is to get it into flow-typed not react lib as long term *.js.flow likely won't have the same support as flow-typed. |
I have some experience doing this for local projects (e.g. we generate a flow type definition based on a configuration schema we feed to convict, so when we I started poking at flow-parser.js and I have one question: is it possible to merge |
Closing since some parts of the react libdefs are builtin in Flow. The |
This is honestly the single most frustrating thing I've encountered as I move to flow. As a developer because the rest of my flow-type definitions exist in a flow-typed folder or in the node_modules folder it's easy to look up definitions. Because this isn't the case for react, it create a massive hurdle in terms of looking up specific react definitions.
The example problem scenario - I want to see the props related to a HTMLButton. In typescript you can simply go to definition of any element and you'll eventually get to ButtonHTMLAttributes. This works for other flow-type libraries as well, just not React.
Instead for flow typing for the react library, I have to have this url bookmarked in my browser to be able to look up dom attributes. Not the best developer experience in my opinion.
The text was updated successfully, but these errors were encountered: