Created
February 20, 2020 07:53
-
-
Save guillaumewuip/1374aa818860d51da973da7110adc53e to your computer and use it in GitHub Desktop.
How to model your entities - 6
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
// If this function returns true, TS will know the message variable is a TextMessage | |
function isText(message: Message): message is TextMessage { | |
return message.messageType === ‘TEXT’; | |
} | |
// Repeat for isImage and isAudio |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment