-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Flow Enums support #11433
Labels
Comments
This was referenced Nov 24, 2023
This was referenced Jan 26, 2024
This was referenced Feb 11, 2024
This was referenced May 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your proposal related to a problem?
Flowtype introduced Enums: a new feature that extends the language https://medium.com/flow-type/introducing-flow-enums-16d4239b3180 (starting from
v0.159
). In order to use the feature, certain tooling update is required: https://flow.org/en/docs/enums/enabling-enums/#toc-upgrade-tooling and a new Babel plugin needs to be enabled: https://flow.org/en/docs/enums/enabling-enums/#toc-enable-enums. Given that CRA does not allow extending Babel config, this means Flow Enums are not available for CRA users.Describe the solution you'd like
CRA already has decent support of Flow: the user can simply create CRA project, install Flow and just use it. It is possible because Babel config includes necessary Flow-related plugins. Ideally, I'd like CRA team to consider adding
babel-plugin-transform-flow-enums
to Babel config. The required runtime dependencyflow-enums-runtime
can be added by the user, whenever they actually consider using Flow (and its enums).Describe alternatives you've considered
Craco and the rest of solutions for extending CRA configs were considered. Personally, I'd like to avoid them because of possible issues with upgrading CRA versions in the future and simply because those are like Pandora's boxes.
Another alternative solution I'd consider is having a separate template (alike TypeScript) for Flow projects:(Edit: I forgot templates don't change configs)create-react-app my-project --template flowtype
. This can also help moving existing Flow-related plugins out of default settings (if it can make users life easier in any way).The text was updated successfully, but these errors were encountered: