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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip away flow types #1863

Closed
DeMoorJasper opened this issue Aug 8, 2018 · 4 comments
Closed

Strip away flow types #1863

DeMoorJasper opened this issue Aug 8, 2018 · 4 comments

Comments

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Aug 8, 2018

馃悰 bug report

Parcel is currently not able to consume flow typed modules

馃帥 Configuration (.babelrc, package.json, cli command)

N/A

馃 Expected Behavior

Flow types should be stripped (perhaps configurable through babel)

馃槸 Current Behavior

Flow types cause errors

馃拋 Possible Solution

  • locally link a copy of the module that contains flow types
  • Ask the maintainer to publish the module using .flow and .js files. .flow being the typed one and .js being processed by babel to strip away the typings
  • Make parcel automagically detect and strip away flow types (in node modules only)

馃敠 Context

Issue #1799

馃捇 Code Sample

import Typography from 'typography';

cc @chiefGui

@DeMoorJasper
Copy link
Member Author

DeMoorJasper commented Aug 8, 2018

So I think we can just automatically detect flow and apply the babel plugin by looking at the first line as it should say: // @flow?

@chiefGui
Copy link

chiefGui commented Aug 8, 2018

Another possible solution:

If we can detect a module that contains flow types (in order to locally link it), wouldn't be less-workaroundish to make parcel apply the transform right away, exclusively against that module?

@DeMoorJasper
Copy link
Member Author

Yeah I think that'll be the best approach @chiefGui , currently doing some research on flow to make sure the annotation on the first line is really required. So I don't make assumptions of a framework I've never used

@chiefGui
Copy link

chiefGui commented Aug 8, 2018

According to their website:

Don鈥檛 forget to mention @flow on top of file, otherwise flow won鈥檛 report errors.

Also from the short period of time I've worked with Flow, I also do remember that I was required to annotate my files with @flow.

Finally, seems like in the Typography's case, they're also consistently using @flow (though I know one library isn't enough to say anything.).

This is just a support to help you on your research.

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

No branches or pull requests

2 participants