Last active
September 2, 2016 11:13
-
-
Save leonardfactory/f2d90114e39befcb80324fb8813fed19 to your computer and use it in GitHub Desktop.
Data types in Flow
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
// Definition | |
export type Primitive = { type: string; }; | |
// 'Factory' | |
export function Primitive(type:string) { | |
return { | |
type: string; | |
} | |
} | |
// Flow throws error since `Primitive` is a duplicated declaration. | |
// Which is the 'nice way' in order to declare factories & data type definitions? | |
// I'd like to avoid something like `function primitive()` since the cap specifies | |
// it's a Data type factory and not just a common function, but I don't know if this is correct. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment