Last active
January 13, 2016 13:18
-
-
Save msolli/0c23fd9796a7d2b09916 to your computer and use it in GitHub Desktop.
Flow JSX attributes weirdness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ignore] | |
[include] | |
[libs] | |
[options] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
import React from "react"; | |
type Foo = { bar: string }; | |
class FooItem extends React.Component { | |
props: Foo; | |
render(): ReactElement { | |
return ( | |
<span>{this.props.bar}</span> | |
); | |
} | |
} | |
class FooWrapper extends React.Component { | |
render(): ReactElement { | |
return ( | |
<div> | |
<FooItem bar={42} /> | |
</div> | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
import React from "react"; | |
type Foo = { bar: string }; | |
export default class FooItem extends React.Component { | |
props: Foo; | |
render(): ReactElement { | |
return ( | |
<span>{this.props.bar}</span> | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
import React from "react"; | |
import FooItem from "./fooItem"; | |
class FooWrapper extends React.Component { | |
render(): ReactElement { | |
return ( | |
<div> | |
<FooItem bar={42} /> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When running Flow on these files, I expect to get the same type error in
foo.js
as infooWrapper.js
, namely:Instead, with Flow 0.20.1, I get the following error: