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

experimental.well_formed_exports is on by default in React Native 0.62, yet has unclear error messages and is undocumented #8279

Closed
jamesisaac opened this issue Feb 3, 2020 · 4 comments

Comments

@jamesisaac
Copy link
Contributor

This commit (cc @panagosg7 ) has added these config options to the default .flowconig template in new React Native projects starting from 0.62:

experimental.well_formed_exports=true
experimental.types_first=true

From what I can see, neither of these options are documented anywhere (would expect them to be here).

The issue I think people will have with experimental.well_formed_exports=true, is that it will introduce hundreds of errors into any mature codebase. The Flow docs for React components suggest to type functional components like so:

function MyComponent(props: Props) {

This will lead to an error under well_formed_exports, as (from what I understand) they need to be typed like so:

function MyComponent(props: Props): React.Node {

The error message doesn't even make it clear that this option is the reason. It makes it sounds like it's the lint rule's fault (signature-verification-failure=warn), but turning that to off makes no difference:

Cannot build a typed interface for this module. You should annotate the exports of this module with types. Missing type annotation at function return: (`signature-verification-failure`)

The only way I was able to remove these hundreds of new errors (as I didn't have time to update hundreds of export signatures), was process of elimination trying disabling various lines in the flowconfig until the errors disappeared.

@panagosg7
Copy link
Contributor

panagosg7 commented Feb 4, 2020

Thanks for bringing this up @jamesisaac ! I'll remove these flags from the template, at least until we formally announce types-first mode, and update the necessary documentation.

@jamesisaac
Copy link
Contributor Author

@panagosg7 Ok, great! Looking forward to hearing more about Types First when it gets closer to release.

Even with a commit on master removing them from the template, I think you'd need to also get the commit cherry picked into 0.62 (react-native-community/releases#157) otherwise the template will ship as is, as it's already in RC stage.

@panagosg7
Copy link
Contributor

Sure! I'll request the pick once the fix is landed.

facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Feb 4, 2020
Summary:
Removing the experimental types-first flag from RN templates, until these are properly documented in the docs. See facebook/flow#8279 for context.

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D19728257

fbshipit-source-id: 8f7473b9c8383bd1eef76b5733ff3a26e2e554fc
alloy pushed a commit to facebook/react-native that referenced this issue Feb 13, 2020
Summary:
Removing the experimental types-first flag from RN templates, until these are properly documented in the docs. See facebook/flow#8279 for context.

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D19728257

fbshipit-source-id: 8f7473b9c8383bd1eef76b5733ff3a26e2e554fc
@jamesisaac
Copy link
Contributor Author

Fixed in the latest RC 👍 react-native-community/releases#157 (comment)

osdnk pushed a commit to osdnk/react-native that referenced this issue Mar 9, 2020
Summary:
Removing the experimental types-first flag from RN templates, until these are properly documented in the docs. See facebook/flow#8279 for context.

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D19728257

fbshipit-source-id: 8f7473b9c8383bd1eef76b5733ff3a26e2e554fc
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