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

Flow Enums support #11433

Open
alexeyraspopov opened this issue Sep 13, 2021 · 0 comments
Open

Flow Enums support #11433

alexeyraspopov opened this issue Sep 13, 2021 · 0 comments

Comments

@alexeyraspopov
Copy link
Contributor

alexeyraspopov commented Sep 13, 2021

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 dependency flow-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: 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). (Edit: I forgot templates don't change configs)

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

1 participant