Skip to content

Auto-generate Flow definitions from TS definitions using flowgen#16

Merged
kitten merged 4 commits intomasterfrom
flow-types
May 6, 2019
Merged

Auto-generate Flow definitions from TS definitions using flowgen#16
kitten merged 4 commits intomasterfrom
flow-types

Conversation

@kitten
Copy link
Copy Markdown
Member

@kitten kitten commented Apr 14, 2019

I've been meaning to add this for a while; Using flowgen we can generate some nice Flow definitions from our rather simple TS definition files.

This will still need to be tested but I'm already opening a PR so that it's visible.
The script that's being added generates .js.flow files for each d.ts file.

This also upgrades bs-platform which contains a rather important fix for arity-0 functions being passed when a user is meaning to ignore the only argument, which lead to an infinite loop before.

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 14, 2019

Coverage Status

Coverage remained the same at 82.372% when pulling ed74904 on flow-types into 806e71e on master.

@parkerziegler
Copy link
Copy Markdown
Collaborator

Really sweet! One question I have – is there a particular reason we don't want these checked in to version control? I've never used Flow 😱 and don't know much about what should / shouldn't be checked in to vc.

@kitten
Copy link
Copy Markdown
Member Author

kitten commented Apr 14, 2019

@parkerziegler There's really no particular reason not to check them in, but I prefer not to check in build artifacts. As long as we assume there don't have to be any manual changes to the autogenerated .js.flow files, it's less error-prone to not check them in. Otherwise it's easy to forget to regenerate them, to make manual changes that'll then be overwritten, etc.

@cem2ran
Copy link
Copy Markdown

cem2ran commented Apr 17, 2019

@kitten I'm curious if you tried out genType and if so if you ran into any issues generating types for TypeScript and Flow through it?

@kitten
Copy link
Copy Markdown
Member Author

kitten commented Apr 17, 2019

@cem2ran yes, I've tried it before but ran into issues where the generated types weren't quite working as they're very much geared towards types for apps. I think I also encountered an issue when trying to then use it in another library or app that wasn't using gentype.

The issue here is still open so I'd say it's just not there yet: rescript-association/genType#95

From a maintenance standpoint I believe though that it's completely acceptable to author Typescript definitions separately

@kitten kitten merged commit 8a6e87e into master May 6, 2019
@kitten kitten deleted the flow-types branch May 6, 2019 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants