Closed jorgebucaran closed 7 years ago
For myself (who has never used typescript or flow in anything, so I shouldn't really be talking... :-P ) I don't really see the point of adding a type checker to this, as it:
but at the same time It wouldn't do any harm (I think?) So if adding Flow would give you that good feeling of clean, polished code, then go for it :)
Ah... I see now that we did not bring the hyperapp tests over yet. We should do that. I also noticed there's already an issue about that. Once we settle on a test framework, I'm happy to help out porting the tests (time permitting)
Hi, I think we do not need to invest a lot for Flow, instead, for a small lib like picodom (which is already readable), let's use the comment based syntax of Flow for type checking.
@sumeetsarkar I didn't know about this. Thanks for suggesting it.
For what is worth, typescript also supports comment syntax, and since it uses standard jsDoc syntax it operates with other tools that support it.
@andyrj Do you want to take this one?
Sure, I will start a PR with basic flow typing. I will need help with typescript, haven't dug into it like I have flow.
@andyrj Can we do typescript on a different PR? I was hoping you'd only take care of the flow file. Like you are trying to do in hyperapp.
@jbucaran ya I am still getting my coffee in me, just saw that typescript pr, I was only going to do flow :smile:
I made a PR for flow library definition, did you want type comments in the code base itself like @sumeetsarkar mentioned above?
I am going to change my flow PR, to generate the index.js.flow in the build from type declarations added to the source so that it is distributed with npm. https://medium.com/@ryyppy/shipping-flowtype-definitions-in-npm-packages-c987917efb65
My PR has an initial hand written picodom.js.flow, that would need to be copied into dist/ on build, and then I went through all the necessary steps to add flow to the code base itself in later commits of that PR. I tend to feel like adding flow to the code base is marginal, as it ends up requiring some helper functions to work around flow issues. (Invariant, and getIndexedElement in my PR)
I think we should just hand craft a picodom.js.flow and copy it into dist/, which wouldn't require any changes to the code and would allow users to utilize flow.
Curious what your guys take is however which is why I went ahead and made the code changes that would be needed in that PR.
Closing in favor of #24! 😄
Should we use flow?
7