Skip to content
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

Develop a library with flowtype #2374

Closed
rayshih opened this issue Sep 1, 2016 · 6 comments
Closed

Develop a library with flowtype #2374

rayshih opened this issue Sep 1, 2016 · 6 comments
Labels

Comments

@rayshih
Copy link

rayshih commented Sep 1, 2016

I'm currently developing a library using flowtype. And I'm using babel with preset-0. Also, transpile it before npm publish.

After transpiling, the type annotation has been thrown away, so projects using my library won't have benefits of type checking. I have tried some way to handle this problem.

  1. directly import the original source in the project. which means this project also need to have preset-0.
  2. use flow-comments babel plugin. However, I cannot make it works.
  3. use another declaration file. But this heavily violates DRY.

Is there a the suggested way to do this?
And for point 2, am I doing something wrong?

Thanks

@rpominov
Copy link

rpominov commented Sep 1, 2016

See #1996 (comment)

Just as an example of a project setup, I have this "preversion" script in one of my projects: https://github.com/rpominov/fun-task/blob/9e5b512e4d4e2b6aeaf967ca63991afa0b3c885b/package.json#L10

@rayshih
Copy link
Author

rayshih commented Sep 3, 2016

@rpominov Thanks!

@LPGhatguy
Copy link

In the changelog, the existence of a gen-flow-files command is hinted at!

It's supposed to be alpha-level, but try:

flow gen-flow-files --out-dir lib src/index.js

@rayshih
Copy link
Author

rayshih commented Sep 7, 2016

@LPGhatguy yeah I saw that....this is exactly what I want.

@asolove
Copy link
Contributor

asolove commented Aug 29, 2017

I think the .js.flow build step strategy is well enough documented now that we can close this issue.

@asolove asolove closed this as completed Aug 29, 2017
@sterzhakov
Copy link

sterzhakov commented Jan 2, 2019

I think the .js.flow build step strategy is well enough documented now that we can close this issue.

Where I can read about this strategy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants