Last active
May 24, 2018 13:33
-
-
Save koss-lebedev/106938164be5c5dd7a36f744972afef8 to your computer and use it in GitHub Desktop.
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 | |
const SIZE = Object.freeze({ | |
LARGE: "large", | |
MEDIUM: "medium", | |
SMALL: "small" | |
}) | |
type ISize = $Values<typeof SIZE> | |
// props type for Avatar component | |
type IProps = {| | |
size: ISize, | |
|} | |
const Avatar = (props: IProps) => ( | |
// ...component details are omitted | |
) | |
// this works | |
<Avatar size={SIZE.LARGE} /> | |
// this works as well, althouh it's discouraged | |
<Avatar size="large" /> | |
// this gives an error | |
<Avatar size="larg" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment