Created
July 18, 2018 11:12
-
-
Save yogurt1/c55db7164af15e824a2992505f6a614b to your computer and use it in GitHub Desktop.
Flow wtf
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 | |
type User = { | |
name: string, | |
email: string, | |
phone: string, | |
isEmployee: boolean, | |
isAdmin: boolean, | |
}; | |
type Client = User & { isEmployee: false, isAdmin: false }; | |
type Employee = User & { isEmployee: true, isAdmin: false }; | |
type Admin = User & { isEmployee: true, isAdmin: true }; | |
const user: Admin = { | |
name: 'kek', | |
email: 'kek', | |
phone: 'kek', | |
isEmployee: true, | |
isAdmin: true, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment