Should we accept purposely incomplete lib defs of huge libraries?
See original GitHub issueProblem
There are huge libraries in the JS ecosystem that are not flow-typed. Namely material-ui
which many have asked for and firebase
which I’m starting to get into now.
I’m slowly typing out my stub for firebase
which works well but it’s a huge effort for myself or anyone for that matter if the first submission of the type def had to be fully complete because I doubt I’ll use all the features to be able to ensure it works for everyone.
I did previously add the definition for cypress, but even that was a huge effort that took me days/weeks but I had the motivation because someone else had previously attempted a PR I could base the definitions off. I don’t use all the functions from cypress so I couldn’t validate that they’re all accurate but from the previous attempt I was confident enough to make a submission.
Not having things like material-ui
I think really hurts the flow community’s growth because although the avid flow users don’t use material-ui since I personally see it as a more hobbyist library, a lot of new comers would come from that and would find the ecosystem not worth it without their most depended on library typed in comparison to TS.
Proposal
What I’m wondering is if the general community here would accept a partially typed definition, so that something can at least be started even if it doesn’t work for everyone initially. If not the case, I doubt I would ever feel confident enough to submit my stub back to the community.
Of course whatever submitted would include thorough testing against the lib def of what’s there so that quality is kept, just that complete definitions won’t be there.
I would also note that I my thoughts are that incomplete objects are typed as {| |}
instead of { ... }
and more object properties are simply added over time.
What’s your thoughts? Tagging some active contributors to get the conversation going @pascalduez @AndrewSouthpaw @villesau @GAntoine @jedwards1211 @Ashoat @atabel
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
I think incomplete typedefs are also better than nothing. But it could be good to communicate it somehow and have guidelines for people to follow: Let’s say you have following type:
() => NotReallyTypedType
. Should it return mixed or any?any
for ease of use,mixed
for soundess. Flow advocates for soundness, but returning mixed is a huge pain in the ass. I’d go with any, or if we know it’s an object, some object type etc.Guidelines would help people revieweing to review incomplete libdefs as well as implementing partial libdefs.
To close this off. Probably just need to add some docs to bless this standard