Created
March 13, 2020 01:25
-
-
Save ksaldana1/d2f5926e4c2b10aff1a38d00f852c0e2 to your computer and use it in GitHub Desktop.
gql_example_ts_trunc_1
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
const Message: React.FC<MessageProps> = ({ message }) => { | |
switch (message.author.__typename) { | |
case "User": { | |
return <div>{`${message.author.name}: ${message.text}`}</div>; | |
} | |
case "Guest": { | |
return <div>{`${message.author.placeholder}: ${message.text}`}</div>; | |
} | |
case "%other": { | |
return null; | |
} | |
default: { | |
assertNever(message.author); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment