Created
June 4, 2016 17:04
-
-
Save sverrejoh/81fe3a521ea3de2193ef1212d310d623 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 */ | |
| type FooStyle = { | |
| style: { | |
| width: number, | |
| }, | |
| data: { | |
| type: "foo" | |
| } | |
| } | |
| type BarStyle = { | |
| style: { | |
| height: number, | |
| }, | |
| data: { | |
| type: "bar" | |
| } | |
| } | |
| type ElementStyle = FooStyle | BarStyle; | |
| function process(ele: ElementStyle) { | |
| if (ele.data.type === "bar") { | |
| // This gives a flow error as height is not found in the object. | |
| console.log(ele.style.height); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment