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

Stateless components with flow props broken in v6.1.0 #766

Closed
SomeHats opened this issue Aug 15, 2016 · 1 comment
Closed

Stateless components with flow props broken in v6.1.0 #766

SomeHats opened this issue Aug 15, 2016 · 1 comment

Comments

@SomeHats
Copy link

SomeHats commented Aug 15, 2016

This commit appears to be what introduced the problem: 763382f. Perhaps an alternative approach to solving that problem could be using how the types are referenced in the code - as the first argument to a stateless component, or passed in as a type parameter to React.Component for stateful ones, rather than based on a naming convention

In v6.0.0, this code was fine:

type MyComponentProps = {
  a: number,
  b: string,
};

function MyComponent({ a, b }: MyComponentProps) {
  return <div />;
}

In v6.1.0, that gives 'a' is missing in props validation and 'b' is missing in props validation. If I change the code to

type Props = {
  a: number,
  b: string,
};

function MyComponent({ a, b }: Props) {
  return <div />;
}

everything works fine.

Thanks for your great work on this project! :)

@lencioni lencioni added the bug label Aug 15, 2016
@yannickcr
Copy link
Member

Working on it.

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

No branches or pull requests

4 participants