I'd like to use Koa with Flow types and am happy to put in the work and enlist people to help out, I'd just like to check with the maintainers this is a PR you'd consider accepting. What I specifically have in mind is to add Flow types to Koa 2's public API (ex: annotating the fields of the Koa context object, typing the next() function) and set up a small build script with https://github.com/flowtype/flow-remove-types/ that strips out the type hints before publishing. End users who don't use Flow won't be affected and those who do will get more complete type checking.
-1 from me, see https://github.com/koajs/koa/issues/556
you can help add koa to flow-typed: https://github.com/flowtype/flow-typed/pull/44
One problem with the flow-typed repo is that the type declarations are decoupled from the source code even though they are very related to it, we want high cohesion between the source and types. It's much better to group the types with the source code if (this is key) the people primarily responsible for the source code are willing to be responsible for the types too. But if after all things considered the maintainers don't want Flow types then this is moot.
Yea, this comes up every so often it seems all over the place (usually about typescript vs flow) and the root argument is the same: having the idealistic situation of the annotations with the implementation vs the writers of the implementation even understanding the annotations.
Having them together implicitly adds an official air to them, and if I were a typescript users, I would expect a module that published typings to publish _correct and complete_ typings. That of course becomes an issue when the maintainers of the project itself have no idea how yo write the typings nor any interest in learning them.
I certainly hope that people can just sit back and write great JavaScript and publish it to npm without getting harassed to go learn the next new annotations language to publish them as well; that can certainly wear on the maintainers who probably just want to write their JavaScript that runs on node.js and publish it to pretty much the only registry for node.js modules and share the work with the world.
I'm certainly not saying there is not a subset of node.js users that just want to write in typescript / flow and that's ok! Both of those systems seem to acknowledge that not all module authors will publish their annotations and have a side channel way to publish. I know typescript has spent a lot of time improving their side channel to better deal with typings to implementation version, but it is still a wip. If that was seamless, then I think a lot of the side channel argument goes away.
i'm not really interested in a build process in publishing as koa.
however, i wouldn't mind type annotations. would also be cool if flow type supported typescript annotations in a separate repo as that would kill two birds with one stone.
we're not going to include this in koa. thanks!
@ide this might help you https://github.com/lifeeka/koa-skeleton