Skip to content

Instantly share code, notes, and snippets.

@guillaumewuip
Last active July 1, 2020 20:22
Show Gist options
  • Save guillaumewuip/ede444721da0410c7191c7e5e4ca9984 to your computer and use it in GitHub Desktop.
Save guillaumewuip/ede444721da0410c7191c7e5e4ca9984 to your computer and use it in GitHub Desktop.
import * as Message from ‘../path/to/message.ts’;
const message: Message = Message.createText({ text: ‘hello world’ });
if (Message.isText(message)) {
return <p>This is a text</p>;
} else {
return <p>This is an image</p>;
}
// or
return fold({
Text: () => <p>This is a text</p>,
Image: () => <p>This is an image</p>,
})(message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment