Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class EmailBroadcaster {
broadcast(event: Event, user: User) {
// Send email with event details to user.
class SubscriptionEmailBroadcaster extends EmailBroadcaster {
broadcast(event: Event, user: SubscribedUser) {
// Send email with additional subscription information
// and event details to user.
function onAccountCreated(event: Event}) {
const user = getCurrentUser(); // returns type User or SubscribedUser
(new EmailBroadcaster).broadcast(event, user);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment