Skip to content

Instantly share code, notes, and snippets.

@yogurt1 yogurt1/user.js
Created Jul 18, 2018

Embed
What would you like to do?
Flow wtf
// @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
You can’t perform that action at this time.