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

FlowType Support #51

Open
AlexGilleran opened this issue Aug 23, 2016 · 8 comments
Open

FlowType Support #51

AlexGilleran opened this issue Aug 23, 2016 · 8 comments

Comments

@AlexGilleran
Copy link
Owner

Just making this to keep track of it, I don't have a complete solution at this stage.

FlowType doesn't like JSX-Control-Statements in two ways - the first is that we're effectively using global types which is easily fixed with a type declaration:

// @flow

type ForType = ReactClass<{each: string, index: string, of: any}>;

declare var For: ForType;

But the problem is the "each" and "index" of the For won't be known to FlowType and it'll not only fail, but also not support type checking which sucks.

Best I have so far is to just declare those variables in the render function with the right type.

@AlexGilleran
Copy link
Owner Author

Have added flow types to the build, which fixes like 2/3 of this but doesn't quite get us all the way :(.

@gajus
Copy link

gajus commented May 16, 2017

Without Flowtype support, jsx-control-statements is useless in a project that uses Flowtype, e.g.

<If condition={movie}>
  <div>{movie.name}</div>
</If>

(where movie can null) movie.name will always trigger Flow error.

I am not sure if it possible to solve this in Flowtype.

@apsavin
Copy link

apsavin commented May 29, 2017

@AlexGilleran Can we do something to teach flow what If control statement does?

@AlexGilleran
Copy link
Owner Author

I'm open to suggestions :(.

@apsavin
Copy link

apsavin commented May 29, 2017

I opened an issue with a question in flow repo: facebook/flow#4057

@gajus
Copy link

gajus commented Aug 23, 2017

@AlexGilleran @apsavin Has there been any progress on this?

@AlexGilleran
Copy link
Owner Author

Not in a way that helps us:

Flow understands javascript and jsx semantics. This plugin changes it, so the code is not compatible with flow anymore

Which is fair enough, but also :(.

@AlexGilleran
Copy link
Owner Author

Although maybe facebook/flow#1515 can save us eventually.

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

No branches or pull requests

3 participants